mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:28:12 +00:00
LibWeb: Add parsing for NumericStyleValue
This StyleValue can hold an arbitrary float value.
This commit is contained in:
parent
ae3e6510d6
commit
af4d80af4d
2 changed files with 27 additions and 1 deletions
|
@ -240,8 +240,12 @@ RefPtr<CSS::StyleValue> parse_css_value(const CSS::ParsingContext& context, cons
|
|||
}
|
||||
|
||||
auto length = parse_length(context, string, is_bad_length);
|
||||
if (is_bad_length)
|
||||
if (is_bad_length) {
|
||||
auto float_number = try_parse_float(string);
|
||||
if (float_number.has_value())
|
||||
return CSS::NumericStyleValue::create(float_number.value());
|
||||
return nullptr;
|
||||
}
|
||||
if (!length.is_undefined())
|
||||
return CSS::LengthStyleValue::create(length);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue