Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: cd61603bb4c75a6c536c73aa90e4a83fde402f09
https://github.com/WebKit/WebKit/commit/cd61603bb4c75a6c536c73aa90e4a83fde402f09
Author: Alan Baradlay <[email protected]>
Date: 2026-07-29 (Wed, 29 Jul 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flexbox-baseline-wrap-reverse-unequal-lines-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flexbox-baseline-wrap-reverse-unequal-lines.html
M Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
M Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h
Log Message:
-----------
[Flex] First baseline of a wrap-reverse flex container comes from the wrong
flex line
https://bugs.webkit.org/show_bug.cgi?id=320513
Reviewed by Antti Koivisto.
A flex container's first baseline comes from one of its flex lines, and
FlexLayout::flexItemForFirstBaseline picks
that line as a slice of the flex item list: a start index and an item count.
flex-wrap: wrap-reverse stacks the lines
the other way round, so the visually-first line is the last one in item order,
and that function flips for it -- it
takes the slice from the end of the list instead of the start.
setFlexItemCountsForFirstAndLastLine flipped as well, reporting the
visually-first line's count as
numberOfFlexItemsOnFirstLine. Two flips, but only one of the two numbers that
make up the slice: the start index came
out of the flipped count and the item count out of the other one. When the two
lines hold the same number of items
that cancels out, which is every existing test. When they do not, the slice
starts partway through one line and ends
partway through the next, and the baseline is taken from an item on the wrong
line -- so the container sits at the
wrong height in its parent's line box.
Count the lines in the order they were collected, which is the order the item
list is in, and leave the visual
mapping to the caller that already does it. The counts are what index that
list, so they have to be in its order.
The same slice feeds lastLineBaseline, which was wrong in the same way.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flexbox-baseline-wrap-reverse-unequal-lines-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flexbox-baseline-wrap-reverse-unequal-lines.html:
Added.
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::FlexFormattingContext::setFlexItemCountsForFirstAndLastLine):
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h:
Canonical link: https://commits.webkit.org/318154@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications