Bug 1603088 Part 1 - Remove "max-block-size: 100%" for -moz-column-set and -moz-column-content. r=dbaron
☠☠ backed out by 5045bdc8b3d4 ☠ ☠
authorTing-Yu Lin <tlin@mozilla.com>
Tue, 07 Jan 2020 19:17:27 +0000
changeset 509183 d4cc66fb7593c2ca68b4e2507e04ceae8e38cd9d
parent 509182 58f20c97d78f59fcd81f78de698a9a912e74b76e
child 509184 2bd2d03f3c45dfbe63d553021749116f76e2b9d3
push id104503
push useraethanyc@gmail.com
push dateTue, 07 Jan 2020 20:20:17 +0000
treeherderautoland@2bd2d03f3c45 [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/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/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;