Bug 1462477 - Always initialize the value of aOutIsTransformedFixed, even we don't have an image to paint. r?mstange draft
authorMatt Woodrow <mwoodrow@mozilla.com>
Fri, 18 May 2018 13:16:42 +1200
changeset 796663 e48d14dc18a5030b8294d37ff054426d0070fb84
parent 796662 54063deb2f1caf8c4acf6461d3ba779805835c96
push id110327
push usermwoodrow@mozilla.com
push dateFri, 18 May 2018 01:25:45 +0000
reviewersmstange
bugs1462477
milestone62.0a1
Bug 1462477 - Always initialize the value of aOutIsTransformedFixed, even we don't have an image to paint. r?mstange 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
@@ -3255,18 +3255,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;