Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ee671ed1c8f5bc9023ec5681cbb94007e8b278ab
      
https://github.com/WebKit/WebKit/commit/ee671ed1c8f5bc9023ec5681cbb94007e8b278ab
  Author: Sammy Gill <[email protected]>
  Date:   2026-08-26 (Wed, 26 Aug 2026)

  Changed paths:
    M Source/WebCore/rendering/GridLanesLayout.cpp
    M Source/WebCore/rendering/GridLanesLayout.h
    M Source/WebCore/rendering/RenderGrid.cpp

  Log Message:
  -----------
  [Grid Lanes] Resolve fit-tolerance outside of GridLanesLayout
https://bugs.webkit.org/show_bug.cgi?id=322508
rdar://problem/185811508

Reviewed by Alan Baradlay.

GridLanesLayout should not need to know about the legacy render tree grid
implementation. As a step in that direction, stop having it consult the grid
container's style to resolve fit-tolerance. RenderGrid now resolves the style
value into a used value up front and passes it in, so the placement code only
ever deals with an already resolved length, or the infinite keyword.

This removes the reads on the grid container that existed solely to compute the
tolerance: style().fitTolerance(), style().computedFontSize(),
style().usedZoomForLength(), contentBoxLogicalWidth() and
contentBoxLogicalHeight().

Resolving once per placement run instead of once per auto placed item is not a
behavior change. Nothing in the placement loop mutates the container's content
box, and the container's logical height is not set until after placement has
finished.

* Source/WebCore/rendering/GridLanesLayout.h:
Add ResolvedFitTolerance, which is either the used length or the infinite
keyword. It is only needed while items are being placed, so it is threaded
through placement rather than stored as a member.

* Source/WebCore/rendering/GridLanesLayout.cpp:
Drop the StyleFitTolerance.h and StylePrimitiveNumericTypes+Evaluation.h 
includes,
which were only needed by the resolution that moved out.
(WebCore::GridLanesLayout::performGridLanesPlacement):
(WebCore::GridLanesLayout::placeGridLanesItems):
(WebCore::GridLanesLayout::gridAreaForIndefiniteGridAxisItem):
Take the resolved tolerance as a parameter and pass it down to
gridAreaForIndefiniteGridAxisItem(), which is the only thing that uses it.

* Source/WebCore/rendering/RenderGrid.cpp:
(WebCore::resolveFitTolerance):
The moved resolution, which is why StyleFitTolerance.h is now included here. A
percentage resolves against the stacking axis content box size, since the
tolerance is a distance measured along the stacking axis. The local is named for
that axis so it is harder to misread which one applies.
(WebCore::RenderGrid::layoutGridLanes):
(WebCore::RenderGrid::computeIntrinsicLogicalWidths const):
Resolve the tolerance and hand it to performGridLanesPlacement(). The intrinsic
width path runs placement twice, so it resolves once and reuses the value.

Canonical link: https://commits.webkit.org/319851@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to