diff --git a/gfx/layers/wr/StackingContextHelper.cpp b/gfx/layers/wr/StackingContextHelper.cpp index 20c63c91860d..1c790e5761ae 100644 --- a/gfx/layers/wr/StackingContextHelper.cpp +++ b/gfx/layers/wr/StackingContextHelper.cpp @@ -74,10 +74,10 @@ StackingContextHelper::ToRelativeLayoutRect(const LayoutDeviceRect& aRect) const return wr::ToLayoutRect(rect); } -gfx::Matrix4x4 +const Maybe& StackingContextHelper::GetTransformForScrollData() const { - return mTransformForScrollData.valueOr(gfx::Matrix4x4()); + return mTransformForScrollData; } } // namespace layers diff --git a/gfx/layers/wr/StackingContextHelper.h b/gfx/layers/wr/StackingContextHelper.h index 6e5111188908..1ec06cc6fd28 100644 --- a/gfx/layers/wr/StackingContextHelper.h +++ b/gfx/layers/wr/StackingContextHelper.h @@ -75,7 +75,7 @@ public: return mInheritedTransform; } - gfx::Matrix4x4 GetTransformForScrollData() const; + const Maybe& GetTransformForScrollData() const; bool AffectsClipPositioning() const { return mAffectsClipPositioning; } diff --git a/gfx/layers/wr/WebRenderCommandBuilder.cpp b/gfx/layers/wr/WebRenderCommandBuilder.cpp index 9535ca4ed397..6fb5761dc1bb 100644 --- a/gfx/layers/wr/WebRenderCommandBuilder.cpp +++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp @@ -1313,8 +1313,8 @@ WebRenderCommandBuilder::CreateWebRenderCommandsFromDisplayList(nsDisplayList* a int32_t descendants = mLayerScrollData.size() - layerCountBeforeRecursing; mLayerScrollData.emplace_back(); - mLayerScrollData.back().Initialize(mManager->GetScrollData(), item, descendants, stopAtAsr); - mLayerScrollData.back().SetTransform(aSc.GetTransformForScrollData()); + mLayerScrollData.back().Initialize(mManager->GetScrollData(), item, + descendants, stopAtAsr, aSc.GetTransformForScrollData()); } else if (mLayerScrollData.size() != layerCountBeforeRecursing && !eventRegions.IsEmpty()) { // We are not forcing a new layer for |item|, but we did create some diff --git a/gfx/layers/wr/WebRenderScrollData.cpp b/gfx/layers/wr/WebRenderScrollData.cpp index 70720677138c..1dffb32ee60b 100644 --- a/gfx/layers/wr/WebRenderScrollData.cpp +++ b/gfx/layers/wr/WebRenderScrollData.cpp @@ -42,7 +42,8 @@ void WebRenderLayerScrollData::Initialize(WebRenderScrollData& aOwner, nsDisplayItem* aItem, int32_t aDescendantCount, - const ActiveScrolledRoot* aStopAtAsr) + const ActiveScrolledRoot* aStopAtAsr, + const Maybe& aTransform) { MOZ_ASSERT(aDescendantCount >= 0); // Ensure value is valid MOZ_ASSERT(mDescendantCount == -1); // Don't allow re-setting an already set value @@ -50,6 +51,11 @@ WebRenderLayerScrollData::Initialize(WebRenderScrollData& aOwner, MOZ_ASSERT(aItem); aItem->UpdateScrollData(&aOwner, this); + if (aTransform) { + // mTransform might have been set by the UpdateScrollData call above, so + // we should combine rather than clobber + mTransform = *aTransform * mTransform; + } for (const ActiveScrolledRoot* asr = aItem->GetActiveScrolledRoot(); asr && asr != aStopAtAsr; asr = asr->mParent) { diff --git a/gfx/layers/wr/WebRenderScrollData.h b/gfx/layers/wr/WebRenderScrollData.h index 6d0f5a5d942a..99ede480bcb3 100644 --- a/gfx/layers/wr/WebRenderScrollData.h +++ b/gfx/layers/wr/WebRenderScrollData.h @@ -47,7 +47,8 @@ public: void Initialize(WebRenderScrollData& aOwner, nsDisplayItem* aItem, int32_t aDescendantCount, - const ActiveScrolledRoot* aStopAtAsr); + const ActiveScrolledRoot* aStopAtAsr, + const Maybe& aTransform); int32_t GetDescendantCount() const; size_t GetScrollMetadataCount() const;