tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 99bf25deccb497e9f19d768adf74cf6b3ea16c91
parent a38172542774b7ea3565ee502109f10f9f480efe
Author: Botond Ballo <botond@mozilla.com>
Date:   Thu, 13 Nov 2025 04:59:05 +0000

Bug 1730749 - Allow the caller of DisplayListBuilder::DefineStickyFrame to specify the parent spatial id explicitly. r=mstange

The current implementation relies on mSpaceAndClipChain, but that assumes
WebRender display list building has actually entered the sticky display
item.

A later patch will move this call to earlier during WebRender display
list building (ClipManager), where we'll need to provide the parent
spatial id explicitly.

Differential Revision: https://phabricator.services.mozilla.com/D254150

Diffstat:
Mgfx/webrender_bindings/WebRenderAPI.cpp | 13+++++++------
Mgfx/webrender_bindings/WebRenderAPI.h | 1+
Mlayout/painting/nsDisplayList.cpp | 2+-
3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/gfx/webrender_bindings/WebRenderAPI.cpp b/gfx/webrender_bindings/WebRenderAPI.cpp @@ -1341,16 +1341,17 @@ wr::WrClipId DisplayListBuilder::DefineRectClip(Maybe<wr::WrSpatialId> aSpace, } wr::WrSpatialId DisplayListBuilder::DefineStickyFrame( - const wr::LayoutRect& aContentRect, const float* aTopMargin, - const float* aRightMargin, const float* aBottomMargin, - const float* aLeftMargin, const StickyOffsetBounds& aVerticalBounds, + Maybe<wr::WrSpatialId> aParentSpatialId, const wr::LayoutRect& aContentRect, + const float* aTopMargin, const float* aRightMargin, + const float* aBottomMargin, const float* aLeftMargin, + const StickyOffsetBounds& aVerticalBounds, const StickyOffsetBounds& aHorizontalBounds, const wr::LayoutVector2D& aAppliedOffset, wr::SpatialTreeItemKey aKey, const WrAnimationProperty* aAnimation) { auto spatialId = wr_dp_define_sticky_frame( - mWrState, mCurrentSpaceAndClipChain.space, aContentRect, aTopMargin, - aRightMargin, aBottomMargin, aLeftMargin, aVerticalBounds, - aHorizontalBounds, aAppliedOffset, aKey, aAnimation); + mWrState, aParentSpatialId.valueOr(mCurrentSpaceAndClipChain.space), + aContentRect, aTopMargin, aRightMargin, aBottomMargin, aLeftMargin, + aVerticalBounds, aHorizontalBounds, aAppliedOffset, aKey, aAnimation); WRDL_LOG("DefineSticky id=%zu c=%s t=%s r=%s b=%s l=%s v=%s h=%s a=%s\n", mWrState, spatialId.id, ToString(aContentRect).c_str(), diff --git a/gfx/webrender_bindings/WebRenderAPI.h b/gfx/webrender_bindings/WebRenderAPI.h @@ -615,6 +615,7 @@ class DisplayListBuilder final { wr::LayoutRect aClipRect); wr::WrSpatialId DefineStickyFrame( + Maybe<wr::WrSpatialId> aParentSpatialId, const wr::LayoutRect& aContentRect, const float* aTopMargin, const float* aRightMargin, const float* aBottomMargin, const float* aLeftMargin, const StickyOffsetBounds& aVerticalBounds, diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp @@ -6044,7 +6044,7 @@ bool nsDisplayStickyPosition::CreateWebRenderCommands( prop->effect_type = wr::WrAnimationType::Transform; } wr::WrSpatialId spatialId = aBuilder.DefineStickyFrame( - wr::ToLayoutRect(bounds), topMargin.ptrOr(nullptr), + Nothing(), wr::ToLayoutRect(bounds), topMargin.ptrOr(nullptr), rightMargin.ptrOr(nullptr), bottomMargin.ptrOr(nullptr), leftMargin.ptrOr(nullptr), vBounds, hBounds, applied, spatialKey, prop.ptrOr(nullptr));