Bug 818643. Issue an NotifyRenderingChanged callback on nsDisplayItems when we invalidate anything to do with the display item. Make nsDisplayCanvasBackground override NotifyRenderingChanged to invalidate the cached background image. r=mattwoodrow

--HG--
extra : rebase_source : c28b2804d647a991f7d2cb8167fcf039c1835d75
This commit is contained in:
Robert O'Callahan 2012-12-10 18:34:31 +13:00
parent db76bf8271
commit dbadcb07b6
6 changed files with 17 additions and 10 deletions

View File

@ -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));

View File

@ -856,6 +856,16 @@ public:
}
}
/**
* 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

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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

View File

@ -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)