Bug 1298218 - Add the ability to know whether a background image is fixed before creating the display item. r?mattwoodrow draft
authorMarkus Stange <mstange@themasta.com>
Fri, 19 Aug 2016 19:36:57 -0400
changeset 469201 b13d249439264bed65ceecc26f64cfca324b10da
parent 468498 ee975d32deb9eaa5641f45428cd6a4b5b555a8f5
child 469202 97ea068daf6d451c2c33f5e6325431ddcb8fd607
push id43652
push userbmo:mstange@themasta.com
push dateWed, 01 Feb 2017 21:18:30 +0000
reviewersmattwoodrow
bugs1298218
milestone54.0a1
Bug 1298218 - Add the ability to know whether a background image is fixed before creating the display item. r?mattwoodrow With the ActiveScrolledRoot changes, we will need to set up different state on the display list builder prior to creating the nsDisplayBackgroundImage item. MozReview-Commit-ID: CgeffVPccfj
layout/generic/nsCanvasFrame.cpp
layout/generic/nsCanvasFrame.h
layout/painting/nsCSSRendering.cpp
layout/painting/nsDisplayList.cpp
layout/painting/nsDisplayList.h
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -487,24 +487,29 @@ nsCanvasFrame::BuildDisplayList(nsDispla
     NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, layers) {
       if (layers.mLayers[i].mImage.IsEmpty()) {
         continue;
       }
       if (layers.mLayers[i].mBlendMode != NS_STYLE_BLEND_NORMAL) {
         needBlendContainer = true;
       }
 
+      nsRect bgRect = GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(this);
+      nsDisplayBackgroundImage::InitData bgData =
+        nsDisplayBackgroundImage::GetInitData(aBuilder, this, i, bgRect, bg,
+                                              nsDisplayBackgroundImage::LayerizeFixed::ALWAYS_LAYERIZE_FIXED_BACKGROUND);
+
       nsDisplayList thisItemList;
-      nsDisplayCanvasBackgroundImage* bgItem =
-        new (aBuilder) nsDisplayCanvasBackgroundImage(aBuilder, this, i, bg);
-      if (bgItem->ShouldFixToViewport(aBuilder)) {
+      if (bgData.shouldFixToViewport) {
+        nsDisplayCanvasBackgroundImage* bgItem =
+          new (aBuilder) nsDisplayCanvasBackgroundImage(bgData);
         thisItemList.AppendNewToTop(
           nsDisplayFixedPosition::CreateForFixedBackground(aBuilder, this, bgItem, i));
       } else {
-        thisItemList.AppendNewToTop(bgItem);
+        thisItemList.AppendNewToTop(new (aBuilder) nsDisplayCanvasBackgroundImage(bgData));
       }
 
       if (layers.mLayers[i].mBlendMode != NS_STYLE_BLEND_NORMAL) {
         thisItemList.AppendNewToTop(
           new (aBuilder) nsDisplayBlendMode(aBuilder, this, &thisItemList,
                                             layers.mLayers[i].mBlendMode,
                                             scrollClip, i + 1));
       }
--- a/layout/generic/nsCanvasFrame.h
+++ b/layout/generic/nsCanvasFrame.h
@@ -193,49 +193,33 @@ public:
   NS_DISPLAY_DECL_NAME("CanvasBackgroundColor", TYPE_CANVAS_BACKGROUND_COLOR)
 #ifdef MOZ_DUMP_PAINTING
   virtual void WriteDebugInfo(std::stringstream& aStream) override;
 #endif
 };
 
 class nsDisplayCanvasBackgroundImage : public nsDisplayBackgroundImage {
 public:
-  nsDisplayCanvasBackgroundImage(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
-                                 uint32_t aLayer, const nsStyleBackground* aBg)
-    : nsDisplayBackgroundImage(aBuilder, aFrame, aLayer,
-                               aFrame->GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(aFrame),
-                               aBg)
+  explicit nsDisplayCanvasBackgroundImage(const InitData& aInitData)
+    : nsDisplayBackgroundImage(aInitData)
   {
-    if (ShouldFixToViewport(aBuilder)) {
-      mAnimatedGeometryRoot = aBuilder->FindAnimatedGeometryRootFor(this);
-    }
   }
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) override;
 
   virtual void NotifyRenderingChanged() override
   {
     mFrame->Properties().Delete(nsIFrame::CachedBackgroundImageDT());
   }
-
-  virtual bool ShouldFixToViewport(nsDisplayListBuilder* aBuilder) override
-  {
-    // Put background-attachment:fixed canvas background images in their own
-    // compositing layer. Since we know their background painting area can't
-    // change (unless the viewport size itself changes), async scrolling
-    // will work well.
-    return ShouldTreatAsFixed() &&
-           !mBackgroundStyle->mImage.mLayers[mLayer].mImage.IsEmpty();
-  }
  
   // We still need to paint a background color as well as an image for this item, 
   // so we can't support this yet.
   virtual bool SupportsOptimizingToImage() override { return false; }
 
- bool IsSingleFixedPositionImage(nsDisplayListBuilder* aBuilder,
+  bool IsSingleFixedPositionImage(nsDisplayListBuilder* aBuilder,
                                   const nsRect& aClipRect,
                                   gfxRect* aDestRect);
   
   
   NS_DISPLAY_DECL_NAME("CanvasBackgroundImage", TYPE_CANVAS_BACKGROUND_IMAGE)
 };
 
 class nsDisplayCanvasThemedBackground : public nsDisplayThemedBackground {
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -3845,36 +3845,24 @@ nsCSSRendering::PrepareImageLayer(nsPres
   // it to compute the effective image size for a CSS gradient.
   nsRect positionArea =
     ComputeImageLayerPositioningArea(aPresContext, aForFrame, aBorderArea,
                                      aLayer, &attachedToFrame, &transformedFixed);
   if (aOutIsTransformedFixed) {
     *aOutIsTransformedFixed = transformedFixed;
   }
 
-  // For background-attachment:fixed backgrounds, we'll limit the area
+  // For background-attachment:fixed backgrounds, we'll override the area
   // where the background can be drawn to the viewport.
   nsRect bgClipRect = aBGClipRect;
 
-  // Compute the anchor point.
-  //
-  // relative to aBorderArea.TopLeft() (which is where the top-left
-  // of aForFrame's border-box will be rendered)
-  nsPoint imageTopLeft;
-  if (NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED == aLayer.mAttachment && !transformedFixed) {
-    if (aFlags & nsCSSRendering::PAINTBG_TO_WINDOW) {
-      // Clip background-attachment:fixed backgrounds to the viewport, if we're
-      // painting to the screen and not transformed. This avoids triggering
-      // tiling in common cases, without affecting output since drawing is
-      // always clipped to the viewport when we draw to the screen. (But it's
-      // not a pure optimization since it can affect the values of pixels at the
-      // edge of the viewport --- whether they're sampled from a putative "next
-      // tile" or not.)
-      bgClipRect.IntersectRect(bgClipRect, positionArea + aBorderArea.TopLeft());
-    }
+  if (NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED == aLayer.mAttachment &&
+      !transformedFixed &&
+      (aFlags & nsCSSRendering::PAINTBG_TO_WINDOW)) {
+    bgClipRect = positionArea + aBorderArea.TopLeft();
   }
 
   int repeatX = aLayer.mRepeat.mXRepeat;
   int repeatY = aLayer.mRepeat.mYRepeat;
 
   // Scale the image as specified for background-size and background-repeat.
   // Also as required for proper background positioning when background-position
   // is defined with percentages.
@@ -3887,16 +3875,22 @@ nsCSSRendering::PrepareImageLayer(nsPres
                                                    repeatY);
 
   if (imageSize.width <= 0 || imageSize.height <= 0)
     return state;
 
   state.mImageRenderer.SetPreferredSize(intrinsicSize,
                                         imageSize);
 
+  // Compute the anchor point.
+  //
+  // relative to aBorderArea.TopLeft() (which is where the top-left
+  // of aForFrame's border-box will be rendered)
+  nsPoint imageTopLeft;
+
   // Compute the position of the background now that the background's size is
   // determined.
   nsImageRenderer::ComputeObjectAnchorPoint(aLayer.mPosition,
                                             bgPositionSize, imageSize,
                                             &imageTopLeft, &state.mAnchor);
   state.mRepeatSize = imageSize;
   if (repeatX == NS_STYLE_IMAGELAYER_REPEAT_SPACE) {
     bool isRepeat;
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -2575,61 +2575,86 @@ GetViewportRectRelativeToReferenceFrame(
   nsIFrame* rootFrame = aFrame->PresContext()->PresShell()->GetRootFrame();
   nsRect rootRect = rootFrame->GetRectRelativeToSelf();
   if (nsLayoutUtils::TransformRect(rootFrame, aFrame, rootRect) == nsLayoutUtils::TRANSFORM_SUCCEEDED) {
     return Some(rootRect + aBuilder->ToReferenceFrame(aFrame));
   }
   return Nothing();
 }
 
-nsDisplayBackgroundImage::nsDisplayBackgroundImage(nsDisplayListBuilder* aBuilder,
-                                                   nsIFrame* aFrame,
-                                                   uint32_t aLayer,
-                                                   const nsRect& aBackgroundRect,
-                                                   const nsStyleBackground* aBackgroundStyle)
-  : nsDisplayImageContainer(aBuilder, aFrame)
-  , mBackgroundStyle(aBackgroundStyle)
-  , mBackgroundRect(aBackgroundRect)
-  , mLayer(aLayer)
-  , mIsRasterImage(false)
-{
-  MOZ_COUNT_CTOR(nsDisplayBackgroundImage);
-
-  nsPresContext* presContext = mFrame->PresContext();
+/* static */ nsDisplayBackgroundImage::InitData
+nsDisplayBackgroundImage::GetInitData(nsDisplayListBuilder* aBuilder,
+                                      nsIFrame* aFrame,
+                                      uint32_t aLayer,
+                                      const nsRect& aBackgroundRect,
+                                      const nsStyleBackground* aBackgroundStyle,
+                                      LayerizeFixed aLayerizeFixed)
+{
+  nsPresContext* presContext = aFrame->PresContext();
   uint32_t flags = aBuilder->GetBackgroundPaintFlags();
-  const nsStyleImageLayers::Layer &layer = mBackgroundStyle->mImage.mLayers[mLayer];
+  const nsStyleImageLayers::Layer &layer = aBackgroundStyle->mImage.mLayers[aLayer];
 
   bool isTransformedFixed;
   nsBackgroundLayerState state =
-    nsCSSRendering::PrepareImageLayer(presContext, mFrame, flags,
-                                      mBackgroundRect, mBackgroundRect, layer,
+    nsCSSRendering::PrepareImageLayer(presContext, aFrame, flags,
+                                      aBackgroundRect, aBackgroundRect, layer,
                                       &isTransformedFixed);
-  mShouldTreatAsFixed = ComputeShouldTreatAsFixed(isTransformedFixed);
-
-  mBounds = GetBoundsInternal(aBuilder);
-  if (ShouldFixToViewport(aBuilder)) {
-    mAnimatedGeometryRoot = aBuilder->FindAnimatedGeometryRootFor(this);
+
+  // background-attachment:fixed is treated as background-attachment:scroll
+  // if it's affected by a transform.
+  // See https://www.w3.org/Bugs/Public/show_bug.cgi?id=17521.
+  bool shouldTreatAsFixed =
+    layer.mAttachment == NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED && !isTransformedFixed;
+
+  bool shouldFixToViewport = shouldTreatAsFixed && !layer.mImage.IsEmpty();
+  if (shouldFixToViewport &&
+      aLayerizeFixed == LayerizeFixed::DO_NOT_LAYERIZE_FIXED_BACKGROUND_IF_AVOIDING_COMPONENT_ALPHA_LAYERS &&
+      !nsLayoutUtils::UsesAsyncScrolling(aFrame)) {
+    RefPtr<LayerManager> layerManager = aBuilder->GetWidgetLayerManager();
+    if (layerManager && layerManager->ShouldAvoidComponentAlphaLayers()) {
+      shouldFixToViewport = false;
+    }
+  }
+
+  bool isRasterImage = state.mImageRenderer.IsRasterImage();
+  nsCOMPtr<imgIContainer> image;
+  if (isRasterImage) {
+    image = state.mImageRenderer.GetImage();
+  }
+  return InitData{
+    aBuilder, aFrame, aBackgroundStyle, image, aBackgroundRect,
+    state.mFillArea, state.mDestArea, aLayer, isRasterImage,
+    shouldFixToViewport
+  };
+}
+
+nsDisplayBackgroundImage::nsDisplayBackgroundImage(const InitData& aInitData)
+  : nsDisplayImageContainer(aInitData.builder, aInitData.frame)
+  , mBackgroundStyle(aInitData.backgroundStyle)
+  , mImage(aInitData.image)
+  , mBackgroundRect(aInitData.backgroundRect)
+  , mFillRect(aInitData.fillArea)
+  , mDestRect(aInitData.destArea)
+  , mLayer(aInitData.layer)
+  , mIsRasterImage(aInitData.isRasterImage)
+  , mShouldFixToViewport(aInitData.shouldFixToViewport)
+{
+  MOZ_COUNT_CTOR(nsDisplayBackgroundImage);
+
+  mBounds = GetBoundsInternal(aInitData.builder);
+  if (mShouldFixToViewport) {
+    mAnimatedGeometryRoot = aInitData.builder->FindAnimatedGeometryRootFor(this);
 
     // Expand the item's visible rect to cover the entire bounds, limited to the
     // viewport rect. This is necessary because the background's clip can move
     // asynchronously.
-    if (Maybe<nsRect> viewportRect = GetViewportRectRelativeToReferenceFrame(aBuilder, mFrame)) {
+    if (Maybe<nsRect> viewportRect = GetViewportRectRelativeToReferenceFrame(aInitData.builder, mFrame)) {
       mVisibleRect = mBounds.Intersect(*viewportRect);
     }
   }
-
-  mFillRect = state.mFillArea;
-  mDestRect = state.mDestArea;
-
-  nsImageRenderer* imageRenderer = &state.mImageRenderer;
-  // We only care about images here, not gradients.
-  if (imageRenderer->IsRasterImage()) {
-    mIsRasterImage = true;
-    mImage = imageRenderer->GetImage();
-  }
 }
 
 nsDisplayBackgroundImage::~nsDisplayBackgroundImage()
 {
 #ifdef NS_BUILD_REFCNT_LOGGING
   MOZ_COUNT_DTOR(nsDisplayBackgroundImage);
 #endif
 }
@@ -2825,25 +2850,27 @@ nsDisplayBackgroundImage::AppendBackgrou
 
     DisplayListClipState::AutoSaveRestore clipState(aBuilder);
     if (!aBuilder->IsForEventDelivery()) {
       const nsStyleImageLayers::Layer& layer = bg->mImage.mLayers[i];
       SetBackgroundClipRegion(clipState, aFrame, toRef,
                               layer, bgRect, willPaintBorder);
     }
 
+    nsDisplayBackgroundImage::InitData bgData =
+      nsDisplayBackgroundImage::GetInitData(aBuilder, aFrame, i, bgRect, bg,
+                                            LayerizeFixed::DO_NOT_LAYERIZE_FIXED_BACKGROUND_IF_AVOIDING_COMPONENT_ALPHA_LAYERS);
+
     nsDisplayList thisItemList;
-    nsDisplayBackgroundImage* bgItem =
-      new (aBuilder) nsDisplayBackgroundImage(aBuilder, aFrame, i, bgRect, bg);
-
-    if (bgItem->ShouldFixToViewport(aBuilder)) {
+    if (bgData.shouldFixToViewport) {
+      nsDisplayBackgroundImage* bgItem = new (aBuilder) nsDisplayBackgroundImage(bgData);
       thisItemList.AppendNewToTop(
         nsDisplayFixedPosition::CreateForFixedBackground(aBuilder, aFrame, bgItem, i));
     } else {
-      thisItemList.AppendNewToTop(bgItem);
+      thisItemList.AppendNewToTop(new (aBuilder) nsDisplayBackgroundImage(bgData));
     }
 
     if (bg->mImage.mLayers[i].mBlendMode != NS_STYLE_BLEND_NORMAL) {
       thisItemList.AppendNewToTop(
         new (aBuilder) nsDisplayBlendMode(aBuilder, aFrame, &thisItemList,
                                           bg->mImage.mLayers[i].mBlendMode,
                                           scrollClip, i + 1));
     }
@@ -2886,60 +2913,16 @@ RoundedBorderIntersectsRect(nsIFrame* aF
 static bool RoundedRectContainsRect(const nsRect& aRoundedRect,
                                     const nscoord aRadii[8],
                                     const nsRect& aContainedRect) {
   nsRegion rgn = nsLayoutUtils::RoundedRectIntersectRect(aRoundedRect, aRadii, aContainedRect);
   return rgn.Contains(aContainedRect);
 }
 
 bool
-nsDisplayBackgroundImage::ShouldTreatAsFixed() const
-{
-  return mShouldTreatAsFixed;
-}
-
-bool
-nsDisplayBackgroundImage::ComputeShouldTreatAsFixed(bool isTransformedFixed) const
-{
-  if (!mBackgroundStyle)
-    return false;
-
-  const nsStyleImageLayers::Layer &layer = mBackgroundStyle->mImage.mLayers[mLayer];
-  if (layer.mAttachment != NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED)
-    return false;
-
-  // background-attachment:fixed is treated as background-attachment:scroll
-  // if it's affected by a transform.
-  // See https://www.w3.org/Bugs/Public/show_bug.cgi?id=17521.
-  return !isTransformedFixed;
-}
-
-bool
-nsDisplayBackgroundImage::IsNonEmptyFixedImage() const
-{
-  return ShouldTreatAsFixed() &&
-         !mBackgroundStyle->mImage.mLayers[mLayer].mImage.IsEmpty();
-}
-
-bool
-nsDisplayBackgroundImage::ShouldFixToViewport(nsDisplayListBuilder* aBuilder)
-{
-  // APZ needs background-attachment:fixed images layerized for correctness.
-  RefPtr<LayerManager> layerManager = aBuilder->GetWidgetLayerManager();
-  if (!nsLayoutUtils::UsesAsyncScrolling(mFrame) &&
-      layerManager && layerManager->ShouldAvoidComponentAlphaLayers()) {
-    return false;
-  }
-
-  // Put background-attachment:fixed background images in their own
-  // compositing layer.
-  return IsNonEmptyFixedImage();
-}
-
-bool
 nsDisplayBackgroundImage::CanOptimizeToImageLayer(LayerManager* aManager,
                                                   nsDisplayListBuilder* aBuilder)
 {
   if (!mBackgroundStyle) {
     return false;
   }
 
   // We currently can't handle tiled backgrounds.
@@ -3321,17 +3304,17 @@ nsDisplayBackgroundImage::GetBoundsInter
   if (!mBackgroundStyle) {
     return nsRect();
   }
 
   nsRect clipRect = mBackgroundRect;
   if (mFrame->GetType() == nsGkAtoms::canvasFrame) {
     nsCanvasFrame* frame = static_cast<nsCanvasFrame*>(mFrame);
     clipRect = frame->CanvasArea() + ToReferenceFrame();
-  } else if (nsLayoutUtils::UsesAsyncScrolling(mFrame) && IsNonEmptyFixedImage()) {
+  } else if (nsLayoutUtils::UsesAsyncScrolling(mFrame) && mShouldFixToViewport) {
     // If this is a background-attachment:fixed image, and APZ is enabled,
     // async scrolling could reveal additional areas of the image, so don't
     // clip it beyond clipping to the document's viewport.
     if (Maybe<nsRect> viewportRect = GetViewportRectRelativeToReferenceFrame(aBuilder, mFrame)) {
       clipRect = clipRect.Union(*viewportRect);
     }
   }
   const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mImage.mLayers[mLayer];
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -2748,26 +2748,48 @@ private:
 /**
  * A display item to paint one background-image for a frame. Each background
  * image layer gets its own nsDisplayBackgroundImage.
  */
 class nsDisplayBackgroundImage : public nsDisplayImageContainer {
 public:
   typedef mozilla::StyleGeometryBox StyleGeometryBox;
 
+  struct InitData {
+    nsDisplayListBuilder* builder;
+    nsIFrame* frame;
+    const nsStyleBackground* backgroundStyle;
+    nsCOMPtr<imgIContainer> image;
+    nsRect backgroundRect;
+    nsRect fillArea;
+    nsRect destArea;
+    uint32_t layer;
+    bool isRasterImage;
+    bool shouldFixToViewport;
+  };
+
   /**
    * aLayer signifies which background layer this item represents.
    * aIsThemed should be the value of aFrame->IsThemed.
    * aBackgroundStyle should be the result of
    * nsCSSRendering::FindBackground, or null if FindBackground returned false.
    * aBackgroundRect is relative to aFrame.
    */
-  nsDisplayBackgroundImage(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
-                           uint32_t aLayer, const nsRect& aBackgroundRect,
-                           const nsStyleBackground* aBackgroundStyle);
+  enum class LayerizeFixed : uint8_t {
+    ALWAYS_LAYERIZE_FIXED_BACKGROUND,
+    DO_NOT_LAYERIZE_FIXED_BACKGROUND_IF_AVOIDING_COMPONENT_ALPHA_LAYERS
+  };
+  static InitData GetInitData(nsDisplayListBuilder* aBuilder,
+                              nsIFrame* aFrame,
+                              uint32_t aLayer,
+                              const nsRect& aBackgroundRect,
+                              const nsStyleBackground* aBackgroundStyle,
+                              LayerizeFixed aLayerizeFixed);
+
+  explicit nsDisplayBackgroundImage(const InitData& aInitData);
   virtual ~nsDisplayBackgroundImage();
 
   // This will create and append new items for all the layers of the
   // background. Returns whether we appended a themed background.
   // aAllowWillPaintBorderOptimization should usually be left at true, unless
   // aFrame has special border drawing that causes opaque borders to not
   // actually be opaque.
   static bool AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuilder,
@@ -2830,27 +2852,24 @@ public:
   virtual already_AddRefed<imgIContainer> GetImage() override;
   virtual nsRect GetDestRect() override;
 
   static nsRegion GetInsideClipRegion(nsDisplayItem* aItem,
                                       StyleGeometryBox aClip,
                                       const nsRect& aRect,
                                       const nsRect& aBackgroundRect);
 
-  virtual bool ShouldFixToViewport(nsDisplayListBuilder* aBuilder) override;
+  virtual bool ShouldFixToViewport(nsDisplayListBuilder* aBuilder) override { return mShouldFixToViewport; }
 
 protected:
   typedef class mozilla::layers::ImageContainer ImageContainer;
   typedef class mozilla::layers::ImageLayer ImageLayer;
 
   bool TryOptimizeToImageLayer(LayerManager* aManager, nsDisplayListBuilder* aBuilder);
-  bool IsNonEmptyFixedImage() const;
   nsRect GetBoundsInternal(nsDisplayListBuilder* aBuilder);
-  bool ShouldTreatAsFixed() const;
-  bool ComputeShouldTreatAsFixed(bool isTransformedFixed) const;
 
   void PaintInternal(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx,
                      const nsRect& aBounds, nsRect* aClipRect);
 
   // Determine whether we want to be separated into our own layer, independent
   // of whether this item can actually be layerized.
   enum ImageLayerization {
     WHENEVER_POSSIBLE,
@@ -2867,17 +2886,17 @@ protected:
   nsRect mBackgroundRect; // relative to the reference frame
   nsRect mFillRect;
   nsRect mDestRect;
   /* Bounds of this display item */
   nsRect mBounds;
   uint32_t mLayer;
   bool mIsRasterImage;
   /* Whether the image should be treated as fixed to the viewport. */
-  bool mShouldTreatAsFixed;
+  bool mShouldFixToViewport;
 };
 
 
 /**
  * A display item to paint the native theme background for a frame.
  */
 class nsDisplayThemedBackground : public nsDisplayItem {
 public: