diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index 6cb6a0874fd6..23263f7a8e89 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -810,19 +810,23 @@ MoveScrollbarForLayerMargin(Layer* aRoot, FrameMetrics::ViewID aRootScrollId, bool AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer, - bool* aOutFoundRoot, - ClipPartsCache& aClipPartsCache) + bool* aOutFoundRoot) { bool appliedTransform = false; std::stack> stackDeferredClips; + // Maps layers to their ClipParts. The parts are not stored individually + // on the layer, but during AlignFixedAndStickyLayers we need access to + // the individual parts for descendant layers. + ClipPartsCache clipPartsCache; + ForEachNode( aLayer, [&stackDeferredClips] (Layer* layer) { stackDeferredClips.push(Maybe()); }, - [this, &aOutFoundRoot, &stackDeferredClips, &appliedTransform, &aClipPartsCache] (Layer* layer) + [this, &aOutFoundRoot, &stackDeferredClips, &appliedTransform, &clipPartsCache] (Layer* layer) { Maybe clipDeferredFromChildren = stackDeferredClips.top(); stackDeferredClips.pop(); @@ -851,7 +855,7 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer, // composite. // The final shadow clip for the layer is the intersection of the (possibly // adjusted) fixed clip and the scrolled clip. - ClipParts& clipParts = aClipPartsCache[layer]; + ClipParts& clipParts = clipPartsCache[layer]; clipParts.mFixedClip = layer->GetClipRect(); clipParts.mScrolledClip = layer->GetScrolledClipRect(); @@ -958,10 +962,10 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer, if (!scrollMetadata.UsesContainerScrolling()) { MOZ_ASSERT(asyncTransform.Is2D()); if (clipParts.mFixedClip) { - clipParts.mFixedClip = Some(TransformBy(asyncTransform, *clipParts.mFixedClip)); + *clipParts.mFixedClip = TransformBy(asyncTransform, *clipParts.mFixedClip); } if (clipParts.mScrolledClip) { - clipParts.mScrolledClip = Some(TransformBy(asyncTransform, *clipParts.mScrolledClip)); + *clipParts.mScrolledClip = TransformBy(asyncTransform, *clipParts.mScrolledClip); } } // Note: we don't set the layer's shadow clip rect property yet; @@ -982,11 +986,9 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer, * CompleteAsyncTransform( AdjustForClip(asyncTransformWithoutOverscroll, layer)); - // Since fixed/sticky layers are relative to their nearest scrolling ancestor, - // we use the ViewID from the bottommost scrollable metrics here. AlignFixedAndStickyLayers(layer, metrics.GetScrollId(), oldTransform, transformWithoutOverscrollOrOmta, fixedLayerMargins, - &aClipPartsCache); + &clipPartsCache); // Combine the local clip with the ancestor scrollframe clip. This is not // included in the async transform above, since the ancestor clip should not @@ -1459,12 +1461,6 @@ AsyncCompositionManager::TransformShadowTree(TimeStamp aCurrentFrame, bool wantNextFrame = SampleAnimations(root, aCurrentFrame); if (!(aSkip & TransformsToSkip::APZ)) { - // Maps layers to their ClipParts during ApplyAsyncContentTransformToTree. - // The parts are not stored individually on the layer, but during - // AlignFixedAndStickyLayers we need access to the individual parts for - // descendant layers. - ClipPartsCache clipPartsCache; - // FIXME/bug 775437: unify this interface with the ~native-fennec // derived code // @@ -1477,7 +1473,7 @@ AsyncCompositionManager::TransformShadowTree(TimeStamp aCurrentFrame, // its own platform-specific async rendering that is done partially // in Gecko and partially in Java. bool foundRoot = false; - if (ApplyAsyncContentTransformToTree(root, &foundRoot, clipPartsCache)) { + if (ApplyAsyncContentTransformToTree(root, &foundRoot)) { #if defined(MOZ_ANDROID_APZ) MOZ_ASSERT(foundRoot); if (foundRoot && mFixedLayerMargins != ScreenMargin()) { diff --git a/gfx/layers/composite/AsyncCompositionManager.h b/gfx/layers/composite/AsyncCompositionManager.h index 308a6fa22c77..dc33d308c8b7 100644 --- a/gfx/layers/composite/AsyncCompositionManager.h +++ b/gfx/layers/composite/AsyncCompositionManager.h @@ -140,11 +140,8 @@ private: // one of the metrics on one of the layers was determined to be the "root" // and its state was synced to the Java front-end. |aOutFoundRoot| must be // non-null. - // |aClipPartsCache| is used to cache components of clips on descendant - // layers that may be needed while processing ancestor layers. bool ApplyAsyncContentTransformToTree(Layer* aLayer, - bool* aOutFoundRoot, - ClipPartsCache& aClipPartsCache); + bool* aOutFoundRoot); /** * Update the shadow transform for aLayer assuming that is a scrollbar, * so that it stays in sync with the content that is being scrolled by APZ.