Title: [161626] trunk
Revision
161626
Author
abu...@adobe.com
Date
2014-01-10 02:38:18 -0800 (Fri, 10 Jan 2014)

Log Message

[CSS Regions] Implement visual overflow computation for inline elements
https://bugs.webkit.org/show_bug.cgi?id=125291

Reviewed by David Hyatt.

Source/WebCore:

The patch implements visual overflow computation for inline elements per region. The algorithm
uses the container region of each root line box to determine the lines in a region generated by
a RenderInline. The overflow of a RenderInline inside a region is the smallest rectangle that fits
all the line boxes belonging to that region.

The patch also correctly flips for writing mode the overflow of a renderer before clipping with it.

Tests: fast/regions/overflow-in-variable-width-regions-inline-bt.html
       fast/regions/overflow-in-variable-width-regions-inline-continuation.html
       fast/regions/overflow-in-variable-width-regions-inline-lr.html
       fast/regions/overflow-in-variable-width-regions-inline-rl.html
       fast/regions/overflow-in-variable-width-regions-inline.html

* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::objectShouldPaintInFlowRegion):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::updateAlwaysCreateLineBoxes): Always create line boxes for RenderInline
(WebCore::RenderInline::linesVisualOverflowBoundingBoxInRegion):
* rendering/RenderInline.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects):
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::visualOverflowRectForBox):
(WebCore::RenderRegion::visualOverflowRectForBoxForPropagation):
* rendering/RenderRegion.h:

LayoutTests:

Tests for inline elements overflow correct painting inside regions.

* fast/regions/overflow-in-variable-width-regions-inline-bt-expected.html: Added.
* fast/regions/overflow-in-variable-width-regions-inline-bt.html: Added.
* fast/regions/overflow-in-variable-width-regions-inline-continuation-expected.html: Added.
* fast/regions/overflow-in-variable-width-regions-inline-continuation.html: Added.
* fast/regions/overflow-in-variable-width-regions-inline-expected.html: Added.
* fast/regions/overflow-in-variable-width-regions-inline-lr-expected.html: Added.
* fast/regions/overflow-in-variable-width-regions-inline-lr.html: Added.
* fast/regions/overflow-in-variable-width-regions-inline-rl-expected.html: Added.
* fast/regions/overflow-in-variable-width-regions-inline-rl.html: Added.
* fast/regions/overflow-in-variable-width-regions-inline.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (161625 => 161626)


--- trunk/LayoutTests/ChangeLog	2014-01-10 09:11:00 UTC (rev 161625)
+++ trunk/LayoutTests/ChangeLog	2014-01-10 10:38:18 UTC (rev 161626)
@@ -1,3 +1,23 @@
+2014-01-10  Andrei Bucur  <abu...@adobe.com>
+
+        [CSS Regions] Implement visual overflow computation for inline elements
+        https://bugs.webkit.org/show_bug.cgi?id=125291
+
+        Reviewed by David Hyatt.
+
+        Tests for inline elements overflow correct painting inside regions.
+
+        * fast/regions/overflow-in-variable-width-regions-inline-bt-expected.html: Added.
+        * fast/regions/overflow-in-variable-width-regions-inline-bt.html: Added.
+        * fast/regions/overflow-in-variable-width-regions-inline-continuation-expected.html: Added.
+        * fast/regions/overflow-in-variable-width-regions-inline-continuation.html: Added.
+        * fast/regions/overflow-in-variable-width-regions-inline-expected.html: Added.
+        * fast/regions/overflow-in-variable-width-regions-inline-lr-expected.html: Added.
+        * fast/regions/overflow-in-variable-width-regions-inline-lr.html: Added.
+        * fast/regions/overflow-in-variable-width-regions-inline-rl-expected.html: Added.
+        * fast/regions/overflow-in-variable-width-regions-inline-rl.html: Added.
+        * fast/regions/overflow-in-variable-width-regions-inline.html: Added.
+
 2014-01-09  Jer Noble  <jer.no...@apple.com>
 
         [Mac] .mp3 media document controls missing their background

Added: trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-bt-expected.html (0 => 161626)


--- trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-bt-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-bt-expected.html	2014-01-10 10:38:18 UTC (rev 161626)
@@ -0,0 +1,43 @@
+<!doctype html>
+
+ <style>
+    html {
+        -webkit-writing-mode: horizontal-bt;
+    }
+
+    .content {
+        width: 200px;
+        font: 16px Ahem;
+        -webkit-font-smoothing: none;
+    }
+    
+    #region1, #region2 {
+        border: 1px solid black;
+        margin: 50px;
+        float: left;
+    }
+
+    #region1 {
+        width: 200px;
+        height: 100px;
+    }
+    
+    #region2 {
+        width: 250px;
+        height: 100px;
+    }
+
+    .positioned {
+        position: relative;
+        top: 30px;
+        left: 30px;
+    }
+</style>
+
+<a href="" Regions] Implement visual overflow computation for inline elements</a>
+<p>The paragraph inside the regions must be fragmented. Each fragment must be relatively positioned based on the fragment position.</p>
+
+<div id="container">
+    <div id="region1"><div class="content"><span class="positioned">AXXXX<br/>XXXXX<br/>XXXXX<br/>XXXXX<br/>XXXXX<br/>XXXXX</span></div></div>
+    <div id="region2"><div class="content"><span class="positioned">XXXXX<br/>XXXXX<br/>XXXXX<br/>XXXXX<br/>XXXXX<br/>XXXXX<br/>XXXXX<br/>XXXXB</span></div></div>
+</div>

Added: trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-bt.html (0 => 161626)


--- trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-bt.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-bt.html	2014-01-10 10:38:18 UTC (rev 161626)
@@ -0,0 +1,48 @@
+<!doctype html>
+
+ <style>
+    html {
+        -webkit-writing-mode: horizontal-bt;
+    }
+
+    #content {
+        -webkit-flow-into: flow1;
+        width: 200px;
+        font: 16px Ahem;
+        -webkit-font-smoothing: none;
+    }
+    
+    #region1, #region2 {
+        border: 1px solid black;
+        margin: 50px;
+        float: left;
+        -webkit-flow-from: flow1;
+    }
+
+    #region1 {
+        width: 200px;
+        height: 100px;
+    }
+    
+    #region2 {
+        width: 250px;
+        height: 100px;
+    }
+
+    #positioned {
+        position: relative;
+        top: 30px;
+        left: 30px;
+    }
+</style>
+
+<a href="" Regions] Implement visual overflow computation for inline elements</a>
+<p>The paragraph inside the regions must be fragmented. Each fragment must be relatively positioned based on the fragment position.</p>
+
+<div id="content"><span id="positioned">AXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXB</span>
+</div>
+
+<div id="container">
+    <div id="region1"></div>
+    <div id="region2"></div>
+</div>

Added: trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-continuation-expected.html (0 => 161626)


--- trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-continuation-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-continuation-expected.html	2014-01-10 10:38:18 UTC (rev 161626)
@@ -0,0 +1,49 @@
+<!doctype html>
+
+ <style>
+    html {
+        -webkit-writing-mode: horizontal-tb;
+    }
+
+    .content {
+        width: 200px;
+        font: 16px Ahem;
+        -webkit-font-smoothing: none;
+    }
+    
+    #region1, #region2 {
+        border: 1px solid black;
+        margin: 50px;
+        float: left;
+    }
+
+    #region1 {
+        width: 200px;
+        height: 90px;
+    }
+    
+    #region2 {
+        width: 250px;
+        height: 100px;
+    }
+
+    .positioned {
+        position: relative;
+        top: 30px;
+        left: 30px;
+    }
+
+    .split {
+        height: 5px;
+        width: 50px;
+        background-color: green;
+    }
+</style>
+
+<a href="" Regions] Implement visual overflow computation for inline elements</a>
+<p>The paragraph inside the regions must be fragmented. Each fragment must be relatively positioned based on the fragment position.</p>
+
+<div id="container">
+    <div id="region1"><div class="content"><span class="positioned"><span id="positioned">AXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXX <span>Ne<span>sted<div class="split"></div></span></span></span></div></div>
+    <div id="region2"><div class="content"><span class="positioned"><span>SPANS</br></span> XXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXB</div></div>
+</div>

Added: trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-continuation.html (0 => 161626)


--- trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-continuation.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-continuation.html	2014-01-10 10:38:18 UTC (rev 161626)
@@ -0,0 +1,54 @@
+<!doctype html>
+
+ <style>
+    html {
+        -webkit-writing-mode: horizontal-tb;
+    }
+
+    #content {
+        -webkit-flow-into: flow1;
+        width: 200px;
+        font: 16px Ahem;
+        -webkit-font-smoothing: none;
+    }
+    
+    #region1, #region2 {
+        border: 1px solid black;
+        margin: 50px;
+        float: left;
+        -webkit-flow-from: flow1;
+    }
+
+    #region1 {
+        width: 200px;
+        height: 90px;
+    }
+    
+    #region2 {
+        width: 250px;
+        height: 100px;
+    }
+
+    #positioned {
+        position: relative;
+        top: 30px;
+        left: 30px;
+    }
+
+    .split {
+        height: 5px;
+        width: 50px;
+        background-color: green;
+    }
+</style>
+
+<a href="" Regions] Implement visual overflow computation for inline elements</a>
+<p>The paragraph inside the regions must be fragmented. Each fragment must be relatively positioned based on the fragment position.</p>
+
+<div id="content"><span id="positioned">AXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXX <span>Ne<span>sted<div class="split"></div><span>SPANS</br></span></span></span> XXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXX <div class="split"></div> XXXXB</span>
+</div>
+
+<div id="container">
+    <div id="region1"></div>
+    <div id="region2"></div>
+</div>

Added: trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-expected.html (0 => 161626)


--- trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-expected.html	2014-01-10 10:38:18 UTC (rev 161626)
@@ -0,0 +1,43 @@
+<!doctype html>
+
+ <style>
+    html {
+        -webkit-writing-mode: horizontal-tb;
+    }
+
+    .content {
+        width: 200px;
+        font: 16px Ahem;
+        -webkit-font-smoothing: none;
+    }
+    
+    #region1, #region2 {
+        border: 1px solid black;
+        margin: 50px;
+        float: left;
+    }
+
+    #region1 {
+        width: 200px;
+        height: 100px;
+    }
+    
+    #region2 {
+        width: 250px;
+        height: 100px;
+    }
+
+    .positioned {
+        position: relative;
+        top: 30px;
+        left: 30px;
+    }
+</style>
+
+<a href="" Regions] Implement visual overflow computation for inline elements</a>
+<p>The paragraph inside the regions must be fragmented. Each fragment must be relatively positioned based on the fragment position.</p>
+
+<div id="container">
+    <div id="region1"><div class="content"><span class="positioned">AXXXX<br/>XXXXX<br/>XXXXX<br/>XXXXX<br/>XXXXX<br/>XXXXX</span></div></div>
+    <div id="region2"><div class="content"><span class="positioned">XXXXX<br/>XXXXX<br/>XXXXX<br/>XXXXX<br/>XXXXX<br/>XXXXX<br/>XXXXX<br/>XXXXB</span></div></div>
+</div>

Added: trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-lr-expected.html (0 => 161626)


--- trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-lr-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-lr-expected.html	2014-01-10 10:38:18 UTC (rev 161626)
@@ -0,0 +1,43 @@
+<!doctype html>
+
+ <style>
+    html {
+        -webkit-writing-mode: vertical-lr;
+    }
+
+    .content {
+        width: 200px;
+        font: 16px Ahem;
+        -webkit-font-smoothing: none;
+    }
+    
+    #region1, #region2 {
+        border: 1px solid black;
+        margin: 50px;
+        float: left;
+    }
+
+    #region1 {
+        width: 200px;
+        height: 100px;
+    }
+    
+    #region2 {
+        width: 250px;
+        height: 100px;
+    }
+
+    .positioned {
+        position: relative;
+        top: 30px;
+        left: 30px;
+    }
+</style>
+
+<a href="" Regions] Implement visual overflow computation for inline elements</a>
+<p>The paragraph inside the regions must be fragmented. Each fragment must be relatively positioned based on the fragment position.</p>
+
+<div id="container">
+    <div id="region1"><div class="content"><span class="positioned">AXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX</span></div></div>
+    <div id="region2"><div class="content"><span class="positioned">XXXXX<br/> XXXXB</span></div></div>
+</div>

Added: trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-lr.html (0 => 161626)


--- trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-lr.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-lr.html	2014-01-10 10:38:18 UTC (rev 161626)
@@ -0,0 +1,48 @@
+<!doctype html>
+
+ <style>
+    html {
+        -webkit-writing-mode: vertical-lr;
+    }
+
+    #content {
+        -webkit-flow-into: flow1;
+        width: 200px;
+        font: 16px Ahem;
+        -webkit-font-smoothing: none;
+    }
+    
+    #region1, #region2 {
+        border: 1px solid black;
+        margin: 50px;
+        float: left;
+        -webkit-flow-from: flow1;
+    }
+
+    #region1 {
+        width: 200px;
+        height: 100px;
+    }
+    
+    #region2 {
+        width: 250px;
+        height: 100px;
+    }
+
+    #positioned {
+        position: relative;
+        top: 30px;
+        left: 30px;
+    }
+</style>
+
+<a href="" Regions] Implement visual overflow computation for inline elements</a>
+<p>The paragraph inside the regions must be fragmented. Each fragment must be relatively positioned based on the fragment position.</p>
+
+<div id="content"><span id="positioned">AXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXB</span>
+</div>
+
+<div id="container">
+    <div id="region1"></div>
+    <div id="region2"></div>
+</div>

Added: trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-rl-expected.html (0 => 161626)


--- trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-rl-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-rl-expected.html	2014-01-10 10:38:18 UTC (rev 161626)
@@ -0,0 +1,43 @@
+<!doctype html>
+
+ <style>
+    html {
+        -webkit-writing-mode: vertical-rl;
+    }
+
+    .content {
+        width: 200px;
+        font: 16px Ahem;
+        -webkit-font-smoothing: none;
+    }
+    
+    #region1, #region2 {
+        border: 1px solid black;
+        margin: 50px;
+        float: left;
+    }
+
+    #region1 {
+        width: 200px;
+        height: 100px;
+    }
+    
+    #region2 {
+        width: 250px;
+        height: 100px;
+    }
+
+    .positioned {
+        position: relative;
+        top: 60px;
+        left: 30px;
+    }
+</style>
+
+<a href="" Regions] Implement visual overflow computation for inline elements</a>
+<p>The paragraph inside the regions must be fragmented. Each fragment must be relatively positioned based on the fragment position.</p>
+
+<div id="container">
+    <div id="region1"><div class="content"><span class="positioned">AXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX</span></div></div>
+    <div id="region2"><div class="content"><span class="positioned">XXXXX<br/> XXXXB</span></div></div>
+</div>

Added: trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-rl.html (0 => 161626)


--- trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-rl.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline-rl.html	2014-01-10 10:38:18 UTC (rev 161626)
@@ -0,0 +1,48 @@
+<!doctype html>
+
+ <style>
+    html {
+        -webkit-writing-mode: vertical-rl;
+    }
+
+    #content {
+        -webkit-flow-into: flow1;
+        width: 200px;
+        font: 16px Ahem;
+        -webkit-font-smoothing: none;
+    }
+    
+    #region1, #region2 {
+        border: 1px solid black;
+        margin: 50px;
+        float: left;
+        -webkit-flow-from: flow1;
+    }
+
+    #region1 {
+        width: 200px;
+        height: 100px;
+    }
+    
+    #region2 {
+        width: 250px;
+        height: 100px;
+    }
+
+    #positioned {
+        position: relative;
+        top: 60px;
+        left: 30px;
+    }
+</style>
+
+<a href="" Regions] Implement visual overflow computation for inline elements</a>
+<p>The paragraph inside the regions must be fragmented. Each fragment must be relatively positioned based on the fragment position.</p>
+
+<div id="content"><span id="positioned">AXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXB</span>
+</div>
+
+<div id="container">
+    <div id="region1"></div>
+    <div id="region2"></div>
+</div>

Added: trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline.html (0 => 161626)


--- trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/overflow-in-variable-width-regions-inline.html	2014-01-10 10:38:18 UTC (rev 161626)
@@ -0,0 +1,48 @@
+<!doctype html>
+
+ <style>
+    html {
+        -webkit-writing-mode: horizontal-tb;
+    }
+
+    #content {
+        -webkit-flow-into: flow1;
+        width: 200px;
+        font: 16px Ahem;
+        -webkit-font-smoothing: none;
+    }
+    
+    #region1, #region2 {
+        border: 1px solid black;
+        margin: 50px;
+        float: left;
+        -webkit-flow-from: flow1;
+    }
+
+    #region1 {
+        width: 200px;
+        height: 100px;
+    }
+    
+    #region2 {
+        width: 250px;
+        height: 100px;
+    }
+
+    #positioned {
+        position: relative;
+        top: 30px;
+        left: 30px;
+    }
+</style>
+
+<a href="" Regions] Implement visual overflow computation for inline elements</a>
+<p>The paragraph inside the regions must be fragmented. Each fragment must be relatively positioned based on the fragment position.</p>
+
+<div id="content"><span id="positioned">AXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXX<br/> XXXXB</span>
+</div>
+
+<div id="container">
+    <div id="region1"></div>
+    <div id="region2"></div>
+</div>

Modified: trunk/Source/WebCore/ChangeLog (161625 => 161626)


--- trunk/Source/WebCore/ChangeLog	2014-01-10 09:11:00 UTC (rev 161625)
+++ trunk/Source/WebCore/ChangeLog	2014-01-10 10:38:18 UTC (rev 161626)
@@ -1,3 +1,36 @@
+2014-01-10  Andrei Bucur  <abu...@adobe.com>
+
+        [CSS Regions] Implement visual overflow computation for inline elements
+        https://bugs.webkit.org/show_bug.cgi?id=125291
+
+        Reviewed by David Hyatt.
+
+        The patch implements visual overflow computation for inline elements per region. The algorithm
+        uses the container region of each root line box to determine the lines in a region generated by
+        a RenderInline. The overflow of a RenderInline inside a region is the smallest rectangle that fits
+        all the line boxes belonging to that region.
+
+        The patch also correctly flips for writing mode the overflow of a renderer before clipping with it.
+
+        Tests: fast/regions/overflow-in-variable-width-regions-inline-bt.html
+               fast/regions/overflow-in-variable-width-regions-inline-continuation.html
+               fast/regions/overflow-in-variable-width-regions-inline-lr.html
+               fast/regions/overflow-in-variable-width-regions-inline-rl.html
+               fast/regions/overflow-in-variable-width-regions-inline.html
+
+        * rendering/RenderFlowThread.cpp:
+        (WebCore::RenderFlowThread::objectShouldPaintInFlowRegion):
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::updateAlwaysCreateLineBoxes): Always create line boxes for RenderInline
+        (WebCore::RenderInline::linesVisualOverflowBoundingBoxInRegion):
+        * rendering/RenderInline.h:
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::calculateClipRects):
+        * rendering/RenderRegion.cpp:
+        (WebCore::RenderRegion::visualOverflowRectForBox):
+        (WebCore::RenderRegion::visualOverflowRectForBoxForPropagation):
+        * rendering/RenderRegion.h:
+
 2014-01-09  Jer Noble  <jer.no...@apple.com>
 
         [Mac] .mp3 media document controls missing their background

Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (161625 => 161626)


--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2014-01-10 09:11:00 UTC (rev 161625)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2014-01-10 10:38:18 UTC (rev 161626)
@@ -843,7 +843,7 @@
     if (enclosingBoxStartRegion && enclosingBoxEndRegion && !regionInRange(region, enclosingBoxStartRegion, enclosingBoxEndRegion))
         return false;
     
-    return object->isBox();
+    return object->isBox() || object->isRenderInline();
 }
 
 bool RenderFlowThread::objectInFlowRegion(const RenderObject* object, const RenderRegion* region) const

Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (161625 => 161626)


--- trunk/Source/WebCore/rendering/RenderInline.cpp	2014-01-10 09:11:00 UTC (rev 161625)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp	2014-01-10 10:38:18 UTC (rev 161626)
@@ -217,7 +217,7 @@
         || style().textEmphasisMark() != TextEmphasisMarkNone
         || (checkFonts && (!parentStyle->font().fontMetrics().hasIdenticalAscentDescentAndLineGap(style().font().fontMetrics())
         || parentStyle->lineHeight() != style().lineHeight()))
-        || (flowThread && flowThread->isRenderNamedFlowThread() && toRenderNamedFlowThread(flowThread)->hasRegionsWithStyling());
+        || (flowThread && flowThread->isRenderNamedFlowThread()); // FIXME: Enable the optimization once we make overflow computation for culled inlines in regions.
 
     if (!alwaysCreateLineBoxes && checkFonts && document().styleSheetCollection().usesFirstLineRules()) {
         // Have to check the first line style as well.
@@ -1040,6 +1040,50 @@
     return rect;
 }
 
+LayoutRect RenderInline::linesVisualOverflowBoundingBoxInRegion(const RenderRegion* region) const
+{
+    ASSERT(alwaysCreateLineBoxes());
+    ASSERT(region);
+
+    if (!firstLineBox() || !lastLineBox())
+        return LayoutRect();
+
+    // Return the width of the minimal left side and the maximal right side.
+    LayoutUnit logicalLeftSide = LayoutUnit::max();
+    LayoutUnit logicalRightSide = LayoutUnit::min();
+    LayoutUnit logicalTop;
+    LayoutUnit logicalHeight;
+    InlineFlowBox* lastInlineInRegion = 0;
+    for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
+        const RootInlineBox& root = curr->root();
+        if (root.containingRegion() != region) {
+            if (lastInlineInRegion)
+                break;
+            continue;
+        }
+
+        if (!lastInlineInRegion)
+            logicalTop = curr->logicalTopVisualOverflow(root.lineTop());
+
+        lastInlineInRegion = curr;
+
+        logicalLeftSide = std::min(logicalLeftSide, curr->logicalLeftVisualOverflow());
+        logicalRightSide = std::max(logicalRightSide, curr->logicalRightVisualOverflow());
+    }
+
+    if (!lastInlineInRegion)
+        return LayoutRect();
+
+    logicalHeight = lastInlineInRegion->logicalBottomVisualOverflow(lastInlineInRegion->root().lineBottom()) - logicalTop;
+    
+    LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide;
+    
+    LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight);
+    if (!style().isHorizontalWritingMode())
+        rect = rect.transposedRect();
+    return rect;
+}
+
 LayoutRect RenderInline::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const
 {
     // Only run-ins and first-letter renderers are allowed in here during layout. They mutate the tree triggering repaints.

Modified: trunk/Source/WebCore/rendering/RenderInline.h (161625 => 161626)


--- trunk/Source/WebCore/rendering/RenderInline.h	2014-01-10 09:11:00 UTC (rev 161625)
+++ trunk/Source/WebCore/rendering/RenderInline.h	2014-01-10 10:38:18 UTC (rev 161626)
@@ -54,6 +54,7 @@
 
     IntRect linesBoundingBox() const;
     LayoutRect linesVisualOverflowBoundingBox() const;
+    LayoutRect linesVisualOverflowBoundingBoxInRegion(const RenderRegion*) const;
 
     InlineFlowBox* createAndAppendInlineFlowBox();
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (161625 => 161626)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-01-10 09:11:00 UTC (rev 161625)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-01-10 10:38:18 UTC (rev 161626)
@@ -5499,16 +5499,20 @@
     outlineRect = backgroundRect;
 
     RenderFlowThread* flowThread = clipRectsContext.region ? clipRectsContext.region->flowThread() : 0;
-    if (isSelfPaintingLayer() && flowThread && !renderer().isInFlowRenderFlowThread() && renderBox()) {
-        // FIXME: Handle the case where the renderer is not a RenderBox.
-        LayoutRect layerBoundsWithVisualOverflow = clipRectsContext.region->visualOverflowRectForBox(renderBox());
+    if (isSelfPaintingLayer() && flowThread && !renderer().isInFlowRenderFlowThread()) {
+        const RenderBoxModelObject& boxModelObject = toRenderBoxModelObject(renderer());
+        LayoutRect layerBoundsWithVisualOverflow = clipRectsContext.region->visualOverflowRectForBox(&boxModelObject);
 
         // Layers are in physical coordinates so the origin must be moved to the physical top-left of the flowthread.
-        if (flowThread->style().isFlippedBlocksWritingMode()) {
+        if (&boxModelObject == flowThread && flowThread->style().isFlippedBlocksWritingMode()) {
             if (flowThread->style().isHorizontalWritingMode())
                 layerBoundsWithVisualOverflow.moveBy(LayoutPoint(0, flowThread->height()));
             else
                 layerBoundsWithVisualOverflow.moveBy(LayoutPoint(flowThread->width(), 0));
+        } else {
+            RenderBlock* rendererContainingBlock = boxModelObject.enclosingBox()->isRenderBlock() ? toRenderBlock(boxModelObject.enclosingBox()) : 0;
+            if (rendererContainingBlock)
+                rendererContainingBlock->flipForWritingMode(layerBoundsWithVisualOverflow);
         }
 
         layerBoundsWithVisualOverflow.moveBy(offset);
@@ -5660,9 +5664,9 @@
     // cause the paint rejection algorithm to prevent them from painting when using different width regions.
     // e.g. an absolutely positioned box with bottom:0px and right:0px would have it's frameRect.x relative
     // to the flow thread, not the last region (in which it will end up because of bottom:0px)
-    if (region && renderer().isBox() && renderer().flowThreadContainingBlock()) {
+    if (region && renderer().flowThreadContainingBlock()) {
         LayoutRect b = layerBounds;
-        b.moveBy(region->visualOverflowRectForBox(toRenderBox(&renderer())).location());
+        b.moveBy(region->visualOverflowRectForBox(toRenderBoxModelObject(&renderer())).location());
         b.inflate(renderer().view().maximalOutlineSize());
         if (b.intersects(damageRect))
             return true;

Modified: trunk/Source/WebCore/rendering/RenderRegion.cpp (161625 => 161626)


--- trunk/Source/WebCore/rendering/RenderRegion.cpp	2014-01-10 09:11:00 UTC (rev 161625)
+++ trunk/Source/WebCore/rendering/RenderRegion.cpp	2014-01-10 10:38:18 UTC (rev 161626)
@@ -38,6 +38,7 @@
 #include "PaintInfo.h"
 #include "Range.h"
 #include "RenderBoxRegionInfo.h"
+#include "RenderInline.h"
 #include "RenderIterator.h"
 #include "RenderLayer.h"
 #include "RenderNamedFlowFragment.h"
@@ -560,13 +561,23 @@
     return overflow->layoutOverflowRect();
 }
 
-LayoutRect RenderRegion::visualOverflowRectForBox(const RenderBox* box)
+LayoutRect RenderRegion::visualOverflowRectForBox(const RenderBoxModelObject* box)
 {
-    RefPtr<RenderOverflow> overflow;
-    ensureOverflowForBox(box, overflow, true);
-    
-    ASSERT(overflow);
-    return overflow->visualOverflowRect();
+    if (box->isRenderInline()) {
+        const RenderInline* inlineBox = toRenderInline(box);
+        return inlineBox->linesVisualOverflowBoundingBoxInRegion(this);
+    }
+
+    if (box->isBox()) {
+        RefPtr<RenderOverflow> overflow;
+        ensureOverflowForBox(toRenderBox(box), overflow, true);
+
+        ASSERT(overflow);
+        return overflow->visualOverflowRect();
+    }
+
+    ASSERT_NOT_REACHED();
+    return LayoutRect();
 }
 
 // FIXME: This doesn't work for writing modes.
@@ -590,7 +601,7 @@
     return rect;
 }
 
-LayoutRect RenderRegion::visualOverflowRectForBoxForPropagation(const RenderBox* box)
+LayoutRect RenderRegion::visualOverflowRectForBoxForPropagation(const RenderBoxModelObject* box)
 {
     LayoutRect rect = visualOverflowRectForBox(box);
     flowThread()->flipForWritingModeLocalCoordinates(rect);

Modified: trunk/Source/WebCore/rendering/RenderRegion.h (161625 => 161626)


--- trunk/Source/WebCore/rendering/RenderRegion.h	2014-01-10 09:11:00 UTC (rev 161625)
+++ trunk/Source/WebCore/rendering/RenderRegion.h	2014-01-10 10:38:18 UTC (rev 161626)
@@ -120,9 +120,9 @@
     void addLayoutOverflowForBox(const RenderBox*, const LayoutRect&);
     void addVisualOverflowForBox(const RenderBox*, const LayoutRect&);
     LayoutRect layoutOverflowRectForBox(const RenderBox*);
-    LayoutRect visualOverflowRectForBox(const RenderBox*);
+    LayoutRect visualOverflowRectForBox(const RenderBoxModelObject*);
     LayoutRect layoutOverflowRectForBoxForPropagation(const RenderBox*);
-    LayoutRect visualOverflowRectForBoxForPropagation(const RenderBox*);
+    LayoutRect visualOverflowRectForBoxForPropagation(const RenderBoxModelObject*);
 
     LayoutRect rectFlowPortionForBox(const RenderBox*, const LayoutRect&) const;
     
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to