LibWeb: Tokenize CSS numbers as doubles

Every later stage uses doubles, so dropping that precision right at the
start of parsing is a little silly. :^)
This commit is contained in:
Sam Atkins 2023-08-20 13:07:43 +01:00 committed by Sam Atkins
parent c20df751c9
commit 1a5533e528
Notes: sideshowbarker 2024-07-17 06:40:35 +09:00
2 changed files with 3 additions and 3 deletions

View file

@ -574,11 +574,11 @@ Number Tokenizer::consume_a_number()
}
// https://www.w3.org/TR/css-syntax-3/#convert-string-to-number
float Tokenizer::convert_a_string_to_a_number(StringView string)
double Tokenizer::convert_a_string_to_a_number(StringView string)
{
// FIXME: We already found the whole part, fraction part and exponent during
// validation, we could probably skip
return string.to_float(AK::TrimWhitespace::No).release_value();
return string.to_double(AK::TrimWhitespace::No).release_value();
}
// https://www.w3.org/TR/css-syntax-3/#consume-name

View file

@ -87,7 +87,7 @@ private:
[[nodiscard]] ErrorOr<Token> consume_a_numeric_token();
[[nodiscard]] ErrorOr<Token> consume_an_ident_like_token();
[[nodiscard]] Number consume_a_number();
[[nodiscard]] float convert_a_string_to_a_number(StringView);
[[nodiscard]] double convert_a_string_to_a_number(StringView);
[[nodiscard]] ErrorOr<FlyString> consume_an_ident_sequence();
[[nodiscard]] u32 consume_escaped_code_point();
[[nodiscard]] ErrorOr<Token> consume_a_url_token();