Title: [144178] trunk
Revision
144178
Author
[email protected]
Date
2013-02-27 06:50:21 -0800 (Wed, 27 Feb 2013)

Log Message

[CSS Regions] Region overset property is not properly computed when there is a region break
https://bugs.webkit.org/show_bug.cgi?id=92497

Patch by Mihai Maerean <[email protected]> on 2013-02-27
Reviewed by David Hyatt.

Source/WebCore:

For "paginated" content in regions that has -webkit-region-break-after:always, the bottom margin was being passed
along for the next region in the chain, which shouldn't happen.

The fix is, at layout, to clear the bottom margin for the nodes (inside paginated contexts) that have
-webkit-region-break-after:always.

Tests: fast/multicol/break-after-always-bottom-margin.html
       fast/regions/overset-break-nested.html
       fast/regions/overset-break-with-sibling.html
       fast/regions/overset-break.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::applyAfterBreak):

LayoutTests:

* fast/multicol/break-after-always-bottom-margin-expected.txt: Added.
* fast/multicol/break-after-always-bottom-margin.html: Added.
* fast/regions/overset-break-expected.txt: Added.
* fast/regions/overset-break-nested-expected.txt: Added.
* fast/regions/overset-break-nested.html: Added.
* fast/regions/overset-break-with-sibling-expected.txt: Added.
* fast/regions/overset-break-with-sibling.html: Added.
* fast/regions/overset-break.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (144177 => 144178)


--- trunk/LayoutTests/ChangeLog	2013-02-27 14:47:41 UTC (rev 144177)
+++ trunk/LayoutTests/ChangeLog	2013-02-27 14:50:21 UTC (rev 144178)
@@ -1,3 +1,19 @@
+2013-02-27  Mihai Maerean  <[email protected]>
+
+        [CSS Regions] Region overset property is not properly computed when there is a region break
+        https://bugs.webkit.org/show_bug.cgi?id=92497
+
+        Reviewed by David Hyatt.
+
+        * fast/multicol/break-after-always-bottom-margin-expected.txt: Added.
+        * fast/multicol/break-after-always-bottom-margin.html: Added.
+        * fast/regions/overset-break-expected.txt: Added.
+        * fast/regions/overset-break-nested-expected.txt: Added.
+        * fast/regions/overset-break-nested.html: Added.
+        * fast/regions/overset-break-with-sibling-expected.txt: Added.
+        * fast/regions/overset-break-with-sibling.html: Added.
+        * fast/regions/overset-break.html: Added.
+
 2013-02-27  Vsevolod Vlasov  <[email protected]>
 
         Unreviewed chromium test expectations update.

Added: trunk/LayoutTests/fast/multicol/break-after-always-bottom-margin-expected.txt (0 => 144178)


--- trunk/LayoutTests/fast/multicol/break-after-always-bottom-margin-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/break-after-always-bottom-margin-expected.txt	2013-02-27 14:50:21 UTC (rev 144178)
@@ -0,0 +1,6 @@
+This is some text with bottom margin and forced break after.
+
+This paragraph should be aligned with the other paragraph because the 1st paragraph's bottom margin shouldn't spill over the forced break.
+
+PASS
+Bug 92497 - [CSS Regions] Region overset property is not properly computed when there is a region break

Added: trunk/LayoutTests/fast/multicol/break-after-always-bottom-margin.html (0 => 144178)


--- trunk/LayoutTests/fast/multicol/break-after-always-bottom-margin.html	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/break-after-always-bottom-margin.html	2013-02-27 14:50:21 UTC (rev 144178)
@@ -0,0 +1,39 @@
+<!doctype html>
+<html>
+    <head>
+        <title>Bug 92497 - [CSS Regions] Region overset property is not properly computed when there is a region break</title>
+        <style type="text/css">
+
+            .columns {
+                -webkit-column-count:2;
+                width:250px;
+            }
+
+            .columns p:first-child {
+                -webkit-column-break-after: always;
+                margin-bottom: 10em; /*shouldn't spill over the forced break*/
+            }
+
+            .fail #pass, .pass #fail { display: none; }
+        </style>
+    </head>
+
+    <body>
+        <div class="columns">
+            <p>This is some text with bottom margin and forced break after.</p>
+            <p>This paragraph should be aligned with the other paragraph because the 1st paragraph's bottom margin shouldn't spill over the forced break.</p>
+        </div>
+
+        <script type="text/_javascript_">
+            if(window.testRunner)
+                testRunner.dumpAsText();
+            document.body.className = document.querySelector(".columns p:nth-child(2)").offsetTop == document.querySelector(".columns p:first-child").offsetTop ? "pass" : "fail";
+        </script>
+
+        <div id="pass">PASS</div>
+        <div id="fail">FAIL</div>
+
+        <p><a href="" 92497</a> - [CSS Regions] Region overset property is not properly computed when there is a region break</p>
+
+    </body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/regions/overset-break-expected.txt (0 => 144178)


--- trunk/LayoutTests/fast/regions/overset-break-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/overset-break-expected.txt	2013-02-27 14:50:21 UTC (rev 144178)
@@ -0,0 +1,7 @@
+content with break-after: always;
+
+fit vs fit
+empty vs empty
+empty vs empty
+PASS
+Bug 92497 - [CSS Regions] Region overset property is not properly computed when there is a region break

Added: trunk/LayoutTests/fast/regions/overset-break-nested-expected.txt (0 => 144178)


--- trunk/LayoutTests/fast/regions/overset-break-nested-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/overset-break-nested-expected.txt	2013-02-27 14:50:21 UTC (rev 144178)
@@ -0,0 +1,7 @@
+content with break-after: always;
+
+fit vs fit
+empty vs empty
+empty vs empty
+PASS
+Bug 92497 - [CSS Regions] Region overset property is not properly computed when there is a region break

Added: trunk/LayoutTests/fast/regions/overset-break-nested.html (0 => 144178)


--- trunk/LayoutTests/fast/regions/overset-break-nested.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/overset-break-nested.html	2013-02-27 14:50:21 UTC (rev 144178)
@@ -0,0 +1,53 @@
+
+<html>
+    <head>
+        <title>Bug 92497 - [CSS Regions] Region overset property is not properly computed when there is a region break</title>
+        <style type="text/css">
+            .content {
+                -webkit-flow-into: flow;
+                background-color: #ddd;
+            }
+
+            .content p:first-child {
+                -webkit-region-break-after: always;
+                margin-bottom: 4em; /*shouldn't spill over the forced break*/
+            }
+
+            .container {
+                -webkit-flow-from: flow;
+                width:250px;
+                height:120px;
+                border: 1px solid #444;
+                margin-top: 1em;
+            }
+
+            .fail #pass, .pass #fail { display: none; }
+        </style>
+    </head>
+
+    <body>
+        <div class="content"><div><div><p>content with break-after: always;</p></div></div></div>
+
+        <div class="container" id="r1"></div> <div id="overset1">explanation goes here</div>
+        <div class="container" id="r2"></div> <div id="overset2">explanation goes here</div>
+        <div class="container" id="r3"></div> <div id="overset3">explanation goes here</div>
+
+        <script type="text/_javascript_">
+            if(window.testRunner)
+                testRunner.dumpAsText();
+            var r1 = document.getElementById("r1").webkitRegionOverset;
+            document.getElementById("overset1").innerHTML = r1 + " vs fit";
+            var r2 = document.getElementById("r2").webkitRegionOverset;
+            document.getElementById("overset2").innerHTML = r2 + " vs empty";
+            var r3 = document.getElementById("r3").webkitRegionOverset;
+            document.getElementById("overset3").innerHTML = r3 + " vs empty";
+            document.body.className = (r1 == "fit" && r2 == "empty" && r3 == "empty") ? "pass" : "fail";
+        </script>
+
+        <div id="pass">PASS</div>
+        <div id="fail">FAIL</div>
+
+        <p><a href="" 92497</a> - [CSS Regions] Region overset property is not properly computed when there is a region break</p>
+
+    </body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/regions/overset-break-with-sibling-expected.txt (0 => 144178)


--- trunk/LayoutTests/fast/regions/overset-break-with-sibling-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/overset-break-with-sibling-expected.txt	2013-02-27 14:50:21 UTC (rev 144178)
@@ -0,0 +1,9 @@
+content with break-after: always;
+
+2nd p
+
+fit vs fit
+fit vs fit
+empty vs empty
+PASS
+Bug 92497 - [CSS Regions] Region overset property is not properly computed when there is a region break

Added: trunk/LayoutTests/fast/regions/overset-break-with-sibling.html (0 => 144178)


--- trunk/LayoutTests/fast/regions/overset-break-with-sibling.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/overset-break-with-sibling.html	2013-02-27 14:50:21 UTC (rev 144178)
@@ -0,0 +1,52 @@
+<!doctype html>
+<html>
+    <head>
+        <title>Bug 92497 - [CSS Regions] Region overset property is not properly computed when there is a region break</title>
+        <style type="text/css">
+            .content {
+                -webkit-flow-into: flow;
+                background-color: #ddd;
+            }
+
+            .content p {
+                -webkit-region-break-after: always;
+                margin-bottom: 4em; /*shouldn't spill over the forced break*/
+            }
+
+            .container {
+                -webkit-flow-from: flow;
+                width:250px;
+                height:120px;
+                border: 1px solid #444;
+                margin-top: 1em;
+            }
+
+            .fail #pass, .pass #fail { display: none; }
+        </style>
+    </head>
+    <body>
+        <div class="content"><p>content with break-after: always;</p><p>2nd p</p></div>
+
+        <div class="container" id="r1"></div> <div id="overset1">explanation goes here</div>
+        <div class="container" id="r2"></div> <div id="overset2">explanation goes here</div>
+        <div class="container" id="r3"></div> <div id="overset3">explanation goes here</div>
+
+        <script type="text/_javascript_">
+            if(window.testRunner)
+                testRunner.dumpAsText();
+            var r1 = document.getElementById("r1").webkitRegionOverset;
+            document.getElementById("overset1").innerHTML = r1 + " vs fit";
+            var r2 = document.getElementById("r2").webkitRegionOverset;
+            document.getElementById("overset2").innerHTML = r2 + " vs fit";
+            var r3 = document.getElementById("r3").webkitRegionOverset;
+            document.getElementById("overset3").innerHTML = r3 + " vs empty";
+            document.body.className = (r1 == "fit" && r2 == "fit" && r3 == "empty") ? "pass" : "fail";
+        </script>
+
+        <div id="pass">PASS</div>
+        <div id="fail">FAIL</div>
+
+        <p><a href="" 92497</a> - [CSS Regions] Region overset property is not properly computed when there is a region break</p>
+
+    </body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/regions/overset-break.html (0 => 144178)


--- trunk/LayoutTests/fast/regions/overset-break.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/overset-break.html	2013-02-27 14:50:21 UTC (rev 144178)
@@ -0,0 +1,53 @@
+<!doctype html>
+<html>
+    <head>
+        <title>Bug 92497 - [CSS Regions] Region overset property is not properly computed when there is a region break</title>
+        <style type="text/css">
+            .content {
+                -webkit-flow-into: flow;
+                background-color: #ddd;
+            }
+
+            .content p:first-child {
+                -webkit-region-break-after: always;
+                margin-bottom: 4em; /*shouldn't spill over the forced break*/
+            }
+
+            .container {
+                -webkit-flow-from: flow;
+                width:250px;
+                height:120px;
+                border: 1px solid #444;
+                margin-top: 1em;
+            }
+
+            .fail #pass, .pass #fail { display: none; }
+        </style>
+    </head>
+
+    <body>
+        <div class="content"><p>content with break-after: always;</p></div>
+
+        <div class="container" id="r1"></div> <div id="overset1">explanation goes here</div>
+        <div class="container" id="r2"></div> <div id="overset2">explanation goes here</div>
+        <div class="container" id="r3"></div> <div id="overset3">explanation goes here</div>
+
+        <script type="text/_javascript_">
+            if(window.testRunner)
+                testRunner.dumpAsText();
+            var r1 = document.getElementById("r1").webkitRegionOverset;
+            document.getElementById("overset1").innerHTML = r1 + " vs fit";
+            var r2 = document.getElementById("r2").webkitRegionOverset;
+            document.getElementById("overset2").innerHTML = r2 + " vs empty";
+            var r3 = document.getElementById("r3").webkitRegionOverset;
+            document.getElementById("overset3").innerHTML = r3 + " vs empty";
+            document.body.className = (r1 == "fit" && r2 == "empty" && r3 == "empty") ? "pass" : "fail";
+        </script>
+
+        <div id="pass">PASS</div>
+        <div id="fail">FAIL</div>
+
+        <p><a href="" 92497</a> - [CSS Regions] Region overset property is not properly computed when there is a region break</p>
+
+    </body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (144177 => 144178)


--- trunk/Source/WebCore/ChangeLog	2013-02-27 14:47:41 UTC (rev 144177)
+++ trunk/Source/WebCore/ChangeLog	2013-02-27 14:50:21 UTC (rev 144178)
@@ -1,3 +1,24 @@
+2013-02-27  Mihai Maerean  <[email protected]>
+
+        [CSS Regions] Region overset property is not properly computed when there is a region break
+        https://bugs.webkit.org/show_bug.cgi?id=92497
+
+        Reviewed by David Hyatt.
+
+        For "paginated" content in regions that has -webkit-region-break-after:always, the bottom margin was being passed
+        along for the next region in the chain, which shouldn't happen.
+
+        The fix is, at layout, to clear the bottom margin for the nodes (inside paginated contexts) that have
+        -webkit-region-break-after:always.
+
+        Tests: fast/multicol/break-after-always-bottom-margin.html
+               fast/regions/overset-break-nested.html
+               fast/regions/overset-break-with-sibling.html
+               fast/regions/overset-break.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::applyAfterBreak):
+
 2013-02-27  Stephen Chenney  <[email protected]>
 
         Bindings test results update after r144126

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (144177 => 144178)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2013-02-27 14:47:41 UTC (rev 144177)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2013-02-27 14:50:21 UTC (rev 144178)
@@ -7248,11 +7248,14 @@
     bool checkAfterAlways = (checkColumnBreaks && child->style()->columnBreakAfter() == PBALWAYS) || (checkPageBreaks && child->style()->pageBreakAfter() == PBALWAYS)
                             || (checkRegionBreaks && child->style()->regionBreakAfter() == PBALWAYS);
     if (checkAfterAlways && inNormalFlow(child) && hasNextPage(logicalOffset, IncludePageBoundary)) {
-        marginInfo.setMarginAfterQuirk(true); // Cause margins to be discarded for any following content.
+        LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? LayoutUnit() : marginInfo.margin();
+
+        // So our margin doesn't participate in the next collapsing steps.
+        marginInfo.clearMargin();
+
         if (checkColumnBreaks)
             view()->layoutState()->addForcedColumnBreak(child, logicalOffset);
         if (checkRegionBreaks) {
-            LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? LayoutUnit() : marginInfo.margin();
             LayoutUnit offsetBreakAdjustment = 0;
             if (enclosingRenderFlowThread()->addForcedRegionBreak(offsetFromLogicalTopOfFirstPage() + logicalOffset + marginOffset, child, false, &offsetBreakAdjustment))
                 return logicalOffset + offsetBreakAdjustment;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to