diff options
author | Oriol Brufau <obrufau@igalia.com> | 2025-05-16 12:15:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-16 19:15:16 +0000 |
commit | 78f3f455dca1ac01c235fe98429d65ea743d70d0 (patch) | |
tree | 8d28c73b456f291fd7990c56824e2af9d8085904 /components/layout | |
parent | c1a70f4eb2a730f4a79bf4c916118145674d59fa (diff) | |
download | servo-78f3f455dca1ac01c235fe98429d65ea743d70d0.tar.gz servo-78f3f455dca1ac01c235fe98429d65ea743d70d0.zip |
layout: Fix `align-content` on stretched row flex containers (#37024)
Fixes a regression from #36973, which didn't take into account that
stretching flex items affects their final block size when the cross axis
is the block axis.
Testing: Adding new test
Fixes: #37023
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Diffstat (limited to 'components/layout')
-rw-r--r-- | components/layout/flexbox/layout.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/components/layout/flexbox/layout.rs b/components/layout/flexbox/layout.rs index 80057af2b34..8fc5aa0778b 100644 --- a/components/layout/flexbox/layout.rs +++ b/components/layout/flexbox/layout.rs @@ -1929,7 +1929,11 @@ impl FlexItem<'_> { } } - let lazy_block_size = if cross_axis_is_item_block_axis { + let lazy_block_size = if !cross_axis_is_item_block_axis { + used_main_size.into() + } else if let Some(cross_size) = used_cross_size_override { + cross_size.into() + } else { // This means that an auto size with stretch alignment will behave different than // a stretch size. That's not what the spec says, but matches other browsers. // To be discussed in https://github.com/w3c/csswg-drafts/issues/11784. @@ -1946,8 +1950,6 @@ impl FlexItem<'_> { stretch_size, self.is_table(), ) - } else { - used_main_size.into() }; let layout = non_replaced.layout( |