Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4087ab818e4949f1d63a8c4c54fd08369b48f420
      
https://github.com/WebKit/WebKit/commit/4087ab818e4949f1d63a8c4c54fd08369b48f420
  Author: Sammy Gill <[email protected]>
  Date:   2026-08-25 (Tue, 25 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] Initialize GridLanesLayout in its constructor
https://bugs.webkit.org/show_bug.cgi?id=322532
rdar://problem/185827725

Reviewed by Tim Nguyen.

GridLanesLayout had an initializeGridLanes() that reset every member at the 
start
of each placement run, because the object used to live on RenderGrid and was 
reused
across layouts. Now that it is a stack local the only thing still forcing a 
reset
was computeIntrinsicLogicalWidths(), which performed two placement runs on a 
single
object. Give each run its own GridLanesLayout and the setup can move into the
constructor, where it is harder to end up with a half initialized object.

Every mutable member was already reset per run, so a new object per run is
equivalent to resetting one. m_gridContentSize, m_itemOffsets and
m_autoFlowNextCursor now rely on default construction, and the rest is set in 
the
member initializer list.

* Source/WebCore/rendering/GridLanesLayout.cpp:
(WebCore::GridLanesLayout::GridLanesLayout):
Take the grid axis track count and the stacking axis direction, and do what
initializeGridLanes() used to do. resizeAndResetRunningPositions() had no other
caller so it is folded in here.

(WebCore::GridLanesLayout::performGridLanesPlacement):
Drop the two parameters that moved to the constructor. The explicit
m_autoFlowNextCursor reset goes with them, since a freshly constructed object
already starts at 0.

* Source/WebCore/rendering/RenderGrid.cpp:
(WebCore::RenderGrid::layoutGridLanes):
The stacking axis direction is now needed before the object is constructed.
isGridLanes() is defined as "one of the two axes is the stacking axis", so 
there is
always one here and it can be picked with a ternary. That removes the need for 
the
lambda, which only existed to share a body between the rows and columns cases.

(WebCore::RenderGrid::computeIntrinsicLogicalWidths const):
Construct a GridLanesLayout per phase. Both are given the track count computed
before either run placed anything, which is what the single reused object was
given.

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



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

Reply via email to