mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:48:12 +00:00
LibWeb: Support flex in typed attr()
This commit is contained in:
parent
b0317bb3a1
commit
dfd3d9a72d
1 changed files with 14 additions and 0 deletions
|
@ -6957,6 +6957,17 @@ bool Parser::substitute_attr_function(DOM::Element& element, StringView property
|
|||
return true;
|
||||
}
|
||||
}
|
||||
} else if (attribute_type.equals_ignoring_ascii_case("flex"_fly_string)) {
|
||||
// Parse a component value from the attribute’s value.
|
||||
auto component_value = MUST(Parser::Parser::create(m_context, attribute_value)).parse_as_component_value();
|
||||
// If the result is a <dimension-token> whose unit matches the given type, the result is the substitution value.
|
||||
// Otherwise, there is no substitution value.
|
||||
if (component_value.has_value() && component_value->is(Token::Type::Dimension)) {
|
||||
if (Flex::unit_from_name(component_value->token().dimension_unit()).has_value()) {
|
||||
dest.append(component_value.release_value());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (attribute_type.equals_ignoring_ascii_case("frequency"_fly_string)) {
|
||||
// Parse a component value from the attribute’s value.
|
||||
auto component_value = MUST(Parser::Parser::create(m_context, attribute_value)).parse_as_component_value();
|
||||
|
@ -7045,6 +7056,9 @@ bool Parser::substitute_attr_function(DOM::Element& element, StringView property
|
|||
} else if (auto angle_unit = Angle::unit_from_name(attribute_type); angle_unit.has_value()) {
|
||||
dest.empend(Token::create_dimension(component_value->token().number_value(), attribute_type));
|
||||
return true;
|
||||
} else if (auto flex_unit = Flex::unit_from_name(attribute_type); flex_unit.has_value()) {
|
||||
dest.empend(Token::create_dimension(component_value->token().number_value(), attribute_type));
|
||||
return true;
|
||||
} else if (auto frequency_unit = Frequency::unit_from_name(attribute_type); frequency_unit.has_value()) {
|
||||
dest.empend(Token::create_dimension(component_value->token().number_value(), attribute_type));
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue