tor-browser

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

commit 06c81d279021fa93a04f3b347899bd378bb1c5a6
parent 49cad6474205d4aa20122884c666fdba9b752a9a
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date:   Thu,  2 Oct 2025 18:46:08 +0000

Bug 1986711 - More explicitly disable menupopup frame hypothetical position. r=layout-reviewers,dshin

Menupopups don't get positioned using the usual rules, so they don't
need to compute their hypothetical position even when open.

Long term we should do this for all top layer frames but I don't want to
change behavior in this patch.

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

Diffstat:
Mlayout/generic/AbsoluteContainingBlock.cpp | 34++++++++++++++++++++++++----------
1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/layout/generic/AbsoluteContainingBlock.cpp b/layout/generic/AbsoluteContainingBlock.cpp @@ -950,17 +950,31 @@ void AbsoluteContainingBlock::ReflowAbsoluteFrame( nscoord availISize = logicalCBSize.ISize(wm); ReflowInput::InitFlags initFlags; - if (aFlags.contains(AbsPosReflowFlag::IsGridContainerCB)) { - // When a grid container generates the abs.pos. CB for a *child* then - // the static position is determined via CSS Box Alignment within the - // abs.pos. CB (a grid area, i.e. a piece of the grid). In this scenario, - // due to the multiple coordinate spaces in play, we use a convenience - // flag to simply have the child's ReflowInput give it a static position - // at its abs.pos. CB origin, and then we'll align & offset it from there. - nsIFrame* placeholder = aKidFrame->GetPlaceholderFrame(); - if (placeholder && placeholder->GetParent() == aDelegatingFrame) { - initFlags += ReflowInput::InitFlag::StaticPosIsCBOrigin; + const bool staticPosIsCBOrigin = [&] { + if (aFlags.contains(AbsPosReflowFlag::IsGridContainerCB)) { + // When a grid container generates the abs.pos. CB for a *child* then + // the static position is determined via CSS Box Alignment within the + // abs.pos. CB (a grid area, i.e. a piece of the grid). In this scenario, + // due to the multiple coordinate spaces in play, we use a convenience + // flag to simply have the child's ReflowInput give it a static position + // at its abs.pos. CB origin, and then we'll align & offset it from there. + nsIFrame* placeholder = aKidFrame->GetPlaceholderFrame(); + if (placeholder && placeholder->GetParent() == aDelegatingFrame) { + return true; + } + } + if (aKidFrame->IsMenuPopupFrame()) { + // Popups never use their static pos. + return true; } + // TODO(emilio): Either reparent the top layer placeholder frames to the + // viewport, or return true here for top layer frames more generally (not + // only menupopups), see https://github.com/w3c/csswg-drafts/issues/8040. + return false; + }(); + + if (staticPosIsCBOrigin) { + initFlags += ReflowInput::InitFlag::StaticPosIsCBOrigin; } const bool kidFrameMaySplit =