mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 07:07:23 +00:00
LibWeb: Add parsing for NumericStyleValue
This StyleValue can hold an arbitrary float value.
This commit is contained in:
committed by
Ali Mohammad Pur
parent
ae3e6510d6
commit
af4d80af4d
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user