summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/Parser
diff options
context:
space:
mode:
authorTobias Christiansen <tobi@tobyase.de>2021-06-03 21:59:41 +0200
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-06-06 01:46:06 +0430
commitaf4d80af4d85dd469b852bad9b8b1daca2a0d9c5 (patch)
tree6cbd789a53efb14b7f928bd50febcc62f73f0b54 /Userland/Libraries/LibWeb/CSS/Parser
parentae3e6510d66b137d402d7d0d0adc5bb05f30e155 (diff)
downloadserenity-af4d80af4d85dd469b852bad9b8b1daca2a0d9c5.zip
LibWeb: Add parsing for NumericStyleValue
This StyleValue can hold an arbitrary float value.
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/Parser')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp
index 591de141a6..edca46cf77 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp
@@ -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);