1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 21:25:07 +00:00

LibWeb: Apply rules for parsing a legacy color value

This commit is contained in:
Shannon Booth 2023-05-28 15:06:12 +12:00 committed by Andreas Kling
parent bc54560e59
commit 500552df54
5 changed files with 21 additions and 9 deletions

View file

@ -55,7 +55,8 @@ void HTMLTableElement::apply_presentational_hints(CSS::StyleProperties& style) c
return;
}
if (name == HTML::AttributeNames::bgcolor) {
auto color = Color::from_string(value);
// https://html.spec.whatwg.org/multipage/rendering.html#tables-2:rules-for-parsing-a-legacy-colour-value
auto color = parse_legacy_color_value(value);
if (color.has_value())
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors());
return;