Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f1a102b37fa10019337398271d2ff459eba4d0ea
      
https://github.com/WebKit/WebKit/commit/f1a102b37fa10019337398271d2ff459eba4d0ea
  Author: Sammy Gill <[email protected]>
  Date:   2026-09-24 (Thu, 24 Sep 2026)

  Changed paths:
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/layout/formattingContexts/grid/ExplicitGridResolver.cpp
    A Source/WebCore/layout/formattingContexts/grid/ExplicitGridResolver.h
    A Source/WebCore/layout/formattingContexts/grid/ExplicitGridTrackSizes.h
    M Source/WebCore/layout/formattingContexts/grid/GridFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/grid/GridFormattingContext.h
    M Source/WebCore/layout/formattingContexts/grid/GridLayout.cpp
    M Source/WebCore/layout/formattingContexts/grid/GridLayoutUtils.cpp
    M Source/WebCore/layout/formattingContexts/grid/GridLayoutUtils.h

  Log Message:
  -----------
  [GFC] Introduce an ExplicitGridResolver
https://bugs.webkit.org/show_bug.cgi?id=325172
rdar://188300209

Reviewed by Brent Fulgham.

As we start working on repeat() and auto-repeat tracks, resolving the tracks of 
the
explicit grid is going to get a bit more more complex. Before doing that, this 
patch
creates a dedicated ExplicitGridResolver class to hold this logic. It resolves
grid-template-{columns,rows} into an ExplicitGridTrackSizes, which holds the 
explicit
grid's column and row track sizes, and the rest of GFC now reads the explicit 
grid's
track sizes from this instead of style.

The resolver takes in the same set of inputs that we were using to
figure out what the explicit track sizes were before. For example, in
certain cases we needed to transform any percentage track sizes to auto
if the constraints were indefinite so we pass in the same set of
constraints so that the resolver can have the same behavior.

No change in behavior.

* Source/WebCore/layout/formattingContexts/grid/ExplicitGridResolver.cpp: Added.
(WebCore::Layout::ExplicitGridResolver::resolveTrackSizes):
Returns the track sizes from style, with percentages converted to auto when the 
axis
constraint is not definite.

* Source/WebCore/layout/formattingContexts/grid/GridFormattingContext.cpp:
(WebCore::Layout::computeLeadingImplicitTracks):
Take the number of explicit tracks from ExplicitGridTrackSizes instead of from 
style.

(WebCore::Layout::GridFormattingContext::computeIntrinsicWidths):
The min-content and max-content scenarios share one explicit grid. Neither 
constraint
is definite, so resolving it against the min-content constraint treats its 
percentages
as auto for both.

(WebCore::Layout::trackSizeWithPercentagesConvertedToAuto): Moved to 
GridLayoutUtils.

* Source/WebCore/layout/formattingContexts/grid/GridFormattingContext.h:
GridDefinition now holds an ExplicitGridTrackSizes instead of two 
GridTemplateLists.
The rest of the code as a result will read from this.

* Source/WebCore/layout/formattingContexts/grid/GridLayoutUtils.cpp:
(WebCore::Layout::GridLayoutUtils::trackSizeWithPercentagesConvertedToAuto):
Moved from GridFormattingContext.cpp so that both ExplicitGridResolver and
GridFormattingContext's conversion of grid-auto-{columns,rows} can use it.

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



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

Reply via email to