Title: [136793] trunk
Revision
136793
Author
[email protected]
Date
2012-12-05 19:47:00 -0800 (Wed, 05 Dec 2012)

Log Message

[CSS Regions] Blocks don't relayout children if the width of a region changes
https://bugs.webkit.org/show_bug.cgi?id=103993

Patch by Andrei Bucur <[email protected]> on 2012-12-05
Reviewed by David Hyatt.

Source/WebCore:

After r135750 lines are no longer invalidating when regions change width. This is happening because the detection for the width change was being done
only at line layout time. This patch moves the line relayout decision to the containing block by setting the relayoutChildren flag if the block
has no region chain attached.

Tests: fast/regions/region-width-change-relayout-1.html
       fast/regions/region-width-change-relayout-2.html
       fast/regions/region-width-change-relayout-3.html

* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::logicalWidthChangedInRegions):

LayoutTests:

The first test covers the case of reducing the width of a region for a block content node.
The second test covers the case of expanding the width of a region for a block content node.
The third test covers the case of reducing the width of a region for an inline content node.

* fast/regions/region-width-change-relayout-1-expected.html: Added.
* fast/regions/region-width-change-relayout-1.html: Added.
* fast/regions/region-width-change-relayout-2-expected.html: Added.
* fast/regions/region-width-change-relayout-2.html: Added.
* fast/regions/region-width-change-relayout-3-expected.html: Added.
* fast/regions/region-width-change-relayout-3.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (136792 => 136793)


--- trunk/LayoutTests/ChangeLog	2012-12-06 03:44:08 UTC (rev 136792)
+++ trunk/LayoutTests/ChangeLog	2012-12-06 03:47:00 UTC (rev 136793)
@@ -1,3 +1,21 @@
+2012-12-05  Andrei Bucur  <[email protected]>
+
+        [CSS Regions] Blocks don't relayout children if the width of a region changes
+        https://bugs.webkit.org/show_bug.cgi?id=103993
+
+        Reviewed by David Hyatt.
+
+        The first test covers the case of reducing the width of a region for a block content node.
+        The second test covers the case of expanding the width of a region for a block content node.
+        The third test covers the case of reducing the width of a region for an inline content node.
+
+        * fast/regions/region-width-change-relayout-1-expected.html: Added.
+        * fast/regions/region-width-change-relayout-1.html: Added.
+        * fast/regions/region-width-change-relayout-2-expected.html: Added.
+        * fast/regions/region-width-change-relayout-2.html: Added.
+        * fast/regions/region-width-change-relayout-3-expected.html: Added.
+        * fast/regions/region-width-change-relayout-3.html: Added.
+
 2012-12-05  KyungTae Kim  <[email protected]>
 
         [WK2][EFL] Gardening. Rebase fast/block/basic/020.html

Added: trunk/LayoutTests/fast/regions/region-width-change-relayout-1-expected.html (0 => 136793)


--- trunk/LayoutTests/fast/regions/region-width-change-relayout-1-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/region-width-change-relayout-1-expected.html	2012-12-06 03:47:00 UTC (rev 136793)
@@ -0,0 +1,21 @@
+<!doctype html>
+<html>
+    <head>
+        <style>
+            .flowContent { font-size: 50px; font-family: monospace; line-height: 2; color: green; }
+
+            .regionSize { width: 200px; }
+            .regionSize2 { width: 100px; }
+
+            #region { height: 100px; border: 1px solid black;}
+            #region2 { height: 100px; border: 1px solid black;}
+        </style>
+    </head>
+    <body>
+        <p>Test for <a href="" Blocks don't relayout children if the width of a region changes</a>.</p>
+        <p>When the width of a region decreases the lines in that region should be recomputed.</p>
+        <p>On success, there should be no text outside the black rectangles and both regions should have text in them.</p>
+        <div id="region" class="regionSize2"><span class="flowContent">a a</span></div>
+        <div id="region2" class="regionSize"><span class="flowContent">a a a</span></div>
+    </body>
+</html>

Added: trunk/LayoutTests/fast/regions/region-width-change-relayout-1.html (0 => 136793)


--- trunk/LayoutTests/fast/regions/region-width-change-relayout-1.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/region-width-change-relayout-1.html	2012-12-06 03:47:00 UTC (rev 136793)
@@ -0,0 +1,31 @@
+<!doctype html>
+<html>
+    <head>
+        <style>
+            .flowContent { font-size: 50px; font-family: monospace; line-height: 2; color: green; }
+            #article { -webkit-flow-into: flow; }
+
+            .regionSize { width: 200px; }
+            .regionSize2 { width: 100px; }
+
+            #region { -webkit-flow-from: flow; height: 100px; border: 1px solid black;}
+            #region2 { -webkit-flow-from: flow; height: 100px; border: 1px solid black;}
+        </style>
+    </head>
+    <body>
+        <p>Test for <a href="" Blocks don't relayout children if the width of a region changes</a>.</p>
+        <p>When the width of a region decreases the lines in that region should be recomputed.</p>
+        <p>On success, there should be no text outside the black rectangles and both regions should have text in them.</p>
+        <div class="flowContent" id="article">
+            <span>
+                a a a a a
+            </span>
+        </div>
+        <div id="region" class="regionSize"></div>
+        <div id="region2" class="regionSize"></div>
+        <script>
+            document.body.offsetTop; //force layout
+            document.getElementById("region").className = "regionSize2";
+        </script>
+    </body>
+</html>

Added: trunk/LayoutTests/fast/regions/region-width-change-relayout-2-expected.html (0 => 136793)


--- trunk/LayoutTests/fast/regions/region-width-change-relayout-2-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/region-width-change-relayout-2-expected.html	2012-12-06 03:47:00 UTC (rev 136793)
@@ -0,0 +1,21 @@
+<!doctype html>
+<html>
+    <head>
+        <style>
+            .flowContent { font-size: 50px; font-family: monospace; line-height: 2; color: green; }
+
+            .regionSize { width: 200px; }
+            .regionSize2 { width: 400px; }
+
+            #region { height: 100px; border: 1px solid black;}
+            #region2 { height: 100px; border: 1px solid black;}
+        </style>
+    </head>
+    <body>
+        <p>Test for <a href="" Blocks don't relayout children if the width of a region changes</a>.</p>
+        <p>When the width of a region increases the lines in that region should be recomputed.</p>
+        <p>On success, there should be no text outside the black rectangles and text only inside the top region.</p>
+        <div id="region" class="regionSize2"><span class="flowContent">a a a a a</span></div>
+        <div id="region2" class="regionSize"><span class="flowContent"></span></div>
+    </body>
+</html>

Added: trunk/LayoutTests/fast/regions/region-width-change-relayout-2.html (0 => 136793)


--- trunk/LayoutTests/fast/regions/region-width-change-relayout-2.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/region-width-change-relayout-2.html	2012-12-06 03:47:00 UTC (rev 136793)
@@ -0,0 +1,31 @@
+<!doctype html>
+<html>
+    <head>
+        <style>
+            .flowContent { font-size: 50px; font-family: monospace; line-height: 2; color: green; }
+            #article { -webkit-flow-into: flow; }
+
+            .regionSize { width: 200px; }
+            .regionSize2 { width: 400px; }
+
+            #region { -webkit-flow-from: flow; height: 100px; border: 1px solid black;}
+            #region2 { -webkit-flow-from: flow; height: 100px; border: 1px solid black;}
+        </style>
+    </head>
+    <body>
+        <p>Test for <a href="" Blocks don't relayout children if the width of a region changes</a>.</p>
+        <p>When the width of a region increases the lines in that region should be recomputed.</p>
+        <p>On success, there should be no text outside the black rectangles and text only inside the top region.</p>
+        <div class="flowContent" id="article">
+            <span>
+                a a a a a
+            </span>
+        </div>
+        <div id="region" class="regionSize"></div>
+        <div id="region2" class="regionSize"></div>
+        <script>
+            document.body.offsetTop; //force layout
+            document.getElementById("region").className = "regionSize2";
+        </script>
+    </body>
+</html>

Added: trunk/LayoutTests/fast/regions/region-width-change-relayout-3-expected.html (0 => 136793)


--- trunk/LayoutTests/fast/regions/region-width-change-relayout-3-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/region-width-change-relayout-3-expected.html	2012-12-06 03:47:00 UTC (rev 136793)
@@ -0,0 +1,21 @@
+<!doctype html>
+<html>
+    <head>
+        <style>
+            .flowContent { font-size: 50px; font-family: monospace; line-height: 2; color: green; }
+
+            .regionSize { width: 200px; }
+            .regionSize2 { width: 100px; }
+
+            #region { height: 100px; border: 1px solid black;}
+            #region2 { height: 100px; border: 1px solid black;}
+        </style>
+    </head>
+    <body>
+        <p>Test for <a href="" Blocks don't relayout children if the width of a region changes</a>.</p>
+        <p>When the width of a region decreases the lines in that region should be recomputed. This test covers the special case of having inlines flow directly in the thread.</p>
+        <p>On success, there should be no text outside the black rectangles and both regions should have text in them.</p>
+        <div id="region" class="regionSize2"><span class="flowContent">a a</span></div>
+        <div id="region2" class="regionSize"><span class="flowContent">a a a</span></div>
+    </body>
+</html>

Added: trunk/LayoutTests/fast/regions/region-width-change-relayout-3.html (0 => 136793)


--- trunk/LayoutTests/fast/regions/region-width-change-relayout-3.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/region-width-change-relayout-3.html	2012-12-06 03:47:00 UTC (rev 136793)
@@ -0,0 +1,31 @@
+<!doctype html>
+<html>
+    <head>
+        <style>
+            .flowContent { font-size: 50px; font-family: monospace; line-height: 2; color: green; }
+            #article { -webkit-flow-into: flow; }
+
+            .regionSize { width: 200px; }
+            .regionSize2 { width: 100px; }
+
+            #region { -webkit-flow-from: flow; height: 100px; border: 1px solid black;}
+            #region2 { -webkit-flow-from: flow; height: 100px; border: 1px solid black;}
+        </style>
+    </head>
+    <body>
+        <p>Test for <a href="" Blocks don't relayout children if the width of a region changes</a>.</p>
+        <p>When the width of a region decreases the lines in that region should be recomputed. This test covers the special case of having inlines flow directly in the thread.</p>
+        <p>On success, there should be no text outside the black rectangles and both regions should have text in them.</p>
+        <div class="flowContent">
+            <span id="article">
+                a a a a a
+            </span>
+        </div>
+        <div id="region" class="regionSize"></div>
+        <div id="region2" class="regionSize"></div>
+        <script>
+            document.body.offsetTop; //force layout
+            document.getElementById("region").className = "regionSize2";
+        </script>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (136792 => 136793)


--- trunk/Source/WebCore/ChangeLog	2012-12-06 03:44:08 UTC (rev 136792)
+++ trunk/Source/WebCore/ChangeLog	2012-12-06 03:47:00 UTC (rev 136793)
@@ -1,3 +1,21 @@
+2012-12-05  Andrei Bucur  <[email protected]>
+
+        [CSS Regions] Blocks don't relayout children if the width of a region changes
+        https://bugs.webkit.org/show_bug.cgi?id=103993
+
+        Reviewed by David Hyatt.
+
+        After r135750 lines are no longer invalidating when regions change width. This is happening because the detection for the width change was being done
+        only at line layout time. This patch moves the line relayout decision to the containing block by setting the relayoutChildren flag if the block
+        has no region chain attached.
+
+        Tests: fast/regions/region-width-change-relayout-1.html
+               fast/regions/region-width-change-relayout-2.html
+               fast/regions/region-width-change-relayout-3.html
+
+        * rendering/RenderFlowThread.cpp:
+        (WebCore::RenderFlowThread::logicalWidthChangedInRegions):
+
 2012-12-05  Kihong Kwon  <[email protected]>
 
         Parameter event need to covert to RefPtr in the DeviceController::dispatchDeviceEvent

Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (136792 => 136793)


--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2012-12-06 03:44:08 UTC (rev 136792)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2012-12-06 03:47:00 UTC (rev 136793)
@@ -462,6 +462,10 @@
     RenderRegion* endRegion;
     getRegionRangeForBox(block, startRegion, endRegion);
 
+    // If the block doesn't have a startRegion (and implicitly a region range) it's safe to assume the width in regions has changed (e.g. the region chain was invalidated).
+    if (!startRegion)
+        return true;
+
     for (RenderRegionList::iterator iter = m_regionList.find(startRegion); iter != m_regionList.end(); ++iter) {
         RenderRegion* region = *iter;
         ASSERT(!region->needsLayout());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to