Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 72c3b9e4364ab54555f90ad1ab497d70dc6c96ff
      
https://github.com/WebKit/WebKit/commit/72c3b9e4364ab54555f90ad1ab497d70dc6c96ff
  Author: Sammy Gill <sammy.g...@apple.com>
  Date:   2025-06-24 (Tue, 24 Jun 2025)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-horz-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-row-axis-self-baseline-synthesized-001-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-row-axis-self-baseline-synthesized-002-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-row-axis-self-baseline-synthesized-003-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-row-axis-self-baseline-synthesized-004-expected.txt
    M Source/WebCore/rendering/BaselineAlignment.cpp
    M Source/WebCore/rendering/BaselineAlignment.h
    M Source/WebCore/rendering/GridBaselineAlignment.cpp
    M Source/WebCore/rendering/RenderFlexibleBox.cpp

  Log Message:
  -----------
  [Baseline Alignment] Fix css-flexbox/align-items-baseline-column-horz.
https://bugs.webkit.org/show_bug.cgi?id=294917
rdar://problem/154213989

Reviewed by Alan Baradlay.

The aforementioned WPT test case contains some content with the following
structure:

<flexbox style="flex-direction: column; align-items: baseline;">
  <item style="width: 40px; height: 40px;"></item>
  <item style="writing-mode: vertical-lr;">line1<br>line2</item>
</flexbox>

The problem is that the two items should be part of the baseline sharing
group, causing them to get aligned together, but we end up putting them
into different groups. Boxes are part of the same baseline sharing group
if they:

1.) Share an alignment context along an axis perpendicular to the axis
they’re being baseline-aligned in.
  - In this case, the items are in the same column.
2.) Have compatible baseline alignment preferences (i.e., the baselines
that want to align are on the same side of the alignment context).
  - The first item has a computed writing mode of horizontal-tb and the
    second item has a computed writing mode of vertical-lr, but that is
    not the one used for baseline alignment according to the rules the
    spec outlines for synthesizing baselines. The writing-mode that ends
    up getting used according to these rules is vertical-lr.

We actually already have the logic to make this determination in
RenderFlexibleBox for the purposes of whether or not the items need to
be moved to the end of the cross axis due to their fallback alignment,
So most of this patch is just moving over this logic to
BaselineAlignment.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-horz-expected.txt:
Pass!

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-row-axis-self-baseline-synthesized-001-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-row-axis-self-baseline-synthesized-002-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-row-axis-self-baseline-synthesized-003-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-row-axis-self-baseline-synthesized-004-expected.txt:
The impacted subtests are already failing.

* Source/WebCore/rendering/BaselineAlignment.cpp:
Most of the code added to this class and its methods are just the logic
from RenderFlexibleBox. In order to accomplish the same goal, we needed
to pass it the direction of the alignment axis along with the writing
mode of the alignment container.

(WebCore::BaselineAlignmentState::usedWritingModeForBaselineAlignment):
This is used to determine the writing mode that is used for baseline
alignment. It is really only needed when you need to synthesize a
baseline, but it is safe and correct to use it even when you do not need
to, since one of the first things we do is use the alignment axis
direction and the alignment subject's writing mode to check to see if
We need to apply the special rules mentioned in the spec to determine
the writing mode for synthesis.

* Source/WebCore/rendering/GridBaselineAlignment.cpp:
(WebCore::GridBaselineAlignment::updateBaselineAlignmentContext):
This is just a small refactoring to ensure use with the HashMap. Mostly
just for a stylistic improvement.

* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutAndPlaceFlexItems):
This code was changed just for the purposes of style and should have no
changes to functionality.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to