Bug 1462477 - Always initialize the value of aOutIsTransformedFixed, even we don't have an image to paint. r=mstange, a=RyanVM
authorMatt Woodrow <mwoodrow@mozilla.com>
Fri, 18 May 2018 13:16:42 +1200
changeset 470890 f375abfb277815268acdaf3bfe95e382902178b5
parent 470889 6b22684df52daec5a18b090a48fba026bd5da396
child 470891 c081e26d4a8953f63258a4e74cb4285ba0b74d30
push id9256
push userryanvm@gmail.com
push dateThu, 24 May 2018 15:32:42 +0000
treeherdermozilla-beta@54ba8ee1c9ce [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange, RyanVM
bugs1462477
milestone61.0
Bug 1462477 - Always initialize the value of aOutIsTransformedFixed, even we don't have an image to paint. r=mstange, a=RyanVM This value is used to determine whether we should create nsDisplayFixedPosition, and if the result changes without an invalidation, then retained-dl gets confused with the insertion/removal of a wrap list. MozReview-Commit-ID: JuXwCzKOxec
layout/painting/nsCSSRendering.cpp
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -3258,18 +3258,32 @@ nsCSSRendering::PrepareImageLayer(nsPres
   }
   if (aFlags & nsCSSRendering::PAINTBG_TO_WINDOW) {
     irFlags |= nsImageRenderer::FLAG_PAINTING_TO_WINDOW;
   }
 
   nsBackgroundLayerState state(aForFrame, &aLayer.mImage, irFlags);
   if (!state.mImageRenderer.PrepareImage()) {
     // There's no image or it's not ready to be painted.
-    if (aOutIsTransformedFixed) {
-      *aOutIsTransformedFixed = false;
+    if (aOutIsTransformedFixed &&
+        StyleImageLayerAttachment::Fixed == aLayer.mAttachment) {
+
+      nsIFrame* attachedToFrame = aPresContext->PresShell()->GetRootFrame();
+      NS_ASSERTION(attachedToFrame, "no root frame");
+      nsIFrame* pageContentFrame = nullptr;
+      if (aPresContext->IsPaginated()) {
+        pageContentFrame = nsLayoutUtils::GetClosestFrameOfType(
+          aForFrame, LayoutFrameType::PageContent);
+        if (pageContentFrame) {
+          attachedToFrame = pageContentFrame;
+        }
+        // else this is an embedded shell and its root frame is what we want
+      }
+
+      *aOutIsTransformedFixed = nsLayoutUtils::IsTransformed(aForFrame, attachedToFrame);
     }
     return state;
   }
 
   // The frame to which the background is attached
   nsIFrame* attachedToFrame = aForFrame;
   // Is the background marked 'fixed', but affected by a transform?
   bool transformedFixed = false;