1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 15:47:42 +00:00

LibWeb: Allow floating point values when parsing SVG viewboxes

This commit is contained in:
MacDue 2023-04-10 12:38:24 +01:00 committed by Andreas Kling
parent f753a4f640
commit ba7383d28f

View file

@ -30,7 +30,7 @@ Optional<ViewBox> try_parse_view_box(StringView string)
while (!lexer.is_eof()) { while (!lexer.is_eof()) {
lexer.consume_while([](auto ch) { return is_ascii_space(ch); }); lexer.consume_while([](auto ch) { return is_ascii_space(ch); });
auto token = lexer.consume_until([](auto ch) { return is_ascii_space(ch) && ch != ','; }); auto token = lexer.consume_until([](auto ch) { return is_ascii_space(ch) && ch != ','; });
auto maybe_number = token.to_int(); auto maybe_number = token.to_float();
if (!maybe_number.has_value()) if (!maybe_number.has_value())
return {}; return {};
switch (state) { switch (state) {