mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
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:
parent
c20df751c9
commit
1a5533e528
Notes:
sideshowbarker
2024-07-17 06:40:35 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/1a5533e528 Pull-request: https://github.com/SerenityOS/serenity/pull/20678
2 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue