Bug 1603088 Part 1 - Remove "max-block-size: 100%" for -moz-column-set and -moz-column-content. r=dbaron
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 08 Jan 2020 02:48:12 +0000
changeset 509307 969b70e2596026eb043064f93e86c1c899dc4dfd
parent 509306 39c4e3bab99a7dc933cf97593157204b4a280acd
child 509308 fce0d0696080c4e6e52d5860b4f8875a3072d19c
push id104541
push useraethanyc@gmail.com
push dateWed, 08 Jan 2020 02:52:23 +0000
treeherderautoland@fce0d0696080 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1603088
milestone74.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 1603088 Part 1 - Remove "max-block-size: 100%" for -moz-column-set and -moz-column-content. r=dbaron Simply remove "max-block-size: 100%" for -moz-column-set and -moz-column-content breaks abspos-breaking-dynamic-{001,002,003}.html. We need to reflow ColumnSetWrapper's children whenever ColumnSetWrapper's block-size or max-block-size is changed because both size affect the available block-size for ColumnSetWrapper's children. We set `NS_FRAME_CONTAINS_RELATIVE_BSIZE` for ColumnSetWrapperFrame so that it will set itself dirty in `selfDirty` in `nsBlockFrame::ReflowDirtyLines`, and mark its lines dirty if `aState.mReflowInput.IsBResize()` is true. Differential Revision: https://phabricator.services.mozilla.com/D58731
layout/generic/crashtests/crashtests.list
layout/generic/nsBlockFrame.cpp
layout/generic/nsSplittableFrame.cpp
layout/reftests/pagination/abspos-breaking-dynamic-004.html
layout/reftests/pagination/abspos-breaking-dynamic-005-ref.html
layout/reftests/pagination/abspos-breaking-dynamic-005.html
layout/reftests/pagination/reftest.list
layout/style/res/ua.css
--- a/layout/generic/crashtests/crashtests.list
+++ b/layout/generic/crashtests/crashtests.list
@@ -568,17 +568,17 @@ load 973701-2.xhtml
 load 986899.html
 load 1001233.html
 load 1001258-1.html
 load 1001994.html
 load chrome://reftest/content/crashtests/layout/generic/crashtests/1003441.xhtml
 load 1015562.html
 asserts(1-2) asserts-if(Android,1-3) load 1015563-1.html
 asserts(1-2) load 1015563-2.html
-asserts-if(Android,18) load 1015844.html
+asserts-if(Android,21) load 1015844.html
 asserts-if(Android,0-24) pref(font.size.inflation.minTwips,200) load 1032450.html
 load 1032613-1.svg
 load 1032613-2.html
 load 1037903.html
 load 1039454-1.html
 load 1042489.html
 load 1054010-1.html
 load 1058954-1.html
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1249,16 +1249,22 @@ void nsBlockFrame::Reflow(nsPresContext*
   PRTime start = 0;  // Initialize these variablies to silence the compiler.
   int32_t ctc = 0;   // We only use these if they are set (gLameReflowMetrics).
   if (gLameReflowMetrics) {
     start = PR_Now();
     ctc = nsLineBox::GetCtorCount();
   }
 #endif
 
+  // ColumnSetWrapper's children depend on ColumnSetWrapper's block-size or
+  // max-block-size because both affect the children's available block-size.
+  if (IsColumnSetWrapperFrame()) {
+    AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
+  }
+
   const ReflowInput* reflowInput = &aReflowInput;
   WritingMode wm = aReflowInput.GetWritingMode();
   nscoord consumedBSize = ConsumedBSize(wm);
   nscoord effectiveComputedBSize =
       GetEffectiveComputedBSize(aReflowInput, consumedBSize);
   Maybe<ReflowInput> mutableReflowInput;
   // If we have non-auto block size, we're clipping our kids and we fit,
   // make sure our kids fit too.
@@ -1924,19 +1930,16 @@ void nsBlockFrame::ComputeFinalSize(cons
     }
     nscoord bSize = std::max(aState.mBCoord, aReflowInput.AvailableBSize());
     if (aReflowInput.AvailableBSize() == NS_UNCONSTRAINEDSIZE) {
       // This should never happen, but it does. See bug 414255
       bSize = aState.mBCoord;
     }
     const nscoord maxBSize = aReflowInput.ComputedMaxBSize();
     if (maxBSize != NS_UNCONSTRAINEDSIZE &&
-        // FIXME: wallpaper for bug 1603088
-        !(Style()->GetPseudoType() == PseudoStyleType::columnContent ||
-          Style()->GetPseudoType() == PseudoStyleType::columnSet) &&
         aState.mConsumedBSize + bSize - borderPadding.BStart(wm) > maxBSize) {
       nscoord bEnd = std::max(0, maxBSize - aState.mConsumedBSize) +
                      borderPadding.BStart(wm);
       // Note that |borderPadding| has GetSkipSides applied, so we ask
       // aReflowInput for the actual value we'd use on a last fragment here:
       bEnd += aReflowInput.ComputedLogicalBorderPadding().BEnd(wm);
       if (bEnd <= aReflowInput.AvailableBSize()) {
         // We actually fit after applying `max-size` so we should be
--- a/layout/generic/nsSplittableFrame.cpp
+++ b/layout/generic/nsSplittableFrame.cpp
@@ -182,23 +182,16 @@ void nsSplittableFrame::RemoveFromFlow(n
 
   aFrame->SetPrevInFlow(nullptr);
   aFrame->SetNextInFlow(nullptr);
 }
 
 nscoord nsSplittableFrame::ConsumedBSize(WritingMode aWM) const {
   nscoord bSize = 0;
 
-  // FIXME: wallpaper the bogus max-block-size:100% in ua.css (bug 1603088)
-  const auto& pseudoType = Style()->GetPseudoType();
-  if (pseudoType == PseudoStyleType::columnContent ||
-      pseudoType == PseudoStyleType::columnSet) {
-    return bSize;
-  }
-
   for (nsIFrame* prev = GetPrevContinuation(); prev;
        prev = prev->GetPrevContinuation()) {
     bSize += prev->ContentBSize(aWM);
   }
   return bSize;
 }
 
 nscoord nsSplittableFrame::GetEffectiveComputedBSize(
new file mode 100644
--- /dev/null
+++ b/layout/reftests/pagination/abspos-breaking-dynamic-004.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML>
+<title>Test for dynamic re-pagination of absolutely positioned elements</title>
+<link rel="author" title="L. David Baron" href="https://dbaron.org/">
+<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
+<style>
+
+#multicol {
+  columns: 3;
+  column-fill: auto;
+  column-gap: 15px;
+  height: 150px;
+  width: 300px;
+  background: yellow;
+}
+
+#relpos {
+  position: relative;
+  background: aqua;
+  height: 250px;
+}
+
+#abspos {
+  position: absolute;
+  top: 80px;
+  right: 0;
+  height: 80px;
+  width: 50px;
+  background: blue;
+}
+
+</style>
+
+<div id="multicol">
+  <div id="relpos">
+    <div id="abspos"></div>
+  </div>
+</div>
+
+<script>
+var mc = document.getElementById("multicol");
+mc.offsetHeight; // flush layout
+
+// abspos-breaking-dynamic-001.html changes "height", but we change "maxHeight".
+mc.style.maxHeight = "100px";
+
+</script>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/pagination/abspos-breaking-dynamic-005-ref.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<title>Test for dynamic re-pagination of absolutely positioned elements</title>
+<link rel="author" title="L. David Baron" href="https://dbaron.org/">
+<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
+<style>
+
+#multicol {
+  height: 250px;
+  width: 300px;
+  background: yellow;
+  position: relative;
+}
+
+#relpos {
+  position: absolute;
+  background: aqua;
+  height: 250px;
+  width: 90px;
+  top: 0;
+  left: 0;
+}
+
+#abspos {
+  position: absolute;
+  right: 0;
+  height: 80px;
+  width: 50px;
+  background: blue;
+}
+
+</style>
+
+<div id="multicol">
+  <div id="relpos" style="left: 0">
+    <div id="abspos" style="top: 80px; height: 80px"></div>
+  </div>
+</div>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/pagination/abspos-breaking-dynamic-005.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML>
+<title>Test for dynamic re-pagination of absolutely positioned elements</title>
+<link rel="author" title="L. David Baron" href="https://dbaron.org/">
+<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
+<style>
+
+#multicol {
+  columns: 3;
+  column-fill: auto;
+  column-gap: 15px;
+  height: 150px;
+  width: 300px;
+  background: yellow;
+}
+
+#relpos {
+  position: relative;
+  background: aqua;
+  height: 250px;
+}
+
+#abspos {
+  position: absolute;
+  top: 80px;
+  right: 0;
+  height: 80px;
+  width: 50px;
+  background: blue;
+}
+
+</style>
+
+<div id="multicol">
+  <div id="relpos">
+    <div id="abspos"></div>
+  </div>
+</div>
+
+<script>
+var mc = document.getElementById("multicol");
+mc.offsetHeight; // flush layout
+mc.style.height = "auto";
+
+</script>
--- a/layout/reftests/pagination/reftest.list
+++ b/layout/reftests/pagination/reftest.list
@@ -11,16 +11,18 @@ random-if(/^Windows\x20NT\x206\.1/.test(
 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == abspos-breaking-007.html abspos-breaking-007-ref.html # Bug 1392106
 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == abspos-breaking-008.html abspos-breaking-008-ref.html # Bug 1392106
 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == abspos-breaking-009.html abspos-breaking-009-ref.html # Bug 1392106
 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == abspos-breaking-010.html abspos-breaking-010-ref.html # Bug 1392106
 == abspos-breaking-011.html abspos-breaking-011-ref.html # Bug 1392106
 == abspos-breaking-dynamic-001.html abspos-breaking-dynamic-001-ref.html
 == abspos-breaking-dynamic-002.html abspos-breaking-dynamic-002-ref.html
 == abspos-breaking-dynamic-003.html abspos-breaking-dynamic-003-ref.html
+== abspos-breaking-dynamic-004.html abspos-breaking-dynamic-001-ref.html
+== abspos-breaking-dynamic-005.html abspos-breaking-dynamic-005-ref.html
 == abspos-overflow-01.xhtml abspos-overflow-01.ref.xhtml
 == abspos-overflow-01-cols.xhtml abspos-overflow-01-cols.ref.xhtml
 == border-breaking-000-cols.xhtml border-breaking-000-cols.ref.xhtml
 == border-breaking-001-cols.xhtml border-breaking-001-cols.ref.xhtml
 == border-breaking-002-cols.xhtml border-breaking-002-cols.ref.xhtml
 == border-breaking-003-cols.xhtml border-breaking-003-cols.ref.xhtml
 fails == border-breaking-004-cols.xhtml border-breaking-002-cols.ref.xhtml
 == content-inserted-000.xhtml content-inserted-000.ref.xhtml
--- a/layout/style/res/ua.css
+++ b/layout/style/res/ua.css
@@ -255,19 +255,16 @@
 *|*::-moz-column-set,
 *|*::-moz-column-content {
   /* the column boxes inside a column-flowed block */
   /* make unicode-bidi inherit, otherwise it has no effect on column boxes */
   unicode-bidi: inherit;
   text-overflow: inherit;
   /* Both -moz-column-set and -moz-column-content need to be blocks. */
   display: block;
-  /* -moz-column-set and -moz-column-content's max block size cannot exceed
-   * ColumnSetWrapperFrame's block size. */
-  max-block-size: 100%;
 }
 
 *|*::-moz-column-set {
   /* Inherit from ColumnSetWrapperFrame so that nsColumnSetFrame is aware of
    them.*/
   columns: inherit;
   column-gap: inherit;
   column-rule: inherit;