LibWeb: Remove Token::number()

In a future commit we will be applying clamping to numeric (i.e.
number, percentage, dimension) values which will be done in the
appropriate `Token` getters so accessing the underlying number value
would be a potential footgun
This commit is contained in:
Callum Law
2026-04-15 22:21:32 +12:00
committed by Sam Atkins
parent da5e002db1
commit cbf6e4454d
Notes: github-actions[bot] 2026-04-22 13:26:29 +00:00
7 changed files with 31 additions and 25 deletions

View File

@@ -277,9 +277,8 @@ static Vector<ComponentValue> replace_an_env_function(DOM::AbstractElement& elem
auto& maybe_integer = first_argument_tokens.consume_a_token();
if (!maybe_integer.is(Token::Type::Number))
return { ComponentValue { GuaranteedInvalidValue {} } };
auto& number = maybe_integer.token().number();
if (number.is_integer() && number.integer_value() >= 0)
indices.append(number.integer_value());
if (maybe_integer.token().is_integer() && maybe_integer.token().to_integer() >= 0)
indices.append(maybe_integer.token().to_integer());
else
return { ComponentValue { GuaranteedInvalidValue {} } };
first_argument_tokens.discard_whitespace();