tor-browser

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

commit ac91e523f08afd00e736279e71209a736dfd943b
parent f68beae024ff76f9f4c051ae1edec49fe8cea484
Author: Timothy Nikkel <tnikkel@gmail.com>
Date:   Thu, 23 Oct 2025 03:16:43 +0000

Bug 1995752. Make the async scrollable ancestor of fixed pos more consistent if there is no root scroll frame. r=botond

This is an edge case just to make sure things are handled in a consistent manner, it came up while working on anchor pos and making sure everything was sound.

There are still cases where we don't construct a root scroll frame, see https://searchfox.org/firefox-main/rev/a5316cedc669bcec09efae23521e0af6b9d3d257/layout/base/nsCSSFrameConstructor.cpp#2691 and the following code.

If we happen to have fixed pos in that case I think it makes more sense to continue looking for an async scrollable ancestor then returning null. For example we could have a parent doc and a scroll frame in the parent doc would then scroll this fixed pos. The parent frame of fixed pos is the viewport, so we'll go almost directly to the parent doc after this.

For example for how this would be more consistent, say we have a doc with no root scroll frame, and we have some fixed and nonfixed content in it, and a parent doc with a root scroll frame. Before this patch the asr of the fixed content would be null, the asr of the nonfixed content would be the root scrol frame of the parent doc. After this patch the asr of both would be the root scroll frame for the parent doc.

Making this consistent means that if two frames have the same scroll frame (of any type, not just async scrollable) then they will have the same async scrollable scrollframe as well. Which is the situation that I wanted to ensure true for anchor pos.

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

Diffstat:
Mlayout/base/nsLayoutUtils.cpp | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp @@ -1389,7 +1389,9 @@ static nsIFrame* GetNearestScrollableOrOverflowClipFrame( if ((aFlags & nsLayoutUtils::SCROLLABLE_FIXEDPOS_FINDS_ROOT) && f->StyleDisplay()->mPosition == StylePositionProperty::Fixed && nsLayoutUtils::IsReallyFixedPos(f)) { - return f->PresShell()->GetRootScrollContainerFrame(); + if (nsIFrame* root = f->PresShell()->GetRootScrollContainerFrame()) { + return root; + } } } return nullptr;