Bug 1569701 Part 2 - Use ColumnSetWrapper's effective computed content block-size to impose constraint for ColumnSet. r=dbaron
authorTing-Yu Lin <tlin@mozilla.com>
Thu, 15 Aug 2019 16:59:13 +0000
changeset 488288 e9611b9cff9a7a9bf7ce21a1384d017bf9c02fbe
parent 488287 6d5655c8638d8683fe22521583bddd575c668575
child 488289 8b8878633443587a44118fad8f247c6b9cd6adb9
push id36440
push userncsoregi@mozilla.com
push dateFri, 16 Aug 2019 03:57:48 +0000
treeherdermozilla-central@a58b7dc85887 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1569701, 1548100
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
layout/base/crashtests/crashtests.list
layout/generic/nsBlockFrame.cpp
layout/generic/nsColumnSetFrame.cpp
layout/reftests/w3c-css/submitted/multicol3/reftest.list
testing/web-platform/meta/css/css-multicol/multicol-rule-nested-balancing-003.html.ini
testing/web-platform/tests/css/css-multicol/multicol-rule-nested-balancing-003-ref.html
testing/web-platform/tests/css/css-multicol/multicol-rule-nested-balancing-003.html
--- a/layout/base/crashtests/crashtests.list
+++ b/layout/base/crashtests/crashtests.list
@@ -570,9 +570,9 @@ pref(layout.css.column-span.enabled,true
 load 1539303.html
 pref(layout.css.column-span.enabled,true) load 1541679.html
 load 1547261.html
 pref(layout.css.column-span.enabled,true) load 1547391.html
 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
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -3575,24 +3575,26 @@ void nsBlockFrame::ReflowBlockFrame(Bloc
       // column block size.
       if (frame->IsColumnSetFrame()) {
         if (availSize.BSize(wm) != NS_UNCONSTRAINEDSIZE) {
           // If the available size is constrained, we need to subtract
           // ColumnSetWrapper's block-end border and padding.
           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
           // BlockReflowInput::ComputeBlockAvailSpace().
           const nscoord availContentBSize = std::max(
               0, contentBSize - (aState.mBCoord - aState.ContentBStart()));
           availSize.BSize(wm) =
               std::min(availSize.BSize(wm), availContentBSize);
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -933,25 +933,16 @@ nsColumnSetFrame::ColumnBalanceData nsCo
       // (nsBlockFrame::ReflowBlockFrame() applies the block-size constraint
       // when creating BlockReflowInput for ColumnSetFrame); and b) we are the
       // sole ColumnSet or the last ColumnSet continuation split by column-spans
       // in a ColumnSetWrapper, extend our block-size to consume the available
       // block-size so that the column-rules are drawn to the content block-end
       // 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
     if (aConfig.mComputedBSize != NS_UNCONSTRAINEDSIZE) {
       if (aReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE) {
         contentSize.BSize(wm) =
             std::min(contentSize.BSize(wm), aConfig.mComputedBSize);
       } else {
--- 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
new file mode 100644
--- /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]
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-multicol/multicol-rule-nested-balancing-003-ref.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+  <meta charset="utf-8">
+  <title>CSS Multi-column Layout Test Reference: Test the column rules' block-size with nested balancing multicol container</title>
+  <link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
+  <link rel="author" title="Mozilla" href="https://www.mozilla.org/">
+
+  <style>
+  .outer {
+    column-count: 2;
+    column-rule: 6px solid black;
+    column-fill: auto;
+    width: 400px;
+    height: 250px;
+  }
+  .inner {
+    column-count: 2;
+    column-rule: 3px solid gray;
+    column-fill: auto;
+    height: 200px;
+  }
+  .inner-block {
+    background-color: lightblue;
+    height: 400px;
+  }
+  .space {
+    height: 50px;
+  }
+  </style>
+
+  <article class="outer">
+    <article class="inner">
+      <div class="inner-block"></div>
+    </article>
+    <div class="space"></div>
+    <article class="inner">
+      <div class="inner-block"></div>
+    </article>
+    <div class="space"></div>
+  </article>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-multicol/multicol-rule-nested-balancing-003.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+  <meta charset="utf-8">
+  <title>CSS Multi-column Layout Test: Test the column rules' block-size with nested balancing multicol container</title>
+  <link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
+  <link rel="author" title="Mozilla" href="https://www.mozilla.org/">
+  <link rel="help" href="https://drafts.csswg.org/css-multicol-1/#cf">
+  <link rel="help" href="https://drafts.csswg.org/css-multicol-1/#column-gaps-and-rules">
+  <link rel="help" href="https://github.com/w3c/csswg-drafts/issues/2309">
+  <link rel="match" href="multicol-rule-nested-balancing-003-ref.html">
+  <meta name="assert" content="This test verifies that the column-rules are extended to the content block-end edges of their corresponding inner and outer multicol container.">
+
+  <style>
+  .outer {
+    column-count: 2;
+    column-rule: 6px solid black;
+    width: 400px;
+    height: 250px;
+  }
+  .inner {
+    column-count: 2;
+    column-rule: 3px solid gray;
+    height: 400px;
+  }
+  .inner-block {
+    background-color: lightblue;
+    height: 800px;
+  }
+  </style>
+
+  <article class="outer">
+    <article class="inner">
+      <div class="inner-block"></div>
+    </article>
+  </article>
+</html>