tor-browser

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

commit 97ef6bc71f79bce9f26f1076f8df1667a07a577f
parent e83327ce2280e6c0f44f1ec4a752c91aaedc99ff
Author: Botond Ballo <botond@mozilla.com>
Date:   Thu, 13 Nov 2025 04:59:04 +0000

Bug 1730749 - Use a distinct frame property for sticky ASRs. r=mstange

A frame can be both a scroll frame and sticky, in which case it has
two associated ASRs. Using distinct frame properties allows retaining
information about both.

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

Diffstat:
Mlayout/painting/nsDisplayList.cpp | 9++++++---
Mlayout/painting/nsDisplayList.h | 5+++++
2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp @@ -200,7 +200,7 @@ ActiveScrolledRoot::CreateASRForStickyFrame(const ActiveScrolledRoot* aParent, bool aIsRetained) { RefPtr<ActiveScrolledRoot> asr; if (aIsRetained) { - asr = aStickyFrame->GetProperty(ActiveScrolledRootCache()); + asr = aStickyFrame->GetProperty(StickyActiveScrolledRootCache()); } if (!asr) { @@ -208,7 +208,8 @@ ActiveScrolledRoot::CreateASRForStickyFrame(const ActiveScrolledRoot* aParent, if (aIsRetained) { RefPtr<ActiveScrolledRoot> ref = asr; - aStickyFrame->SetProperty(ActiveScrolledRootCache(), ref.forget().take()); + aStickyFrame->SetProperty(StickyActiveScrolledRootCache(), + ref.forget().take()); } } @@ -311,7 +312,9 @@ ScrollableLayerGuid::ViewID ActiveScrolledRoot::ComputeViewId() const { ActiveScrolledRoot::~ActiveScrolledRoot() { if (mFrame && mRetained) { - mFrame->RemoveProperty(ActiveScrolledRootCache()); + mFrame->RemoveProperty(mKind == ASRKind::Sticky + ? StickyActiveScrolledRootCache() + : ActiveScrolledRootCache()); } } diff --git a/layout/painting/nsDisplayList.h b/layout/painting/nsDisplayList.h @@ -260,6 +260,11 @@ struct ActiveScrolledRoot { } NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(ActiveScrolledRootCache, ActiveScrolledRoot, DetachASR) + // We need a distinct frame property for storing the sticky ASR, + // because a single frame could be both a scroll frame and position:sticky + // and thus have two associated ASRs. + NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(StickyActiveScrolledRootCache, + ActiveScrolledRoot, DetachASR) static uint32_t Depth(const ActiveScrolledRoot* aActiveScrolledRoot) { return aActiveScrolledRoot ? aActiveScrolledRoot->mDepth : 0;