From 206960605d22956a01941913b732622a5dcf19b4 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Thu, 15 Aug 2019 16:59:13 +0000 Subject: [PATCH] Bug 1569701 Part 2 - Use ColumnSetWrapper's effective computed content block-size to impose constraint for ColumnSet. r=dbaron Run broken-column-rule-1.html with column-span enabled because it was regressed by Bug 1548100 Part 2, but fixed by this patch. Differential Revision: https://phabricator.services.mozilla.com/D41907 --HG-- extra : moz-landing-system : lando --- layout/base/crashtests/crashtests.list | 2 +- layout/generic/nsBlockFrame.cpp | 6 ++- layout/generic/nsColumnSetFrame.cpp | 9 ---- .../w3c-css/submitted/multicol3/reftest.list | 6 +++ ...ulticol-rule-nested-balancing-003.html.ini | 2 + ...ulticol-rule-nested-balancing-003-ref.html | 41 +++++++++++++++++++ .../multicol-rule-nested-balancing-003.html | 36 ++++++++++++++++ 7 files changed, 90 insertions(+), 12 deletions(-) create mode 100644 testing/web-platform/meta/css/css-multicol/multicol-rule-nested-balancing-003.html.ini create mode 100644 testing/web-platform/tests/css/css-multicol/multicol-rule-nested-balancing-003-ref.html create mode 100644 testing/web-platform/tests/css/css-multicol/multicol-rule-nested-balancing-003.html diff --git a/layout/base/crashtests/crashtests.list b/layout/base/crashtests/crashtests.list index fbf4ea7a73d2..ace66d980598 100644 --- a/layout/base/crashtests/crashtests.list +++ b/layout/base/crashtests/crashtests.list @@ -575,4 +575,4 @@ pref(layout.css.resizeobserver.enabled,true) load 1548057.html pref(layout.css.column-span.enabled,true) load 1549867.html load 1553874.html load 1560328.html -pref(layout.css.column-span.enabled,true) load 1566672.html +asserts(1-1) pref(layout.css.column-span.enabled,true) load 1566672.html # bug 1573759 diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index d88bd7c55aca..97ca9018bfc7 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -3580,14 +3580,16 @@ void nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState, availSize.BSize(wm) -= aState.BorderPadding().BEnd(wm); } - // Bug 1569701: We need to use GetEffectiveComputedBSize() to get - // correct block-size if ColumnSetWrapper is fragmented. nscoord contentBSize = aState.mReflowInput.ComputedBSize(); if (aState.mReflowInput.ComputedMaxBSize() != NS_UNCONSTRAINEDSIZE) { contentBSize = std::min(contentBSize, aState.mReflowInput.ComputedMaxBSize()); } if (contentBSize != NS_UNCONSTRAINEDSIZE) { + // To get the remaining content block-size, subtract the content + // block-size consumed by our previous continuations. + contentBSize -= aState.mConsumedBSize; + // ColumnSet is not the outermost frame in the column container, so it // cannot have any margin. We don't need to consider any margin that // can be generated by "box-decoration-break: clone" as we do in diff --git a/layout/generic/nsColumnSetFrame.cpp b/layout/generic/nsColumnSetFrame.cpp index f50701e0ed6c..81ed5258c19f 100644 --- a/layout/generic/nsColumnSetFrame.cpp +++ b/layout/generic/nsColumnSetFrame.cpp @@ -938,15 +938,6 @@ nsColumnSetFrame::ColumnBalanceData nsColumnSetFrame::ReflowChildren( // edge of the multicol container. contentSize.BSize(wm) = std::max(contentSize.BSize(wm), aReflowInput.AvailableBSize()); - - // But don't consume more block-size than what is left in the - // ColumnSetWrapper. - // - // Bug 1569701: If we use the effective computed block-size of - // ColumnSetWrapper when creating BlockReflowInput for ColumnSet, the - // available block-size should always less than or equal to the effective - // computed block-size. This std::min() won't be needed. - contentSize.BSize(wm) = std::min(contentSize.BSize(wm), computedBSize); } } else { // Apply computed and min/max values diff --git a/layout/reftests/w3c-css/submitted/multicol3/reftest.list b/layout/reftests/w3c-css/submitted/multicol3/reftest.list index 35102af64b63..0e23efe05e33 100644 --- a/layout/reftests/w3c-css/submitted/multicol3/reftest.list +++ b/layout/reftests/w3c-css/submitted/multicol3/reftest.list @@ -1,3 +1,9 @@ == broken-column-rule-1.html broken-column-rule-1-ref.html == moz-multicol3-column-balancing-break-inside-avoid-1.html moz-multicol3-column-balancing-break-inside-avoid-1-ref.html == multicol-height-002.xht reference/multicol-height-002.xht + +# The following lines are duplicates of other lines from further up in this +# manifest. They're listed again here so we can re-run these tests with +# column-span enabled. These lines can be removed once the pref becomes +# default-enabled (Bug 1426010). +pref(layout.css.column-span.enabled,true) == broken-column-rule-1.html broken-column-rule-1-ref.html diff --git a/testing/web-platform/meta/css/css-multicol/multicol-rule-nested-balancing-003.html.ini b/testing/web-platform/meta/css/css-multicol/multicol-rule-nested-balancing-003.html.ini new file mode 100644 index 000000000000..4e5cdde0e72b --- /dev/null +++ b/testing/web-platform/meta/css/css-multicol/multicol-rule-nested-balancing-003.html.ini @@ -0,0 +1,2 @@ +[multicol-rule-nested-balancing-003.html] + prefs: [layout.css.column-span.enabled:true] diff --git a/testing/web-platform/tests/css/css-multicol/multicol-rule-nested-balancing-003-ref.html b/testing/web-platform/tests/css/css-multicol/multicol-rule-nested-balancing-003-ref.html new file mode 100644 index 000000000000..573afe683fe9 --- /dev/null +++ b/testing/web-platform/tests/css/css-multicol/multicol-rule-nested-balancing-003-ref.html @@ -0,0 +1,41 @@ + + + + CSS Multi-column Layout Test Reference: Test the column rules' block-size with nested balancing multicol container + + + + + +
+
+
+
+
+
+
+
+
+
+ diff --git a/testing/web-platform/tests/css/css-multicol/multicol-rule-nested-balancing-003.html b/testing/web-platform/tests/css/css-multicol/multicol-rule-nested-balancing-003.html new file mode 100644 index 000000000000..3dea42550e5e --- /dev/null +++ b/testing/web-platform/tests/css/css-multicol/multicol-rule-nested-balancing-003.html @@ -0,0 +1,36 @@ + + + + CSS Multi-column Layout Test: Test the column rules' block-size with nested balancing multicol container + + + + + + + + + + +
+
+
+
+
+