diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index a08bf433b4..3a29a7ff96 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -4155,6 +4155,11 @@ ErrorOr> Parser::parse_simple_comma_separated_value_list(Prop }); } +static void remove_property(Vector& properties, PropertyID property_to_remove) +{ + properties.remove_first_matching([&](auto it) { return it == property_to_remove; }); +} + ErrorOr> Parser::parse_background_value(Vector const& component_values) { StyleValueVector background_images; @@ -4185,6 +4190,16 @@ ErrorOr> Parser::parse_background_value(Vector background_origin; bool has_multiple_layers = false; + // BackgroundSize is always parsed as part of BackgroundPosition, so we don't include it here. + Vector remaining_layer_properties { + PropertyID::BackgroundAttachment, + PropertyID::BackgroundClip, + PropertyID::BackgroundColor, + PropertyID::BackgroundImage, + PropertyID::BackgroundOrigin, + PropertyID::BackgroundPosition, + PropertyID::BackgroundRepeat, + }; auto background_layer_is_valid = [&](bool allow_background_color) -> bool { if (allow_background_color) { @@ -4221,44 +4236,50 @@ ErrorOr> Parser::parse_background_value(Vector value is present then it sets both background-origin and background-clip to that value. // If two values are present, then the first sets background-origin and the second background-clip." @@ -4267,17 +4288,15 @@ ErrorOr> Parser::parse_background_value(Vector> Parser::parse_background_value(Vector> Parser::parse_background_value(Vector