Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ca88a69658d65166ef83b19e593252e139c5fc53
      
https://github.com/WebKit/WebKit/commit/ca88a69658d65166ef83b19e593252e139c5fc53
  Author: Sammy Gill <[email protected]>
  Date:   2026-02-12 (Thu, 12 Feb 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
    M Source/WebCore/layout/formattingContexts/grid/PlacedGridItem.cpp
    M Source/WebCore/layout/formattingContexts/grid/PlacedGridItem.h

  Log Message:
  -----------
  [GFC] Use StyleSelfAlignmentData machinery for alignment.
https://bugs.webkit.org/show_bug.cgi?id=306817
rdar://169487049

Reviewed by Elika Etemad.

StyleSelfAlignmentData provides a helper in the form of adjustmentFromStartEdge
that helps with the offset needed for alignment. Instead of enumerating the
various alignment values and duplicating the exact same logic that is
found here, we can just hook into it instead by passing in the
appropriate information.

* Source/WebCore/layout/formattingContexts/grid/GridFormattingContext.cpp:
(WebCore::Layout::GridFormattingContext::constructPlacedGridItems const):
We need to pass in the alignment subject's writing mode to the API so we
store this on the PlacedGridItem when we construct it so that later we
can access it during alignment.

* Source/WebCore/layout/formattingContexts/grid/GridFormattingContext.h:
(WebCore::Layout::GridFormattingContext::writingMode const):
It also needs the alignment container's writing mode so add a function
on the formatting context that can be accessed at the same time as the
alignment subject's.

* Source/WebCore/layout/formattingContexts/grid/GridLayout.cpp:
(WebCore::Layout::GridLayout::layout):
(WebCore::Layout::GridLayout::performInlineAxisSelfAlignment):
(WebCore::Layout::GridLayout::performBlockAxisSelfAlignment):
Add in the border box sizes of the items, the formatting context writing
mode, and the computed gap value since we will need this for alignment.
Besides that, all we need to do is compute the remaining space for
alignment by taking the grid item's margin box and subtracting it from
the grid area's size in the appropriate dimension. Then, we should have
all of the information needed to call 
StyleSelfAlignmentData::adjustmentFromStartEdge.

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



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

Reply via email to