Bug 1367413 - Fix assertion that can occur when paginating abs-pos elements with a transform. r=mats
authorL. David Baron <dbaron@dbaron.org>
Thu, 25 May 2017 16:21:20 -0400
changeset 408843 e6bf2e19464cd774d46d243c82a64fa1b05056c8
parent 408842 67e4f5e8a105f135f004fd40cb2e4ab28c530e8c
child 408844 73c786971ec0525d496003ee2b2b996e4d0a8769
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1367413
milestone55.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 1367413 - Fix assertion that can occur when paginating abs-pos elements with a transform. r=mats I confirmed that the test crashes in the crashtest harness without the patch (although the harness doesn't exit!), whereas it passes with the patch. MozReview-Commit-ID: 37S6i1kvw37
layout/generic/crashtests/1367413-1.html
layout/generic/crashtests/crashtests.list
layout/generic/nsAbsoluteContainingBlock.cpp
new file mode 100644
--- /dev/null
+++ b/layout/generic/crashtests/1367413-1.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML>
+<title>Test for dynamic re-pagination of absolutely positioned elements</title>
+<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
+<link rel="author" title="L. David Baron" href="https://dbaron.org/">
+<style>
+
+#multicol {
+  columns: 3;
+  column-fill: auto;
+  column-gap: 15px;
+  height: 500px;
+  width: 300px;
+  background: yellow;
+}
+
+#relpos {
+  position: relative;
+  background: aqua;
+  height: 250px;
+}
+
+#abspos {
+  position: absolute;
+  top: 60px;
+  right: 0;
+  height: 80px;
+  width: 50px;
+  background: blue;
+  transform: scale(0.9);
+}
+
+#overflow {
+  height: 100px;
+  width: 30px;
+  background: grey;
+}
+</style>
+<body style="width: 700px">
+
+<div id="multicol">
+  <div id="relpos">
+    <div id="abspos"><div id="overflow"></div></div>
+  </div>
+</div>
+
+<script>
+
+var mc = document.getElementById("multicol");
+mc.offsetHeight; // flush layout
+mc.style.height = "140px";
+mc.offsetHeight; // flush layout
+mc.parentNode.style.width = "800px";
+
+</script>
--- a/layout/generic/crashtests/crashtests.list
+++ b/layout/generic/crashtests/crashtests.list
@@ -647,8 +647,9 @@ load large-border-radius-dotted2.html
 load 1278461-1.html
 load 1278461-2.html
 load 1281102.html
 load 1297427-non-equal-centers.html
 load 1304441.html
 load 1316649.html
 load 1349650.html
 asserts-if(browserIsRemote,0-5) load 1349816-1.html # bug 1350352
+load 1367413-1.html
--- a/layout/generic/nsAbsoluteContainingBlock.cpp
+++ b/layout/generic/nsAbsoluteContainingBlock.cpp
@@ -144,17 +144,19 @@ nsAbsoluteContainingBlock::Reflow(nsCont
       WritingMode kidWM = kidFrame->GetWritingMode();
       if (containerWM.GetBlockDir() != kidWM.GetBlockDir()) {
         // Not sure what the right test would be here.
         kidNeedsReflow = true;
       } else {
         nscoord kidBEnd = kidFrame->GetLogicalRect(cb.Size()).BEnd(kidWM);
         nscoord kidOverflowBEnd =
           LogicalRect(containerWM,
-                      kidFrame->GetScrollableOverflowRectRelativeToParent(),
+                      // Use ...RelativeToSelf to ignore transforms
+                      kidFrame->GetScrollableOverflowRectRelativeToSelf() +
+                        kidFrame->GetPosition(),
                       aContainingBlock.Size()).BEnd(containerWM);
         MOZ_ASSERT(kidOverflowBEnd >= kidBEnd);
         if (kidOverflowBEnd > availBSize ||
             (kidBEnd < availBSize && kidFrame->GetNextInFlow())) {
           kidNeedsReflow = true;
         }
       }
     }