Treat align-self: normal as stretch on flex items (#33314)

According to https://drafts.csswg.org/css-align/#align-flex
It was being treated as `auto` instead.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2024-09-05 13:15:41 +02:00 committed by GitHub
parent 8263fe5495
commit 37e1c3385e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 39 additions and 1 deletions

View file

@ -247,7 +247,8 @@ impl FlexContainerConfig {
fn align_for(&self, align_self: AlignSelf) -> AlignItems {
let value = align_self.0 .0.value();
let mapped_value = match value {
AlignFlags::AUTO | AlignFlags::NORMAL => self.align_items.0,
AlignFlags::AUTO => self.align_items.0,
AlignFlags::NORMAL => AlignFlags::STRETCH,
_ => value,
};
AlignItems(mapped_value)

View file

@ -122762,6 +122762,19 @@
{}
]
],
"self-align-normal-flex.html": [
"26a983dea028cb48617e905504bc456c489b3021",
[
null,
[
[
"/css/reference/ref-filled-green-100px-square.xht",
"=="
]
],
{}
]
],
"self-align-safe-unsafe-flex-001.html": [
"bb933b99d722d462b2b824d86fb15e825a598f5a",
[

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<title>align-self:normal on flex items</title>
<link rel="author" title="Oriol Brufau" href="obrufau@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-align/#align-flex">
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
<meta name="assert" content="align-self:normal behaves as stretch on flex items." />
<style>
.flex {
display: flex;
align-items: center;
width: 100px;
height: 100px;
background: red;
}
.item {
flex: 1;
align-self: normal;
background: green;
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div class="flex">
<div class="item"></div>
</div>