Bug 1453668 - Restrict the retained display list stacking context optimization to frames that are also containing blocks for position:fixed. r?miko draft
authorMatt Woodrow <mwoodrow@mozilla.com>
Mon, 16 Apr 2018 14:23:47 +1200
changeset 783253 5d758956d1725ba362ab1a4634c893771ee46755
parent 782866 1d1668f523d1892096fac42fc0f2c1c4905b2bc9
push id106646
push usermwoodrow@mozilla.com
push dateMon, 16 Apr 2018 20:49:16 +0000
reviewersmiko
bugs1453668
milestone61.0a1
Bug 1453668 - Restrict the retained display list stacking context optimization to frames that are also containing blocks for position:fixed. r?miko MozReview-Commit-ID: GP4uMpR2Lq0
layout/painting/RetainedDisplayListBuilder.cpp
layout/reftests/display-list/retained-dl-style-change-stacking-context-1.html
--- a/layout/painting/RetainedDisplayListBuilder.cpp
+++ b/layout/painting/RetainedDisplayListBuilder.cpp
@@ -742,17 +742,18 @@ ProcessFrame(nsIFrame* aFrame, nsDisplay
       aOverflow.IntersectRect(aOverflow, currentFrame->GetVisualOverflowRectRelativeToSelf());
     }
 
     if (aOverflow.IsEmpty()) {
       break;
     }
 
     if (currentFrame != aBuilder.RootReferenceFrame() &&
-        currentFrame->IsStackingContext()) {
+        currentFrame->IsStackingContext() &&
+        currentFrame->IsFixedPosContainingBlock()) {
       CRR_LOG("Frame belongs to stacking context frame %p\n", currentFrame);
       // If we found an intermediate stacking context with an existing display item
       // then we can store the dirty rect there and stop. If we couldn't find one then
       // we need to keep bubbling up to the next stacking context.
       nsDisplayItem* wrapperItem = GetFirstDisplayItemWithChildren(currentFrame);
       if (!wrapperItem) {
         continue;
       }
--- a/layout/reftests/display-list/retained-dl-style-change-stacking-context-1.html
+++ b/layout/reftests/display-list/retained-dl-style-change-stacking-context-1.html
@@ -12,22 +12,18 @@
   }
 </style>
 </head>
 <body>
   <div id="first" style="background-color:green; width:200px; height:200px" class="reftest-no-display-list"></div>
   <div style="transform:translateZ(1px)">
     <div id="second" style="background-color:red"></div>
   </div>
-  <div style="position:fixed; left:100px">
-    <div id="third" style="background-color:red"></div>
-  </div>
 </body>
 <script>
 function doTest() {
   document.getElementById("second").style.backgroundColor = "green";
-  document.getElementById("third").style.backgroundColor = "green";
   document.documentElement.removeAttribute("class");
 }
 
 window.addEventListener("MozReftestInvalidate", doTest);
 </script>
 </html>