mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb/CSS: Handle whitespace properly in mask properties
This commit is contained in:
parent
fd682386b8
commit
123a3dbbc5
Notes:
github-actions[bot]
2025-11-03 11:27:21 +00:00
Author: https://github.com/AtkinsSJ
Commit: 123a3dbbc5
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6646
Reviewed-by: https://github.com/tcl3
2 changed files with 13 additions and 13 deletions
|
|
@ -3750,13 +3750,15 @@ RefPtr<StyleValue const> Parser::parse_mask_value(TokenStream<ComponentValue>& t
|
|||
remaining_layer_properties.unchecked_append(PropertyID::MaskMode);
|
||||
};
|
||||
|
||||
tokens.discard_whitespace();
|
||||
while (tokens.has_next_token()) {
|
||||
if (tokens.next_token().is(Token::Type::Comma)) {
|
||||
has_multiple_layers = true;
|
||||
if (!mask_layer_is_valid())
|
||||
return nullptr;
|
||||
complete_mask_layer();
|
||||
tokens.discard_a_token();
|
||||
tokens.discard_a_token(); // ,
|
||||
tokens.discard_whitespace();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -3772,6 +3774,7 @@ RefPtr<StyleValue const> Parser::parse_mask_value(TokenStream<ComponentValue>& t
|
|||
case PropertyID::MaskImage:
|
||||
VERIFY(!mask_image);
|
||||
mask_image = value.release_nonnull();
|
||||
tokens.discard_whitespace();
|
||||
continue;
|
||||
// <position> [ / <bg-size> ]?
|
||||
case PropertyID::MaskPosition: {
|
||||
|
|
@ -3780,15 +3783,18 @@ RefPtr<StyleValue const> Parser::parse_mask_value(TokenStream<ComponentValue>& t
|
|||
|
||||
// Attempt to parse `/ <bg-size>`
|
||||
auto mask_size_transaction = tokens.begin_transaction();
|
||||
auto const& maybe_slash = tokens.consume_a_token();
|
||||
if (maybe_slash.is_delim('/')) {
|
||||
tokens.discard_whitespace();
|
||||
if (auto const& maybe_slash = tokens.consume_a_token(); maybe_slash.is_delim('/')) {
|
||||
tokens.discard_whitespace();
|
||||
if (auto maybe_mask_size = parse_single_background_size_value(PropertyID::MaskSize, tokens)) {
|
||||
mask_size_transaction.commit();
|
||||
tokens.discard_whitespace();
|
||||
mask_size = maybe_mask_size.release_nonnull();
|
||||
continue;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
tokens.discard_whitespace();
|
||||
continue;
|
||||
}
|
||||
// <repeat-style>
|
||||
|
|
@ -3797,6 +3803,7 @@ RefPtr<StyleValue const> Parser::parse_mask_value(TokenStream<ComponentValue>& t
|
|||
tokens.reconsume_current_input_token();
|
||||
if (auto maybe_repeat = parse_single_repeat_style_value(property, tokens)) {
|
||||
mask_repeat = maybe_repeat.release_nonnull();
|
||||
tokens.discard_whitespace();
|
||||
continue;
|
||||
}
|
||||
return nullptr;
|
||||
|
|
@ -3820,17 +3827,20 @@ RefPtr<StyleValue const> Parser::parse_mask_value(TokenStream<ComponentValue>& t
|
|||
} else {
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
tokens.discard_whitespace();
|
||||
continue;
|
||||
}
|
||||
// <compositing-operator>
|
||||
case PropertyID::MaskComposite:
|
||||
VERIFY(!mask_composite);
|
||||
mask_composite = value.release_nonnull();
|
||||
tokens.discard_whitespace();
|
||||
continue;
|
||||
// <masking-mode>
|
||||
case PropertyID::MaskMode:
|
||||
VERIFY(!mask_mode);
|
||||
mask_mode = value.release_nonnull();
|
||||
tokens.discard_whitespace();
|
||||
continue;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue