mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-29 05:38:24 +00:00
LibWeb/CSS: Parse mask-size property
This commit is contained in:
parent
7c5f1a93ed
commit
866e12f688
Notes:
github-actions[bot]
2025-08-06 22:10:47 +00:00
Author: https://github.com/InvalidUsernameException
Commit: 866e12f688
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5511
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/Calme1709
7 changed files with 34 additions and 8 deletions
|
@ -421,7 +421,7 @@ private:
|
||||||
RefPtr<CSSStyleValue const> parse_aspect_ratio_value(TokenStream<ComponentValue>&);
|
RefPtr<CSSStyleValue const> parse_aspect_ratio_value(TokenStream<ComponentValue>&);
|
||||||
RefPtr<CSSStyleValue const> parse_background_value(TokenStream<ComponentValue>&);
|
RefPtr<CSSStyleValue const> parse_background_value(TokenStream<ComponentValue>&);
|
||||||
RefPtr<CSSStyleValue const> parse_single_background_position_x_or_y_value(TokenStream<ComponentValue>&, PropertyID);
|
RefPtr<CSSStyleValue const> parse_single_background_position_x_or_y_value(TokenStream<ComponentValue>&, PropertyID);
|
||||||
RefPtr<CSSStyleValue const> parse_single_background_size_value(TokenStream<ComponentValue>&);
|
RefPtr<CSSStyleValue const> parse_single_background_size_value(PropertyID, TokenStream<ComponentValue>&);
|
||||||
RefPtr<CSSStyleValue const> parse_border_value(PropertyID, TokenStream<ComponentValue>&);
|
RefPtr<CSSStyleValue const> parse_border_value(PropertyID, TokenStream<ComponentValue>&);
|
||||||
RefPtr<CSSStyleValue const> parse_border_image_value(TokenStream<ComponentValue>&);
|
RefPtr<CSSStyleValue const> parse_border_image_value(TokenStream<ComponentValue>&);
|
||||||
RefPtr<CSSStyleValue const> parse_border_image_slice_value(TokenStream<ComponentValue>&);
|
RefPtr<CSSStyleValue const> parse_border_image_slice_value(TokenStream<ComponentValue>&);
|
||||||
|
|
|
@ -480,7 +480,7 @@ Parser::ParseErrorOr<NonnullRefPtr<CSSStyleValue const>> Parser::parse_css_value
|
||||||
return parsed_value.release_nonnull();
|
return parsed_value.release_nonnull();
|
||||||
return ParseError::SyntaxError;
|
return ParseError::SyntaxError;
|
||||||
case PropertyID::BackgroundSize:
|
case PropertyID::BackgroundSize:
|
||||||
if (auto parsed_value = parse_comma_separated_value_list(tokens, [this](auto& tokens) { return parse_single_background_size_value(tokens); }))
|
if (auto parsed_value = parse_comma_separated_value_list(tokens, [this, property_id](auto& tokens) { return parse_single_background_size_value(property_id, tokens); }))
|
||||||
return parsed_value.release_nonnull();
|
return parsed_value.release_nonnull();
|
||||||
return ParseError::SyntaxError;
|
return ParseError::SyntaxError;
|
||||||
case PropertyID::Border:
|
case PropertyID::Border:
|
||||||
|
@ -677,6 +677,10 @@ Parser::ParseErrorOr<NonnullRefPtr<CSSStyleValue const>> Parser::parse_css_value
|
||||||
if (auto parsed_value = parse_comma_separated_value_list(tokens, [this, property_id](auto& tokens) { return parse_single_repeat_style_value(property_id, tokens); }))
|
if (auto parsed_value = parse_comma_separated_value_list(tokens, [this, property_id](auto& tokens) { return parse_single_repeat_style_value(property_id, tokens); }))
|
||||||
return parsed_value.release_nonnull();
|
return parsed_value.release_nonnull();
|
||||||
return ParseError::SyntaxError;
|
return ParseError::SyntaxError;
|
||||||
|
case PropertyID::MaskSize:
|
||||||
|
if (auto parsed_value = parse_comma_separated_value_list(tokens, [this, property_id](auto& tokens) { return parse_single_background_size_value(property_id, tokens); }))
|
||||||
|
return parsed_value.release_nonnull();
|
||||||
|
return ParseError::SyntaxError;
|
||||||
case PropertyID::Opacity:
|
case PropertyID::Opacity:
|
||||||
case PropertyID::FillOpacity:
|
case PropertyID::FillOpacity:
|
||||||
case PropertyID::FloodOpacity:
|
case PropertyID::FloodOpacity:
|
||||||
|
@ -1299,7 +1303,7 @@ RefPtr<CSSStyleValue const> Parser::parse_background_value(TokenStream<Component
|
||||||
auto background_size_transaction = tokens.begin_transaction();
|
auto background_size_transaction = tokens.begin_transaction();
|
||||||
auto& maybe_slash = tokens.consume_a_token();
|
auto& maybe_slash = tokens.consume_a_token();
|
||||||
if (maybe_slash.is_delim('/')) {
|
if (maybe_slash.is_delim('/')) {
|
||||||
if (auto maybe_background_size = parse_single_background_size_value(tokens)) {
|
if (auto maybe_background_size = parse_single_background_size_value(PropertyID::BackgroundSize, tokens)) {
|
||||||
background_size_transaction.commit();
|
background_size_transaction.commit();
|
||||||
background_size = maybe_background_size.release_nonnull();
|
background_size = maybe_background_size.release_nonnull();
|
||||||
continue;
|
continue;
|
||||||
|
@ -1453,7 +1457,7 @@ RefPtr<CSSStyleValue const> Parser::parse_single_background_position_x_or_y_valu
|
||||||
return EdgeStyleValue::create(relative_edge, {});
|
return EdgeStyleValue::create(relative_edge, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<CSSStyleValue const> Parser::parse_single_background_size_value(TokenStream<ComponentValue>& tokens)
|
RefPtr<CSSStyleValue const> Parser::parse_single_background_size_value(PropertyID property, TokenStream<ComponentValue>& tokens)
|
||||||
{
|
{
|
||||||
auto transaction = tokens.begin_transaction();
|
auto transaction = tokens.begin_transaction();
|
||||||
|
|
||||||
|
@ -1469,7 +1473,7 @@ RefPtr<CSSStyleValue const> Parser::parse_single_background_size_value(TokenStre
|
||||||
return {};
|
return {};
|
||||||
};
|
};
|
||||||
|
|
||||||
auto maybe_x_value = parse_css_value_for_property(PropertyID::BackgroundSize, tokens);
|
auto maybe_x_value = parse_css_value_for_property(property, tokens);
|
||||||
if (!maybe_x_value)
|
if (!maybe_x_value)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
auto x_value = maybe_x_value.release_nonnull();
|
auto x_value = maybe_x_value.release_nonnull();
|
||||||
|
@ -1479,7 +1483,7 @@ RefPtr<CSSStyleValue const> Parser::parse_single_background_size_value(TokenStre
|
||||||
return x_value;
|
return x_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto maybe_y_value = parse_css_value_for_property(PropertyID::BackgroundSize, tokens);
|
auto maybe_y_value = parse_css_value_for_property(property, tokens);
|
||||||
if (!maybe_y_value) {
|
if (!maybe_y_value) {
|
||||||
auto y_value = LengthPercentage { Length::make_auto() };
|
auto y_value = LengthPercentage { Length::make_auto() };
|
||||||
auto x_size = get_length_percentage(*x_value);
|
auto x_size = get_length_percentage(*x_value);
|
||||||
|
|
|
@ -2439,6 +2439,23 @@
|
||||||
"repeat-y"
|
"repeat-y"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"mask-size": {
|
||||||
|
"affects-layout": false,
|
||||||
|
"animation-type": "repeatable-list",
|
||||||
|
"inherited": false,
|
||||||
|
"initial": "auto",
|
||||||
|
"max-values": 2,
|
||||||
|
"valid-types": [
|
||||||
|
"length [0,∞]",
|
||||||
|
"percentage [0,∞]"
|
||||||
|
],
|
||||||
|
"valid-identifiers": [
|
||||||
|
"auto",
|
||||||
|
"cover",
|
||||||
|
"contain"
|
||||||
|
],
|
||||||
|
"percentages-resolve-to": "length"
|
||||||
|
},
|
||||||
"mask-type": {
|
"mask-type": {
|
||||||
"animation-type": "discrete",
|
"animation-type": "discrete",
|
||||||
"inherited": false,
|
"inherited": false,
|
||||||
|
|
|
@ -191,6 +191,7 @@ All properties associated with getComputedStyle(document.body):
|
||||||
"mask-mode",
|
"mask-mode",
|
||||||
"mask-position",
|
"mask-position",
|
||||||
"mask-repeat",
|
"mask-repeat",
|
||||||
|
"mask-size",
|
||||||
"mask-type",
|
"mask-type",
|
||||||
"max-block-size",
|
"max-block-size",
|
||||||
"max-height",
|
"max-height",
|
||||||
|
|
|
@ -535,6 +535,8 @@ All supported properties and their default values exposed from CSSStylePropertie
|
||||||
'mask-position': '0% 0%'
|
'mask-position': '0% 0%'
|
||||||
'maskRepeat': 'repeat'
|
'maskRepeat': 'repeat'
|
||||||
'mask-repeat': 'repeat'
|
'mask-repeat': 'repeat'
|
||||||
|
'maskSize': 'auto'
|
||||||
|
'mask-size': 'auto'
|
||||||
'maskType': 'luminance'
|
'maskType': 'luminance'
|
||||||
'mask-type': 'luminance'
|
'mask-type': 'luminance'
|
||||||
'mathDepth': '0'
|
'mathDepth': '0'
|
||||||
|
|
|
@ -189,6 +189,7 @@ mask-image: none
|
||||||
mask-mode: match-source
|
mask-mode: match-source
|
||||||
mask-position: 0% 0%
|
mask-position: 0% 0%
|
||||||
mask-repeat: repeat
|
mask-repeat: repeat
|
||||||
|
mask-size: auto
|
||||||
mask-type: luminance
|
mask-type: luminance
|
||||||
max-block-size: none
|
max-block-size: none
|
||||||
max-height: none
|
max-height: none
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
Harness status: OK
|
Harness status: OK
|
||||||
|
|
||||||
Found 251 tests
|
Found 252 tests
|
||||||
|
|
||||||
244 Pass
|
245 Pass
|
||||||
7 Fail
|
7 Fail
|
||||||
Pass accent-color
|
Pass accent-color
|
||||||
Pass border-collapse
|
Pass border-collapse
|
||||||
|
@ -189,6 +189,7 @@ Pass mask-composite
|
||||||
Pass mask-image
|
Pass mask-image
|
||||||
Pass mask-mode
|
Pass mask-mode
|
||||||
Pass mask-repeat
|
Pass mask-repeat
|
||||||
|
Pass mask-size
|
||||||
Pass mask-type
|
Pass mask-type
|
||||||
Pass max-block-size
|
Pass max-block-size
|
||||||
Pass max-height
|
Pass max-height
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue