Title: [167541] trunk
Revision
167541
Author
[email protected]
Date
2014-04-19 11:57:46 -0700 (Sat, 19 Apr 2014)

Log Message

[CSS Regions] Harden the layout in case there are no regions
https://bugs.webkit.org/show_bug.cgi?id=131517

Patch by Andrei Bucur <[email protected]> on 2014-04-19
Reviewed by Mihnea Ovidenie.

Source/WebCore:
The patch fixes the cases when the content of a flow thread is not
properly invalidated when all the regions of its chain are removed.

Test: fast/regions/simplified-layout-no-regions.html

* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::logicalWidthChangedInRegionsForBlock):
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::ensureOverflowForBox):

LayoutTests:
Add a test that verifies the content of a flow thread is updated when all
the regions are removed.

* fast/regions/simplified-layout-no-regions-expected.txt: Added.
* fast/regions/simplified-layout-no-regions.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (167540 => 167541)


--- trunk/LayoutTests/ChangeLog	2014-04-19 18:36:56 UTC (rev 167540)
+++ trunk/LayoutTests/ChangeLog	2014-04-19 18:57:46 UTC (rev 167541)
@@ -1,3 +1,16 @@
+2014-04-19  Andrei Bucur  <[email protected]>
+
+        [CSS Regions] Harden the layout in case there are no regions
+        https://bugs.webkit.org/show_bug.cgi?id=131517
+
+        Reviewed by Mihnea Ovidenie.
+
+        Add a test that verifies the content of a flow thread is updated when all
+        the regions are removed.
+
+        * fast/regions/simplified-layout-no-regions-expected.txt: Added.
+        * fast/regions/simplified-layout-no-regions.html: Added.
+
 2014-04-19  Darin Adler  <[email protected]>
 
         Cleared executable bits on many .html and .txt files.

Added: trunk/LayoutTests/fast/regions/simplified-layout-no-regions-expected.txt (0 => 167541)


--- trunk/LayoutTests/fast/regions/simplified-layout-no-regions-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/simplified-layout-no-regions-expected.txt	2014-04-19 18:57:46 UTC (rev 167541)
@@ -0,0 +1,5 @@
+The test passes if there is no crash or assert.
+
+PASS
+
+
Property changes on: trunk/LayoutTests/fast/regions/simplified-layout-no-regions-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/regions/simplified-layout-no-regions.html (0 => 167541)


--- trunk/LayoutTests/fast/regions/simplified-layout-no-regions.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/simplified-layout-no-regions.html	2014-04-19 18:57:46 UTC (rev 167541)
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <style>
+            body.hidden ol { visibility: hidden; }
+            ol > li { position: relative; }
+            li::after { position: absolute; }
+            ol.chapter > li { counter-increment: chapter; }
+            ol.section > li::after { content: counter(chapter); }
+
+            .extract { -webkit-flow-into: f1; }
+            #region { -webkit-flow-from: f1; }
+        </style>
+    </head>
+    <body>
+        <p>The test passes if there is no crash or assert.</p>
+        <p>PASS</p>
+        <ol id="start" class="chapter">
+            <li>
+                <ol class="section extract">
+                    <li>I</li>
+                </ol>
+            </li>
+        </ol>
+        <ol class="section">
+            <li id="second">II</li>
+            <li id="third">III</li>
+        </ol>
+        <div id="region"></div>
+        <div id="end"></div>
+        <script>
+            if (window.testRunner)
+                window.testRunner.dumpAsText();
+
+            document.body.offsetParent;
+            var range = document.createRange();
+            range.setStart(document.getElementById("start"));
+            range.setEnd(document.getElementById("start"));
+            range.surroundContents(document.getElementById("third"));
+            range.setStart(document.getElementById("second"), 1);
+            range.setEnd(document.getElementById("end"));
+            range.deleteContents();
+            document.body.offsetParent;
+
+            if (window.testRunner)
+                document.body.className = "hidden";
+        </script>
+    </body>
+</html>
+
Property changes on: trunk/LayoutTests/fast/regions/simplified-layout-no-regions.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (167540 => 167541)


--- trunk/Source/WebCore/ChangeLog	2014-04-19 18:36:56 UTC (rev 167540)
+++ trunk/Source/WebCore/ChangeLog	2014-04-19 18:57:46 UTC (rev 167541)
@@ -1,3 +1,20 @@
+2014-04-19  Andrei Bucur  <[email protected]>
+
+        [CSS Regions] Harden the layout in case there are no regions
+        https://bugs.webkit.org/show_bug.cgi?id=131517
+
+        Reviewed by Mihnea Ovidenie.
+
+        The patch fixes the cases when the content of a flow thread is not
+        properly invalidated when all the regions of its chain are removed.
+
+        Test: fast/regions/simplified-layout-no-regions.html
+
+        * rendering/RenderFlowThread.cpp:
+        (WebCore::RenderFlowThread::logicalWidthChangedInRegionsForBlock):
+        * rendering/RenderRegion.cpp:
+        (WebCore::RenderRegion::ensureOverflowForBox):
+
 2014-04-19  Zalan Bujtas  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=131594

Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (167540 => 167541)


--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2014-04-19 18:36:56 UTC (rev 167540)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2014-04-19 18:57:46 UTC (rev 167541)
@@ -590,8 +590,13 @@
 
 void RenderFlowThread::logicalWidthChangedInRegionsForBlock(const RenderBlock* block, bool& relayoutChildren)
 {
-    if (!hasValidRegionInfo())
+    if (!hasValidRegionInfo()) {
+        // FIXME: Remove once we stop laying out flow threads without regions.
+        // If we had regions but don't any more, relayout the children because the code below
+        // can't properly detect this scenario.
+        relayoutChildren |= previousRegionCountChanged();
         return;
+    }
 
     auto it = m_regionRangeMap.find(block);
     if (it == m_regionRangeMap.end())

Modified: trunk/Source/WebCore/rendering/RenderRegion.cpp (167540 => 167541)


--- trunk/Source/WebCore/rendering/RenderRegion.cpp	2014-04-19 18:36:56 UTC (rev 167540)
+++ trunk/Source/WebCore/rendering/RenderRegion.cpp	2014-04-19 18:57:46 UTC (rev 167541)
@@ -430,6 +430,7 @@
 
 void RenderRegion::ensureOverflowForBox(const RenderBox* box, RefPtr<RenderOverflow>& overflow, bool forceCreation)
 {
+    ASSERT(m_flowThread->renderRegionList().contains(this));
     ASSERT(isValid());
 
     RenderBoxRegionInfo* boxInfo = renderBoxRegionInfo(box);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to