Bug 1452805 - Make sure we rebuild contents infront and behind stacking contexts if their size might have changed. r=miko
authorMatt Woodrow <mwoodrow@mozilla.com>
Sun, 15 Apr 2018 16:38:45 +1200
changeset 415176 070057638112fc3250567b9050748049d2e6fe75
parent 415175 4cc04fbbd1d7d6a4af9dbb0cbea52905cff3fef7
child 415177 5daa11905109206fd857f9589f60b57bfc3399b9
push id33891
push userebalazs@mozilla.com
push dateTue, 24 Apr 2018 09:41:19 +0000
treeherdermozilla-central@dc845b3a8cbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmiko
bugs1452805
milestone61.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 1452805 - Make sure we rebuild contents infront and behind stacking contexts if their size might have changed. r=miko The test invalidates the z-index element, so that we do a partial build with just that and the DAG no longer knows the relative ordering between it and the other blue elements. We then expand the size of the 'first' elements stacking context, and ensure that we provide enough intersecting items to know that we're on top of the z-index element. MozReview-Commit-ID: KP7c3bnwfBd * * * [mq]: fix MozReview-Commit-ID: EuraqvaUS35
layout/generic/nsFrame.cpp
layout/reftests/display-list/1452805-1.html
layout/reftests/display-list/1452805-ref.html
layout/reftests/display-list/reftest.list
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -2916,16 +2916,22 @@ nsIFrame::BuildDisplayListForStackingCon
         nsDisplayTransform::UntransformRect(visibleRect, overflow, this, &visibleRect);
       } else {
         // This should only happen if the transform is singular, in which case nothing is visible anyway
         dirtyRect.SetEmpty();
         visibleRect.SetEmpty();
       }
     }
     inTransform = true;
+  } else if (IsFixedPosContainingBlock()) {
+    // Restict the building area to the overflow rect for these frames, since
+    // RetainedDisplayListBuilder uses it to know if the size of the stacking
+    // context changed.
+    visibleRect.IntersectRect(visibleRect, GetVisualOverflowRect());
+    dirtyRect.IntersectRect(dirtyRect, GetVisualOverflowRect());
   }
 
   bool hasOverrideDirtyRect = false;
   // If we have an override dirty region, and neither us nor our ancestors are
   // modified, then use it.
   if (HasOverrideDirtyRegion() && !aBuilder->InInvalidSubtree() && !IsFrameModified()) {
     nsDisplayListBuilder::DisplayListBuildingData* data =
       GetProperty(nsDisplayListBuilder::DisplayListBuildingRect());
new file mode 100644
--- /dev/null
+++ b/layout/reftests/display-list/1452805-1.html
@@ -0,0 +1,39 @@
+<html class="reftest-wait">
+  <head>
+    <style>
+    div {
+      width: 200px;
+      height: 200px;
+      background-color: blue;
+      filter: greyscale(50%);
+      position: relative;
+    }
+    #second {
+      width: 600px;
+      height: 500px;
+      display: none;
+      background-color: green;
+    }
+    </style>
+  </head>
+  <body>
+    <div id="top" style="z-index:-4;"></div>
+    <div style="top: 10px;"></div>
+    <div style="top: 20px;">
+        <div id="second" style="top: -400px;"></div>
+    </div>
+
+    <script>
+      function doTest2() {
+        document.getElementById("second").style.display = "block";
+        document.documentElement.removeAttribute("class");
+      }
+      function doTest() {
+        document.getElementById("top").style.zIndex = -5;
+        setTimeout(doTest2, 500);
+      }
+      document.addEventListener("MozReftestInvalidate", doTest);
+    </script>
+  </body>
+</html>
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/display-list/1452805-ref.html
@@ -0,0 +1,26 @@
+<html>
+  <head>
+    <style>
+    div {
+      width: 200px;
+      height: 200px;
+      background-color: blue;
+      filter: greyscale(50%);
+      position: relative;
+    }
+    #second {
+      width: 600px;
+      height: 500px;
+      background-color: green;
+    }
+    </style>
+  </head>
+  <body>
+    <div id="top" style="z-index:-4;"></div>
+    <div style="top: 10px;"></div>
+    <div style="top: 20px;">
+        <div id="second" style="top: -400px;"></div>
+    </div>
+  </body>
+</html>
+
--- a/layout/reftests/display-list/reftest.list
+++ b/layout/reftests/display-list/reftest.list
@@ -22,8 +22,9 @@ needs-focus == 1429027-1.html 1429027-1-
 == 1432553-2.html 1432553-2-ref.html
 == 1436189-1.html 1436189-1-ref.html
 skip-if(!asyncPan) == 1437374-1.html 1437374-1-ref.html
 == 1439809-1.html 1439809-1-ref.html
 == 1443027-1.html 1443027-ref.html
 == 1443027-2.html 1443027-ref.html
 == 1443027-3.html 1443027-3-ref.html
 == 1451971-1.html 1451971-ref.html
+== 1452805-1.html 1452805-ref.html