mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
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:
Notes:
github-actions[bot]
2026-04-22 13:26:29 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/cbf6e4454d5 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8959 Reviewed-by: https://github.com/AtkinsSJ ✅
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user