LibWeb/CSS: Don't allow negative values in border-radius property

This commit is contained in:
Tim Ledbetter 2025-03-12 13:57:10 +00:00 committed by Sam Atkins
parent 632fc73643
commit 18cccd7633
Notes: github-actions[bot] 2025-03-14 15:09:00 +00:00
4 changed files with 53 additions and 0 deletions

View file

@ -1659,6 +1659,10 @@ RefPtr<CSSStyleValue> Parser::parse_border_radius_shorthand_value(TokenStream<Co
auto maybe_dimension = parse_length_percentage(tokens);
if (!maybe_dimension.has_value())
return nullptr;
if (maybe_dimension->is_length() && !property_accepts_length(PropertyID::BorderRadius, maybe_dimension->length()))
return nullptr;
if (maybe_dimension->is_percentage() && !property_accepts_percentage(PropertyID::BorderRadius, maybe_dimension->percentage()))
return nullptr;
if (reading_vertical) {
vertical_radii.append(maybe_dimension.release_value());
} else {