# HG changeset patch # User Kartikaya Gupta # Date 1516640430 18000 # Node ID 2254ae8cf040ca192e3748f6208ee4cd6d84122f # Parent b3e813cd555d501f0588de3bc5ef4a11d42c1354 Bug 1426386 - Expose WR stacking context bounds via StackingContextHelper. r=mstange MozReview-Commit-ID: AGFSq0wxxQi diff --git a/gfx/layers/wr/StackingContextHelper.cpp b/gfx/layers/wr/StackingContextHelper.cpp --- a/gfx/layers/wr/StackingContextHelper.cpp +++ b/gfx/layers/wr/StackingContextHelper.cpp @@ -17,16 +17,17 @@ StackingContextHelper::StackingContextHe , mScale(1.0f, 1.0f) { // mOrigin remains at 0,0 } StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParentSC, wr::DisplayListBuilder& aBuilder, const nsTArray& aFilters, + const LayoutDeviceRect& aBounds, const gfx::Matrix4x4* aBoundTransform, const wr::WrAnimationProperty* aAnimation, float* aOpacityPtr, gfx::Matrix4x4* aTransformPtr, gfx::Matrix4x4* aPerspectivePtr, const gfx::CompositionOp& aMixBlendMode, bool aBackfaceVisible, bool aIsPreserve3D) @@ -39,17 +40,17 @@ StackingContextHelper::StackingContextHe // Compute scale for fallback rendering. gfx::Matrix transform2d; if (aBoundTransform && aBoundTransform->CanDraw2D(&transform2d)) { mInheritedTransform = transform2d * aParentSC.mInheritedTransform; mScale = mInheritedTransform.ScaleFactors(true); } - mBuilder->PushStackingContext(wr::LayoutRect(), + mBuilder->PushStackingContext(wr::ToLayoutRect(aBounds), aAnimation, aOpacityPtr, aTransformPtr, aIsPreserve3D ? wr::TransformStyle::Preserve3D : wr::TransformStyle::Flat, aPerspectivePtr, wr::ToMixBlendMode(aMixBlendMode), aFilters, aBackfaceVisible); diff --git a/gfx/layers/wr/StackingContextHelper.h b/gfx/layers/wr/StackingContextHelper.h --- a/gfx/layers/wr/StackingContextHelper.h +++ b/gfx/layers/wr/StackingContextHelper.h @@ -25,16 +25,17 @@ namespace layers { * some of the coordinate space transformations needed. */ class MOZ_RAII StackingContextHelper { public: StackingContextHelper(const StackingContextHelper& aParentSC, wr::DisplayListBuilder& aBuilder, const nsTArray& aFilters = nsTArray(), + const LayoutDeviceRect& aBounds = LayoutDeviceRect(), const gfx::Matrix4x4* aBoundTransform = nullptr, const wr::WrAnimationProperty* aAnimation = nullptr, float* aOpacityPtr = nullptr, gfx::Matrix4x4* aTransformPtr = nullptr, gfx::Matrix4x4* aPerspectivePtr = nullptr, const gfx::CompositionOp& aMixBlendMode = gfx::CompositionOp::OP_OVER, bool aBackfaceVisible = true, bool aIsPreserve3D = false); diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -6690,17 +6690,17 @@ nsDisplayOpacity::CreateWebRenderCommand aManager->WrBridge()->AddWebRenderParentCommand(anim); aManager->AddActiveCompositorAnimationId(animationsId); } else if (animationsId) { aManager->AddCompositorAnimationsIdForDiscard(animationsId); animationsId = 0; } nsTArray filters; - StackingContextHelper sc(aSc, aBuilder, filters, nullptr, + StackingContextHelper sc(aSc, aBuilder, filters, LayoutDeviceRect(), nullptr, animationsId ? &prop : nullptr, opacityForSC); aManager->CommandBuilder().CreateWebRenderCommandsFromDisplayList(&mList, aDisplayListBuilder, sc, aBuilder, aResources); @@ -6744,18 +6744,19 @@ nsDisplayBlendMode::GetLayerState(nsDisp bool nsDisplayBlendMode::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder, mozilla::wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, mozilla::layers::WebRenderLayerManager* aManager, nsDisplayListBuilder* aDisplayListBuilder) { nsTArray filters; - StackingContextHelper sc(aSc, aBuilder, filters, nullptr, 0, nullptr, nullptr, - nullptr, nsCSSRendering::GetGFXBlendMode(mBlendMode)); + StackingContextHelper sc(aSc, aBuilder, filters, LayoutDeviceRect(), nullptr, + 0, nullptr, nullptr, nullptr, + nsCSSRendering::GetGFXBlendMode(mBlendMode)); return nsDisplayWrapList::CreateWebRenderCommands(aBuilder,aResources, sc, aManager, aDisplayListBuilder); } // nsDisplayBlendMode uses layers for rendering already_AddRefed nsDisplayBlendMode::BuildLayer(nsDisplayListBuilder* aBuilder, @@ -6988,17 +6989,17 @@ nsDisplayOwnLayer::CreateWebRenderComman mWrAnimationId = animationInfo.GetCompositorAnimationsId(); wr::WrAnimationProperty prop; prop.id = mWrAnimationId; prop.effect_type = wr::WrAnimationType::Transform; StackingContextHelper sc(aSc, aBuilder, nsTArray(), - nullptr, &prop); + LayoutDeviceRect(), nullptr, &prop); nsDisplayWrapList::CreateWebRenderCommands(aBuilder, aResources, sc, aManager, aDisplayListBuilder); return true; } bool nsDisplayOwnLayer::UpdateScrollData(mozilla::layers::WebRenderScrollData* aData, @@ -8512,16 +8513,17 @@ nsDisplayTransform::CreateWebRenderComma aManager->AddCompositorAnimationsIdForDiscard(animationsId); animationsId = 0; } nsTArray filters; StackingContextHelper sc(aSc, aBuilder, filters, + LayoutDeviceRect(), &newTransformMatrix, animationsId ? &prop : nullptr, nullptr, transformForSC, nullptr, gfx::CompositionOp::OP_OVER, !BackfaceIsHidden(), mFrame->Extend3DContext() && !mNoExtendContext); @@ -9126,16 +9128,17 @@ nsDisplayPerspective::CreateWebRenderCom 0); gfx::Matrix4x4 transformForSC = gfx::Matrix4x4::Translation(roundedOrigin); nsTArray filters; StackingContextHelper sc(aSc, aBuilder, filters, + LayoutDeviceRect(), nullptr, 0, nullptr, &transformForSC, &perspectiveMatrix, gfx::CompositionOp::OP_OVER, !BackfaceIsHidden(), true); @@ -9863,17 +9866,18 @@ nsDisplayFilter::CreateWebRenderCommands break; } default: return false; } } float opacity = mFrame->StyleEffects()->mOpacity; - StackingContextHelper sc(aSc, aBuilder, wrFilters, nullptr, 0, opacity != 1.0f && mHandleOpacity ? &opacity : nullptr); + StackingContextHelper sc(aSc, aBuilder, wrFilters, LayoutDeviceRect(), nullptr, + 0, opacity != 1.0f && mHandleOpacity ? &opacity : nullptr); nsDisplaySVGEffects::CreateWebRenderCommands(aBuilder, aResources, sc, aManager, aDisplayListBuilder); return true; } #ifdef MOZ_DUMP_PAINTING void nsDisplayFilter::PrintEffects(nsACString& aTo)