Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 743de0ac207deefbce5b1a927f0c07b0cfa43807
https://github.com/WebKit/WebKit/commit/743de0ac207deefbce5b1a927f0c07b0cfa43807
Author: Sammy Gill <[email protected]>
Date: 2026-07-24 (Fri, 24 Jul 2026)
Changed paths:
M Source/WebCore/layout/formattingContexts/grid/UnplacedGridItem.cpp
M Source/WebCore/layout/formattingContexts/grid/UnplacedGridItem.h
Log Message:
-----------
[GFC] Store a grid item's resolved placement in UnplacedGridItem::GridPosition
https://bugs.webkit.org/show_bug.cgi?id=320130
rdar://problem/183069388
Reviewed by Alan Baradlay.
Currently, UnplacedGridItem holds the information needed to resolve a
grid item's position in two different fields. These two fields are each
a std::pair of Style::GridPosition which holds the computed style for
the item's start and end position. Then when we are trying to determine
the actual position of the item we query the computed values multiple
times to determine what type of position it is (e.g. a definite position
like grid-column-start: 1) or an automatic position.
Instead what we can do is we can store the position in a dedicated type
that represents the type of position that it is when we create the
UnplacedGridItem. This will then make the implementation for the code
that is actually used during layout a lot simpler since we figured out
all of this information before we run layout. So most of this patch is
just introducing this new type and moving the logic that was used to
determine the type of grid position so that it is instead used to
construct this new type.
* Source/WebCore/layout/formattingContexts/grid/UnplacedGridItem.h:
(WebCore::Layout::UnplacedGridItem::GridPosition::GridPosition):
GridPosition is the new type that will hold all of the information
needed to correctly place the grid item during layout. It replaces the
computed values that were on the item. This new type will hold a variant
which is one of the two possible types it could be: a DefinitePosition
(e.g. grid-column: 1 / 2) which represents a specific spot in the grid
it needs to be placed or an AutoPosition in which we will use an
algorithm to find the appropriate spot.
(WebCore::Layout::explicitLineToIndex):
The line numbers in the spec are 1-index based but we store the
information as 0-indexed so this is just a tiny wrapper to help us
convert.
(WebCore::Layout::UnplacedGridItem::GridPosition::create):
This is the core logic that takes in the two computed style values we
were holding onto earlier which were being queried during layout and
instead creates a DefinitePosition or AutoPosition based upon that same
set of logic we were using during layout.
Canonical link: https://commits.webkit.org/317903@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications