Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7d5b70c1e5533dda525d37423de93a5436fc3f7f
https://github.com/WebKit/WebKit/commit/7d5b70c1e5533dda525d37423de93a5436fc3f7f
Author: Sammy Gill <[email protected]>
Date: 2026-01-22 (Thu, 22 Jan 2026)
Changed paths:
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/GridLayout.h
Log Message:
-----------
[GFC] Pass in GridDefinition into GridLayout from GridFormattingContext.
https://bugs.webkit.org/show_bug.cgi?id=305987
rdar://problem/168625033
Reviewed by Vitor Roriz.
Currently, inside of GridLayout we query the formatting context root for
various style relating to the definition of the grid, such as
grid-template-columns. Instead of getting whatever information we need
by getting the RenderStyle off the formatting context root and getting
different values from the RenderStyle, we can pass in the exact
information that GridLayout will need. This new struct, GridDefinition,
should contain information from the "Defining the Grid," portion of the
spec.
The biggest benefit this change brings is that is allows us to pass in
different values to GridLayout depending on the context. For example,
the grid spec has this little blurb with regards to percentage track
sizes:
"<percentage> values are relative to the inner {inline, block} size of
the grid container in {column, row} grid tracks... If the size of the
grid container depends on the size of its tracks, then the <percentage>
must be treated as auto"
https://drafts.csswg.org/css-grid-1/#track-sizing
While in theory we could try to detect this state and implement whatever
logic is needed to accomplish this inside of GridLayout, this would
result in a bit of additional noise in code that is dedicated to
performing the layout algorithm. Instead we could perform this
transformation inside of GridFormattingContext so that GridLayout does
not need to worry about this minor detail. So in this patch we do a bit
of preparation by beginning to have the formatting context pass in the
GridDefinition and in a follow up we can slightly alter these values in
certain circumstances as described above.
Canonical link: https://commits.webkit.org/306041@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications