mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:58:11 +00:00
LibWeb: Check flex longhands first when parsing flex shorthand
Currently, `property_accepts_value()` always returns `true` if the property is a shorthand. (This is a bug, and should actually be fixed properly at some point...) This means that all identifiers are caught here, including `auto`, which should be handled by the `flex-basis` branch instead. This works currently because `auto` is a LengthStyleValue, but that's about to change!
This commit is contained in:
parent
6bf5371124
commit
7458cf4231
1 changed files with 11 additions and 11 deletions
|
@ -5128,17 +5128,6 @@ RefPtr<StyleValue> Parser::parse_flex_value(Vector<ComponentValue> const& compon
|
|||
if (!value)
|
||||
return nullptr;
|
||||
|
||||
if (value->is_identifier() && property_accepts_value(PropertyID::Flex, *value)) {
|
||||
switch (value->to_identifier()) {
|
||||
case ValueID::None: {
|
||||
auto zero = NumericStyleValue::create_integer(0);
|
||||
return FlexStyleValue::create(zero, zero, IdentifierStyleValue::create(ValueID::Auto));
|
||||
}
|
||||
default:
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
if (property_accepts_value(PropertyID::FlexGrow, *value)) {
|
||||
// NOTE: The spec says that flex-basis should be 0 here, but other engines currently use 0%.
|
||||
// https://github.com/w3c/csswg-drafts/issues/5742
|
||||
|
@ -5152,6 +5141,17 @@ RefPtr<StyleValue> Parser::parse_flex_value(Vector<ComponentValue> const& compon
|
|||
return FlexStyleValue::create(one, one, *value);
|
||||
}
|
||||
|
||||
if (value->is_identifier() && property_accepts_value(PropertyID::Flex, *value)) {
|
||||
switch (value->to_identifier()) {
|
||||
case ValueID::None: {
|
||||
auto zero = NumericStyleValue::create_integer(0);
|
||||
return FlexStyleValue::create(zero, zero, IdentifierStyleValue::create(ValueID::Auto));
|
||||
}
|
||||
default:
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue