Bug 1462477 - Always initialize the value of aOutIsTransformedFixed, even we don't have an image to paint. r=mstange
authorMatt Woodrow <mwoodrow@mozilla.com>
Fri, 18 May 2018 13:16:42 +1200
changeset 418842 266c78fab1d6b9950a0ae2f5fb176cbe37d045ea
parent 418841 2375438b837c39405dd2c3fa143c12611be82e02
child 418843 5df1a6b69bd08eb7f31722faa58497ae869b34e6
push id34014
push useraciure@mozilla.com
push dateFri, 18 May 2018 22:04:52 +0000
treeherdermozilla-central@b54f574a1dd2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1462477
milestone62.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 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;