tor-browser

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

commit 834918e43e386947cdaae2e5b93d5b96f51f7232
parent 2b0a69fb37e3a360ca89497ce8bd3cfef15c9bc2
Author: Ting-Yu Lin <tlin@mozilla.com>
Date:   Tue, 11 Nov 2025 18:03:02 +0000

Bug 1999366 - Use block frame's writing-mode to construct absolute containing block rect. r=layout-reviewers,dholbert

The motivation is:
1. The `parentWM` is misleading, because the parent frame can create
   `ReflowOutput` with this block frame's writing-mode, e.g. flex container did
   this [1].

2. If this block frame is fragmented, to get the correct cb rect, we'll have to
   apply the skip side for the border, which operates on this block's
   writing-mode. This will be done in bug 1994083.

3. This does not change behavior, because we only use physical `containingBlock`
   as the parameter to `AbsoluteContainingBlock::Reflow()`.

[1] https://searchfox.org/firefox-main/rev/931471037b8a4f16ce3ccfa864310540cac255c1/layout/generic/nsFlexContainerFrame.cpp#6431

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

Diffstat:
Mlayout/generic/nsBlockFrame.cpp | 10++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp @@ -1645,7 +1645,6 @@ void nsBlockFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics, // resetting the size. Because of this, we must not reflow our abs-pos // children in that situation --- what we think is our "new size" will not be // our real new size. This also happens to be more efficient. - WritingMode parentWM = aMetrics.GetWritingMode(); if (HasAbsolutelyPositionedChildren()) { AbsoluteContainingBlock* absoluteContainer = GetAbsoluteContainingBlock(); bool haveInterrupt = aPresContext->HasPendingInterrupt(); @@ -1695,9 +1694,8 @@ void nsBlockFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics, aMetrics.Height() != oldSize.height; const LogicalRect containingBlock = [&]() { - LogicalRect rect{parentWM, LogicalPoint{parentWM}, - aMetrics.Size(parentWM)}; - rect.Deflate(parentWM, aReflowInput.ComputedLogicalBorder(parentWM)); + LogicalRect rect(wm, LogicalPoint(wm), aMetrics.Size(wm)); + rect.Deflate(wm, aReflowInput.ComputedLogicalBorder(wm)); return rect; }(); AbsPosReflowFlags flags{AbsPosReflowFlag::AllowFragmentation}; @@ -1713,8 +1711,8 @@ void nsBlockFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics, SetupLineCursorForQuery(); absoluteContainer->Reflow( this, aPresContext, aReflowInput, reflowStatus, - containingBlock.GetPhysicalRect(parentWM, aMetrics.PhysicalSize()), - flags, &aMetrics.mOverflowAreas); + containingBlock.GetPhysicalRect(wm, aMetrics.PhysicalSize()), flags, + &aMetrics.mOverflowAreas); } }