tor-browser

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

commit 67f6d3d4c815c19fefd36279c97b6558f60ec5f5
parent 409386ac477042177283639c4d0d01b3c557328b
Author: Daniel Holbert <dholbert@cs.stanford.edu>
Date:   Thu, 13 Nov 2025 17:02:01 +0000

Bug 1993746: Adjust subgrid-inhibition code to recognize that 'container-type:inline-size' forces an independent formatting context. r=layout-reviewers,emilio

Background for this patch:

* A nested grid that's styled as a subgrid *does not actually form a subgrid*
  if it establishes an independent formatting context, per
  https://drafts.csswg.org/css-grid-2/#subgrid-listing

* We implement this check in
  nsGridContainerFrame::ShouldInhibitSubgridDueToIFC() (the function adjusted
  in this patch).

* `container-type: inline-size` and `size` force an independent formatting
  context, per:
  https://drafts.csswg.org/css-conditional-5/#valdef-container-type-inline-size

* So: nsGridContainerFrame::ShouldInhibitSubgridDueToIFC should check for those
  'container-type' scenarios.

This patch adds that check, cribbing from nsBlockFrame's similar
'StyleEstablishesBFC' function, here:
https://searchfox.org/firefox-main/rev/4fd0fa7e5814c0b51f1dd075821988377bc56cc1/layout/generic/nsBlockFrame.cpp#6664-6665

And while we're at it, this patch reorders the preexisting checks to match the
ordering in that nsBlockFrame function.

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

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

diff --git a/layout/generic/nsGridContainerFrame.cpp b/layout/generic/nsGridContainerFrame.cpp @@ -10710,8 +10710,10 @@ bool nsGridContainerFrame::ShouldInhibitSubgridDueToIFC( // NS_FRAME_OUT_OF_FLOW bit potentially isn't set yet, so we check our style. // * contain:layout and contain:paint each make us establish an IFC. const auto* display = aFrame->StyleDisplay(); - return display->IsAbsolutelyPositionedStyle() || display->IsContainLayout() || - display->IsContainPaint(); + return display->IsContainLayout() || display->IsContainPaint() || + display->mContainerType & + (StyleContainerType::SIZE | StyleContainerType::INLINE_SIZE) || + display->IsAbsolutelyPositionedStyle(); } nsGridContainerFrame* nsGridContainerFrame::GetGridContainerFrame(