diff --git a/Libraries/LibWeb/CSS/Parser/Parser.h b/Libraries/LibWeb/CSS/Parser/Parser.h index afa51453cd9..74aa354d092 100644 --- a/Libraries/LibWeb/CSS/Parser/Parser.h +++ b/Libraries/LibWeb/CSS/Parser/Parser.h @@ -421,7 +421,7 @@ private: RefPtr parse_aspect_ratio_value(TokenStream&); RefPtr parse_background_value(TokenStream&); RefPtr parse_single_background_position_x_or_y_value(TokenStream&, PropertyID); - RefPtr parse_single_background_size_value(TokenStream&); + RefPtr parse_single_background_size_value(PropertyID, TokenStream&); RefPtr parse_border_value(PropertyID, TokenStream&); RefPtr parse_border_image_value(TokenStream&); RefPtr parse_border_image_slice_value(TokenStream&); diff --git a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp index 25696ac2ea2..40d21f29988 100644 --- a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp +++ b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp @@ -480,7 +480,7 @@ Parser::ParseErrorOr> Parser::parse_css_value return parsed_value.release_nonnull(); return ParseError::SyntaxError; 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 ParseError::SyntaxError; case PropertyID::Border: @@ -677,6 +677,10 @@ Parser::ParseErrorOr> 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); })) return parsed_value.release_nonnull(); 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::FillOpacity: case PropertyID::FloodOpacity: @@ -1299,7 +1303,7 @@ RefPtr Parser::parse_background_value(TokenStream Parser::parse_single_background_position_x_or_y_valu return EdgeStyleValue::create(relative_edge, {}); } -RefPtr Parser::parse_single_background_size_value(TokenStream& tokens) +RefPtr Parser::parse_single_background_size_value(PropertyID property, TokenStream& tokens) { auto transaction = tokens.begin_transaction(); @@ -1469,7 +1473,7 @@ RefPtr Parser::parse_single_background_size_value(TokenStre 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) return nullptr; auto x_value = maybe_x_value.release_nonnull(); @@ -1479,7 +1483,7 @@ RefPtr Parser::parse_single_background_size_value(TokenStre 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) { auto y_value = LengthPercentage { Length::make_auto() }; auto x_size = get_length_percentage(*x_value); diff --git a/Libraries/LibWeb/CSS/Properties.json b/Libraries/LibWeb/CSS/Properties.json index 77ad7859f71..6161cec5750 100644 --- a/Libraries/LibWeb/CSS/Properties.json +++ b/Libraries/LibWeb/CSS/Properties.json @@ -2439,6 +2439,23 @@ "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": { "animation-type": "discrete", "inherited": false, diff --git a/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt b/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt index 0c4631501d7..8416f32f544 100644 --- a/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt +++ b/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt @@ -191,6 +191,7 @@ All properties associated with getComputedStyle(document.body): "mask-mode", "mask-position", "mask-repeat", + "mask-size", "mask-type", "max-block-size", "max-height", diff --git a/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt b/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt index 8e9775b3f5a..b0ca40e09c8 100644 --- a/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt +++ b/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt @@ -535,6 +535,8 @@ All supported properties and their default values exposed from CSSStylePropertie 'mask-position': '0% 0%' 'maskRepeat': 'repeat' 'mask-repeat': 'repeat' +'maskSize': 'auto' +'mask-size': 'auto' 'maskType': 'luminance' 'mask-type': 'luminance' 'mathDepth': '0' diff --git a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt index fcec45fb2e1..3dae0b74986 100644 --- a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt +++ b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt @@ -189,6 +189,7 @@ mask-image: none mask-mode: match-source mask-position: 0% 0% mask-repeat: repeat +mask-size: auto mask-type: luminance max-block-size: none max-height: none diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-cascade/all-prop-revert-layer.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-cascade/all-prop-revert-layer.txt index 89cef471c51..3e187313bd4 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-cascade/all-prop-revert-layer.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-cascade/all-prop-revert-layer.txt @@ -1,8 +1,8 @@ Harness status: OK -Found 251 tests +Found 252 tests -244 Pass +245 Pass 7 Fail Pass accent-color Pass border-collapse @@ -189,6 +189,7 @@ Pass mask-composite Pass mask-image Pass mask-mode Pass mask-repeat +Pass mask-size Pass mask-type Pass max-block-size Pass max-height