summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/Parser
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-03-20 17:31:36 +0000
committerAndreas Kling <kling@serenityos.org>2023-03-22 19:45:40 +0100
commita3d6d9db377300f8960f14ee90346a6135e852e4 (patch)
tree7301158a4f474cd40741a298548e8dcbf6ec2b8a /Userland/Libraries/LibWeb/CSS/Parser
parenta8cd6c396b51c49c310218dead50b1e7b6d14aef (diff)
downloadserenity-a3d6d9db377300f8960f14ee90346a6135e852e4.zip
LibWeb: Correct logic when consuming a CSS number in scientific notation
Before, we were classifying the number as a "number" type if it had an "E", even if that was not followed by an exponent.
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/Parser')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp
index 651d7884b9..b9df9d2fc3 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp
@@ -534,10 +534,11 @@ Number Tokenizer::consume_a_number()
// U+0065 LATIN SMALL LETTER E (e), optionally followed by U+002D HYPHEN-MINUS (-)
// or U+002B PLUS SIGN (+), followed by a digit, then:
auto maybe_exp = peek_triplet();
- if (is_E(maybe_exp.first) || is_e(maybe_exp.first)) {
+ if ((is_E(maybe_exp.first) || is_e(maybe_exp.first))
+ && (((is_plus_sign(maybe_exp.second) || is_hyphen_minus(maybe_exp.second)) && is_ascii_digit(maybe_exp.third))
+ || (is_ascii_digit(maybe_exp.second)))) {
// 1. Consume them.
// 2. Append them to repr.
- // FIXME: These conditions should be part of step 5 above.
if (is_plus_sign(maybe_exp.second) || is_hyphen_minus(maybe_exp.second)) {
if (is_ascii_digit(maybe_exp.third)) {
repr.append_code_point(next_code_point());