LibWeb: Don't allow more than one color sub-value in CSS 'background'

This commit is contained in:
Andreas Kling 2020-06-25 16:55:43 +02:00
parent 3fefc7f3e9
commit 505b133fda
Notes: sideshowbarker 2024-07-19 05:23:11 +09:00

View file

@ -353,8 +353,15 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
for (auto& part : parts) {
values.append(parse_css_value(part));
}
if (values[0].is_color())
// HACK: Disallow more than one color value in a 'background' shorthand
size_t color_value_count = 0;
for (auto& value : values)
color_value_count += value.is_color();
if (values[0].is_color() && color_value_count == 1)
style.set_property(CSS::PropertyID::BackgroundColor, values[0]);
for (auto& value : values) {
if (!value.is_string())
continue;