Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[css-flexbox][baseline-alignment] Do not synthesize first baseline wh…
…en flex item block axis is parallel to flex cross axis. https://bugs.webkit.org/show_bug.cgi?id=256937 rdar://109489182 Reviewed by Alan Baradlay. This patches focuses on applying the described changes to flex items that are block/grid/flex containers or tables. If a flex item has a writing-mode that is different from the flex container, that does not necessarily mean it cannot provide an ascent value to use for baseline alignment within the flexbox. The firstLineBaseline implementation within RenderBlockFlow/Grid/FlexibleBox/Table each had a check for isWritingModeRoot() that would return std::nullopt if the writing mode of the item was different from the flex container. This would result in the flex container synthesizing a baseline for the item which is not correct in all cases. This should only be done if the block axis is *not* parallel to the flex container's cross axis. In the following example we cannot get the baseline of the item so we should synthesize it: <div style="display: flex;"> <div style="writing-mode: vertical-lr"> no valid baseline </div> </div> However, in the example below we can get the baseline so we should *not* try to synthesize one: <div style="display: flex; flex-direction: column;"> <div style="writing-mode: vertical-lr"> Can get baseline </div> </div> We can resolve this issue by doing two things: 1.) Append an extra constraint against the isWritingModeRoot() check to make sure this logic isn't applied on flex items 2.) Make RenderFlexibleBox check the block axis of the flex item with its cross axis We may also need to perform a translation on the ascent value that is applied to the flex item since it may have been computed in a coordinate space that is different from the flex container's (e.g. vertical-lr flex container with vertical-rl item). * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-vert-lr-flexbox-item-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-vert-lr-flexbox-item.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-vert-lr-grid-item-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-vert-lr-grid-item.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-vert-lr-items-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-vert-lr-items.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-vert-lr-table-item-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-vert-lr-table-item.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-vert-rl-flexbox-item-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-vert-rl-flexbox-item.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-vert-rl-grid-item-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-vert-rl-grid-item.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-vert-rl-items-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-vert-rl-items.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-vert-rl-table-item-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-column-vert-rl-table-item.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-vert-lr-column-horz-flexbox-item-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-vert-lr-column-horz-flexbox-item.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-vert-lr-column-horz-grid-item-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-vert-lr-column-horz-grid-item.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-vert-lr-column-horz-items-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-vert-lr-column-horz-items.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-vert-lr-column-horz-table-item-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-vert-lr-column-horz-table-item.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-vert-rl-column-horz-flexbox-item-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-vert-rl-column-horz-flexbox-item.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-vert-rl-column-horz-grid-item-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-vert-rl-column-horz-grid-item.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-vert-rl-column-horz-items-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-vert-rl-column-horz-items.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-vert-rl-column-horz-table-item-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/align-items-baseline-vert-rl-column-horz-table-item.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/alignment/flex-align-baseline-001-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/alignment/flex-align-baseline-002-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/alignment/flex-align-baseline-003-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/alignment/flex-align-baseline-004-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/alignment/flex-align-baseline-006-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/alignment/flex-align-baseline-007-expected.txt: * Source/WebCore/rendering/RenderBlock.cpp: (WebCore::RenderBlock::firstLineBaseline const): * Source/WebCore/rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::firstLineBaseline const): (WebCore::RenderBlockFlow::lastLineBaseline const): * Source/WebCore/rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::firstLineBaseline const): (WebCore::RenderFlexibleBox::marginBoxAscentForChild): * Source/WebCore/rendering/RenderGrid.cpp: (WebCore::RenderGrid::firstLineBaseline const): * Source/WebCore/rendering/RenderTable.cpp: (WebCore::RenderTable::firstLineBaseline const): Canonical link: https://commits.webkit.org/264423@main
- Loading branch information