Bug 1368386 - Add PaintedLayer::InvalidateWholeLayer(). r?mattwoodrow
MozReview-Commit-ID: 7sgQDs82Wwt
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -2000,16 +2000,21 @@ public:
Mutated();
}
/**
* Can be used anytime
*/
const nsIntRegion& GetValidRegion() const { return mValidRegion; }
+ void InvalidateWholeLayer()
+ {
+ InvalidateRegion(GetValidRegion().GetBounds());
+ }
+
virtual PaintedLayer* AsPaintedLayer() override { return this; }
MOZ_LAYER_DECL_NAME("PaintedLayer", TYPE_PAINTED)
virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override
{
gfx::Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface;
gfx::Matrix residual;
--- a/layout/painting/FrameLayerBuilder.cpp
+++ b/layout/painting/FrameLayerBuilder.cpp
@@ -2268,18 +2268,17 @@ ResetScrollPositionForLayerPixelAlignmen
static void
InvalidateEntirePaintedLayer(PaintedLayer* aLayer, AnimatedGeometryRoot* aAnimatedGeometryRoot, const char *aReason)
{
#ifdef MOZ_DUMP_PAINTING
if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
printf_stderr("Invalidating entire layer %p: %s\n", aLayer, aReason);
}
#endif
- nsIntRect invalidate = aLayer->GetValidRegion().GetBounds();
- aLayer->InvalidateRegion(invalidate);
+ aLayer->InvalidateWholeLayer();
aLayer->SetInvalidRectToVisibleRegion();
ResetScrollPositionForLayerPixelAlignment(aAnimatedGeometryRoot);
}
LayerManager::PaintedLayerCreationHint
ContainerState::GetLayerCreationHint(AnimatedGeometryRoot* aAnimatedGeometryRoot)
{
// Check whether the layer will be scrollable. This is used as a hint to
@@ -3201,17 +3200,17 @@ void ContainerState::FinishPaintedLayerD
newLayerEntry->mClipChain = paintedLayerEntry->mClipChain;
newLayerEntry->mScrollMetadataASR = paintedLayerEntry->mScrollMetadataASR;
// Hide the PaintedLayer. We leave it in the layer tree so that we
// can find and recycle it later.
ParentLayerIntRect emptyRect;
data->mLayer->SetClipRect(Some(emptyRect));
data->mLayer->SetVisibleRegion(LayerIntRegion());
- data->mLayer->InvalidateRegion(data->mLayer->GetValidRegion().GetBounds());
+ data->mLayer->InvalidateWholeLayer();
data->mLayer->SetEventRegions(EventRegions());
for (auto& item : data->mAssignedDisplayItems) {
mLayerBuilder->StoreOptimizedLayerForFrame(item.mItem, layer);
}
}
}
@@ -3267,17 +3266,17 @@ void ContainerState::FinishPaintedLayerD
if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
printf_stderr("Forced background color has changed from #%08X to #%08X on layer %p\n",
userData->mForcedBackgroundColor, backgroundColor, data->mLayer);
nsAutoCString str;
AppendToString(str, data->mLayer->GetValidRegion());
printf_stderr("Invalidating layer %p: %s\n", data->mLayer, str.get());
}
#endif
- data->mLayer->InvalidateRegion(data->mLayer->GetValidRegion());
+ data->mLayer->InvalidateWholeLayer();
}
userData->mForcedBackgroundColor = backgroundColor;
userData->mFontSmoothingBackgroundColor = data->mFontSmoothingBackgroundColor;
// use a mask layer for rounded rect clipping.
// data->mCommonClipCount may be -1 if we haven't put any actual
// drawable items in this layer (i.e. it's only catching events).
@@ -6346,17 +6345,17 @@ ContainerState::SetupMaskLayer(Layer *aL
{
// if the number of clips we are going to mask has decreased, then aLayer might have
// cached graphics which assume the existence of a soon-to-be non-existent mask layer
// in that case, invalidate the whole layer.
PaintedDisplayItemLayerUserData* paintedData = GetPaintedDisplayItemLayerUserData(aLayer);
if (paintedData &&
aRoundedRectClipCount < paintedData->mMaskClipCount) {
PaintedLayer* painted = aLayer->AsPaintedLayer();
- painted->InvalidateRegion(painted->GetValidRegion().GetBounds());
+ painted->InvalidateWholeLayer();
}
// don't build an unnecessary mask
if (aClip.GetRoundedRectCount() == 0 ||
aRoundedRectClipCount == 0) {
SetClipCount(paintedData, 0);
return;
}