diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 52122e71264..309629e917d 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -2348,6 +2348,7 @@ ContainerState::InvalidateForLayerChange(nsDisplayItem* aItem, GetTranslationForThebesLayer(newThebesLayer)); } } + aItem->NotifyRenderingChanged(); return; } if (!aNewLayer) { @@ -2410,6 +2411,7 @@ ContainerState::InvalidateForLayerChange(nsDisplayItem* aItem, #endif } if (!combined.IsEmpty()) { + aItem->NotifyRenderingChanged(); InvalidatePostTransformRegion(newThebesLayer, combined.ScaleToOutsidePixels(data->mXScale, data->mYScale, mAppUnitsPerDevPixel), GetTranslationForThebesLayer(newThebesLayer)); diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 9ca543af938..0be68799def 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -855,7 +855,17 @@ public: aInvalidRegion->Or(GetBounds(aBuilder, &snap), geometry->mBounds); } } - + + /** + * Called when the area rendered by this display item has changed (been + * invalidated or changed geometry) since the last paint. This includes + * when the display item was not rendered at all in the last paint. + * It does NOT get called when a display item was being rendered and no + * longer is, because generally that means there is no display item to + * call this method on. + */ + virtual void NotifyRenderingChanged() {} + /** * @param aSnap set to true if the edges of the rectangles of the opaque * region would be snapped to device pixels when drawing diff --git a/layout/generic/nsCanvasFrame.cpp b/layout/generic/nsCanvasFrame.cpp index 51da20609b4..e54f61066d3 100644 --- a/layout/generic/nsCanvasFrame.cpp +++ b/layout/generic/nsCanvasFrame.cpp @@ -239,7 +239,6 @@ nsDisplayCanvasBackground::Paint(nsDisplayListBuilder* aBuilder, BlitSurface(dest, destRect, surf); GetUnderlyingFrame()->Properties().Set(nsIFrame::CachedBackgroundImage(), surf.forget().get()); - GetUnderlyingFrame()->AddStateBits(NS_FRAME_HAS_CACHED_BACKGROUND); } } diff --git a/layout/generic/nsCanvasFrame.h b/layout/generic/nsCanvasFrame.h index 391faf95205..96cf22ba707 100644 --- a/layout/generic/nsCanvasFrame.h +++ b/layout/generic/nsCanvasFrame.h @@ -181,6 +181,10 @@ public: mBackgroundStyle->mLayers[mLayer].mAttachment == NS_STYLE_BG_ATTACHMENT_FIXED && !mBackgroundStyle->mLayers[mLayer].mImage.IsEmpty(); } + virtual void NotifyRenderingChanged() MOZ_OVERRIDE + { + mFrame->Properties().Delete(nsIFrame::CachedBackgroundImage()); + } virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) MOZ_OVERRIDE; diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index f6d1ee728dc..874f1da36d9 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -4867,10 +4867,6 @@ static void InvalidateFrameInternal(nsIFrame *aFrame, bool aHasDisplayItem = tru aFrame->Properties().Delete(nsIFrame::InvalidationRect()); aFrame->RemoveStateBits(NS_FRAME_HAS_INVALID_RECT); } - if (aFrame->HasAnyStateBits(NS_FRAME_HAS_CACHED_BACKGROUND)) { - aFrame->Properties().Delete(nsIFrame::CachedBackgroundImage()); - aFrame->RemoveStateBits(NS_FRAME_HAS_CACHED_BACKGROUND); - } } void diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index cde3cefcb76..55a1d25ab5c 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -296,10 +296,6 @@ typedef uint64_t nsFrameState; // the frames for future reference. #define NS_FRAME_NO_COMPONENT_ALPHA NS_FRAME_STATE_BIT(45) -// Frame has a cached rasterization of anV -// nsDisplayBackground display item -#define NS_FRAME_HAS_CACHED_BACKGROUND NS_FRAME_STATE_BIT(46) - // The frame is a descendant of nsSVGTextFrame2 and is thus used for SVG // text layout. #define NS_FRAME_IS_SVG_TEXT NS_FRAME_STATE_BIT(47)