mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
LibWeb: Support border radius in xywh() function
This commit is contained in:
committed by
Jelle Raaijmakers
parent
02a8d22a4e
commit
4f5bab7e5d
Notes:
github-actions[bot]
2026-01-06 09:51:15 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/4f5bab7e5dd Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7339 Reviewed-by: https://github.com/gmta ✅
@@ -3657,7 +3657,6 @@ RefPtr<StyleValue const> Parser::parse_basic_shape_value(TokenStream<ComponentVa
|
||||
|
||||
if (function_name.equals_ignoring_ascii_case("xywh"sv)) {
|
||||
// xywh() = xywh( <length-percentage>{2} <length-percentage [0,∞]>{2} [ round <'border-radius'> ]? )
|
||||
// FIXME: Parse the border-radius.
|
||||
auto arguments_tokens = TokenStream { component_value.function().value };
|
||||
|
||||
arguments_tokens.discard_whitespace();
|
||||
@@ -3681,6 +3680,20 @@ RefPtr<StyleValue const> Parser::parse_basic_shape_value(TokenStream<ComponentVa
|
||||
return nullptr;
|
||||
|
||||
arguments_tokens.discard_whitespace();
|
||||
|
||||
NonnullRefPtr<StyleValue const> border_radius = BorderRadiusRectStyleValue::create_zero();
|
||||
if (arguments_tokens.next_token().is_ident("round"sv)) {
|
||||
arguments_tokens.discard_a_token(); // 'round'
|
||||
auto parsed_border_radius = parse_border_radius_rect_value(arguments_tokens);
|
||||
|
||||
if (!parsed_border_radius)
|
||||
return nullptr;
|
||||
|
||||
border_radius = parsed_border_radius.release_nonnull();
|
||||
|
||||
arguments_tokens.discard_whitespace();
|
||||
}
|
||||
|
||||
if (arguments_tokens.has_next_token())
|
||||
return nullptr;
|
||||
|
||||
@@ -3692,7 +3705,7 @@ RefPtr<StyleValue const> Parser::parse_basic_shape_value(TokenStream<ComponentVa
|
||||
return nullptr;
|
||||
|
||||
transaction.commit();
|
||||
return BasicShapeStyleValue::create(Xywh { x.release_nonnull(), y.release_nonnull(), width.release_nonnull(), height.release_nonnull() });
|
||||
return BasicShapeStyleValue::create(Xywh { x.release_nonnull(), y.release_nonnull(), width.release_nonnull(), height.release_nonnull(), border_radius });
|
||||
}
|
||||
|
||||
if (function_name.equals_ignoring_ascii_case("rect"sv)) {
|
||||
|
||||
Reference in New Issue
Block a user