From c5fb5cdd951676035db188182bf3069af5f5df44 Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Fri, 12 Feb 2016 20:24:38 -0500 Subject: [PATCH] Bug 1247452 - Use the effective visible region rather than the visible region where appropriate in the compositor. r=mattwoodrow MozReview-Commit-ID: 6wbe0kUWh9h --HG-- extra : rebase_source : 1263fcf02beb41bd8f7c6d6556b629f772fd955a --- gfx/layers/LayerTreeInvalidation.cpp | 10 +++++----- gfx/layers/Layers.cpp | 9 +++++++-- gfx/layers/composite/AsyncCompositionManager.cpp | 2 +- gfx/layers/ipc/CompositorParent.cpp | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/gfx/layers/LayerTreeInvalidation.cpp b/gfx/layers/LayerTreeInvalidation.cpp index 778f73ed3eaa..f554caa7af80 100644 --- a/gfx/layers/LayerTreeInvalidation.cpp +++ b/gfx/layers/LayerTreeInvalidation.cpp @@ -123,7 +123,7 @@ NotifySubdocumentInvalidationRecursive(Layer* aLayer, NotifySubDocInvalidationFu NotifySubdocumentInvalidationRecursive(child, aCallback); } - aCallback(container, container->GetVisibleRegion().ToUnknownRegion()); + aCallback(container, container->GetLocalVisibleRegion().ToUnknownRegion()); } struct LayerPropertiesBase : public LayerProperties @@ -233,7 +233,7 @@ struct LayerPropertiesBase : public LayerProperties virtual IntRect NewTransformedBounds() { - return TransformRect(mLayer->GetVisibleRegion().ToUnknownRegion().GetBounds(), + return TransformRect(mLayer->GetLocalVisibleRegion().ToUnknownRegion().GetBounds(), GetTransformForInvalidation(mLayer)); } @@ -345,7 +345,7 @@ struct ContainerLayerProperties : public LayerPropertiesBase } if (invalidateChildsCurrentArea) { aGeometryChanged = true; - AddTransformedRegion(result, child->GetVisibleRegion().ToUnknownRegion(), + AddTransformedRegion(result, child->GetLocalVisibleRegion().ToUnknownRegion(), GetTransformForInvalidation(child)); if (aCallback) { NotifySubdocumentInvalidationRecursive(child, aCallback); @@ -477,7 +477,7 @@ struct ImageLayerProperties : public LayerPropertiesBase { ImageLayer* imageLayer = static_cast(mLayer.get()); - if (!imageLayer->GetVisibleRegion().ToUnknownRegion().IsEqual(mVisibleRegion)) { + if (!imageLayer->GetLocalVisibleRegion().ToUnknownRegion().IsEqual(mVisibleRegion)) { aGeometryChanged = true; IntRect result = NewTransformedBounds(); result = result.Union(OldTransformedBounds()); @@ -619,7 +619,7 @@ LayerPropertiesBase::ComputeDifferences(Layer* aRoot, NotifySubDocInvalidationFu } else { ClearInvalidations(aRoot); } - IntRect result = TransformRect(aRoot->GetVisibleRegion().ToUnknownRegion().GetBounds(), + IntRect result = TransformRect(aRoot->GetLocalVisibleRegion().ToUnknownRegion().GetBounds(), aRoot->GetLocalTransform()); result = result.Union(OldTransformedBounds()); if (aGeometryChanged != nullptr) { diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index c383d1af3571..040c683e0909 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -799,6 +799,11 @@ Layer::CalculateScissorRect(const RenderTargetIntRect& aCurrentScissorRect) // When our visible region is empty, our parent may not have created the // intermediate surface that we would require for correct clipping; however, // this does not matter since we are invisible. + // Note that we do not use GetLocalVisibleRegion(), because that can be + // empty for a layer whose rendered contents have been async-scrolled + // completely offscreen, but for which we still need to draw a + // checkerboarding backround color, and calculating an empty scissor rect + // for such a layer would prevent that (see bug 1247452 comment 10). return RenderTargetIntRect(currentClip.TopLeft(), RenderTargetIntSize(0, 0)); } @@ -1301,7 +1306,7 @@ ContainerLayer::HasMultipleChildren() const Maybe& clipRect = child->GetEffectiveClipRect(); if (clipRect && clipRect->IsEmpty()) continue; - if (child->GetVisibleRegion().IsEmpty()) + if (child->GetLocalVisibleRegion().IsEmpty()) continue; ++count; if (count > 1) @@ -1417,7 +1422,7 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const Matrix4x4& aTransformToS * the calculations performed by CalculateScissorRect above. * Nor for a child with a mask layer. */ - if (checkClipRect && (clipRect && !clipRect->IsEmpty() && !child->GetVisibleRegion().IsEmpty())) { + if (checkClipRect && (clipRect && !clipRect->IsEmpty() && !child->GetLocalVisibleRegion().IsEmpty())) { useIntermediateSurface = true; break; } diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index e44d5e23eeea..c56bc85d659d 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -83,7 +83,7 @@ WalkTheTree(Layer* aLayer, aHasRemote = true; if (const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(ref->GetReferentId())) { if (Layer* referent = state->mRoot) { - if (!ref->GetVisibleRegion().IsEmpty()) { + if (!ref->GetLocalVisibleRegion().IsEmpty()) { dom::ScreenOrientationInternal chromeOrientation = aTargetConfig.orientation(); dom::ScreenOrientationInternal contentOrientation = state->mTargetConfig.orientation(); if (!IsSameDimension(chromeOrientation, contentOrientation) && diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index f521fd346acc..236bed690480 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -887,7 +887,7 @@ CompositorParent::Invalidate() { if (mLayerManager && mLayerManager->GetRoot()) { mLayerManager->AddInvalidRegion( - mLayerManager->GetRoot()->GetVisibleRegion().ToUnknownRegion().GetBounds()); + mLayerManager->GetRoot()->GetLocalVisibleRegion().ToUnknownRegion().GetBounds()); } }