mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb: Support border radius in rect() function
This commit is contained in:
committed by
Jelle Raaijmakers
parent
1b7567cc86
commit
02a8d22a4e
Notes:
github-actions[bot]
2026-01-06 09:51:22 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/02a8d22a4e9 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7339 Reviewed-by: https://github.com/gmta ✅
@@ -3697,7 +3697,6 @@ RefPtr<StyleValue const> Parser::parse_basic_shape_value(TokenStream<ComponentVa
|
||||
|
||||
if (function_name.equals_ignoring_ascii_case("rect"sv)) {
|
||||
// rect() = rect( [ <length-percentage> | auto ]{4} [ round <'border-radius'> ]? )
|
||||
// FIXME: Parse the border-radius.
|
||||
auto arguments_tokens = TokenStream { component_value.function().value };
|
||||
|
||||
auto parse_length_percentage_or_auto = [this](TokenStream<ComponentValue>& tokens) -> RefPtr<StyleValue const> {
|
||||
@@ -3718,11 +3717,26 @@ 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;
|
||||
|
||||
transaction.commit();
|
||||
return BasicShapeStyleValue::create(Rect { top.release_nonnull(), right.release_nonnull(), bottom.release_nonnull(), left.release_nonnull() });
|
||||
return BasicShapeStyleValue::create(Rect { top.release_nonnull(), right.release_nonnull(), bottom.release_nonnull(), left.release_nonnull(), border_radius });
|
||||
}
|
||||
|
||||
if (function_name.equals_ignoring_ascii_case("circle"sv)) {
|
||||
|
||||
Reference in New Issue
Block a user