mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-05 00:21:52 +00:00
LibWeb/CSS: Reject negative <resolution>
values
Gets us 3 more WPT passes.
This commit is contained in:
parent
fb975cc156
commit
e251b451ef
Notes:
github-actions[bot]
2025-05-23 09:18:54 +00:00
Author: https://github.com/AtkinsSJ
Commit: e251b451ef
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4817
2 changed files with 10 additions and 5 deletions
|
@ -964,6 +964,11 @@ RefPtr<CSSStyleValue const> Parser::parse_resolution_value(TokenStream<Component
|
|||
if (tokens.next_token().is(Token::Type::Dimension)) {
|
||||
auto transaction = tokens.begin_transaction();
|
||||
auto& dimension_token = tokens.consume_a_token().token();
|
||||
// The allowed range of <resolution> values always excludes negative values, in addition to any explicit
|
||||
// ranges that might be specified.
|
||||
// https://drafts.csswg.org/css-values-4/#resolution
|
||||
if (dimension_token.dimension_value() < 0)
|
||||
return nullptr;
|
||||
if (auto resolution_type = Resolution::unit_from_name(dimension_token.dimension_unit()); resolution_type.has_value()) {
|
||||
transaction.commit();
|
||||
return ResolutionStyleValue::create(Resolution { (dimension_token.dimension_value()), resolution_type.release_value() });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue