Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 25f1db8380ce52433b580f30c232243e0bc07cf7
      
https://github.com/WebKit/WebKit/commit/25f1db8380ce52433b580f30c232243e0bc07cf7
  Author: Sammy Gill <[email protected]>
  Date:   2025-08-13 (Wed, 13 Aug 2025)

  Changed paths:
    M LayoutTests/TestExpectations
    M Source/WebCore/rendering/BaselineAlignment.cpp
    M Source/WebCore/rendering/RenderFlexibleBox.cpp

  Log Message:
  -----------
  [Flex][Baseline Alignment] Fix flexbox-align-self-vert-rtl-* tests
rdar://157516386
https://bugs.webkit.org/show_bug.cgi?id=296908

Reviewed by Alan Baradlay.

Consider the following flex content with baseline alignment which we
currently fail to align correctly:

<div style="display: flex; width: 200px; flex-direction: column; direction: 
rtl; align-items: baseline; outline: 1px solid black;">
  <div style="background-color: blue;">foo</div>
  <div style="background-color: magenta;">foobarbaz</div>
</div>

When determining the ascent for this flex item, we call into
BaselineAlignmentState::synthesizedBaseline since we need to
synthesize a baseline for this content. This ends up returning
an incorrect value of 0 for both flex items. This baseline comes from
the fact that:

1.) We ask synthesizedBaseline to compute the alphabetic baseline since
the flexbox's writing mode is horizontal-tb.
2.) shouldTreatAsHorizontal is false since the LineDirection is
Vertical, the writing mode (which is the flexbox's writing mode) does not
have sideways orientation, and the writing mode is horizontal-tb.

In order to fix this bug, we need to make two main changes:

1.) Instead of passing in the flexbox's writing mode to
synthesizedBaseline, we should use 
BaselineAlignmentState::usedWritingModeForBaselineAlignment.
This is because the writing mode to determine the line under/over edges
needs to come from the CSS-align rules in
https://drafts.csswg.org/css-align-3/#baseline-export

2.) Remove the logic that checks for sideways orientation out of this
function. I introduced this logic in 257239@main and it seems like it was
used to determine which type of baseline (i.e. Alphabetic or Central) to
synthesize. Over time, this logic has moved around the function a bit and
from what I can tell, it no longer needs to live here. The type of
baseline to synthesize is now passed into the function and primarily
comes from BaselineAlignmentState::dominantBaseline.

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



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

Reply via email to