mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-16 21:20:18 +00:00
LibWeb/CSS: Use dimension_for_unit() when we don't need the exact unit
A small code reduction, and means that NumericType will catch if new dimensions are added, and attr() will just work in that case.
This commit is contained in:
parent
b3e32445d3
commit
b3c099bd68
Notes:
github-actions[bot]
2025-09-11 16:08:10 +00:00
Author: https://github.com/AtkinsSJ
Commit: b3c099bd68
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6071
2 changed files with 28 additions and 35 deletions
|
@ -131,12 +131,7 @@ static Vector<ComponentValue> replace_an_attr_function(DOM::AbstractElement& ele
|
|||
first_argument_tokens.discard_a_token(); // raw-string
|
||||
syntax = RawString {};
|
||||
} else if (syntax_ident == "%"sv
|
||||
|| string_to_angle_unit(syntax_ident).has_value()
|
||||
|| string_to_flex_unit(syntax_ident).has_value()
|
||||
|| string_to_frequency_unit(syntax_ident).has_value()
|
||||
|| string_to_length_unit(syntax_ident).has_value()
|
||||
|| string_to_resolution_unit(syntax_ident).has_value()
|
||||
|| string_to_time_unit(syntax_ident).has_value()) {
|
||||
|| dimension_for_unit(syntax_ident).has_value()) {
|
||||
syntax = TypeSyntaxNode::create("number"_fly_string).release_nonnull<SyntaxNode>();
|
||||
unit_name = first_argument_tokens.consume_a_token().token().ident();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue