tor-browser

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

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

Bug 1730749 - Introduce ActiveScrolledRoot::GetStickyASRForFrame(). r=mstange

This allows sticky display items to look up their sticky ASR
(which may not be the same as their own mActiveScrolledRoot)
without that being stored separately on the display item.

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

Diffstat:
Mlayout/painting/nsDisplayList.cpp | 7+++++++
Mlayout/painting/nsDisplayList.h | 7+++++++
2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp @@ -274,6 +274,13 @@ ActiveScrolledRoot::GetNearestScrollASRViewId() const { } /* static */ +const ActiveScrolledRoot* ActiveScrolledRoot::GetStickyASRFromFrame( + nsIFrame* aStickyFrame) { + return aStickyFrame->FirstContinuation()->GetProperty( + StickyActiveScrolledRootCache()); +} + +/* static */ nsCString ActiveScrolledRoot::ToString( const ActiveScrolledRoot* aActiveScrolledRoot) { nsAutoCString str; diff --git a/layout/painting/nsDisplayList.h b/layout/painting/nsDisplayList.h @@ -239,6 +239,13 @@ struct ActiveScrolledRoot { // return the null scroll id. layers::ScrollableLayerGuid::ViewID GetNearestScrollASRViewId() const; + // Return the ASR of kind ASRKind::Sticky corresponding to a sticky frame. + // Returns null if |aStickyFrame| is not a sticky frame, or if + // CreateASRForStickyFrame has not yet been called for it or its first + // continuation. + static const ActiveScrolledRoot* GetStickyASRFromFrame( + nsIFrame* aStickyFrame); + enum class ASRKind { Root, Scroll, Sticky }; RefPtr<const ActiveScrolledRoot> mParent;