diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp index c09dfc7fa49..10e037b039f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp @@ -5,12 +5,15 @@ */ #include +#include +#include #include #include #include #include #include #include +#include #include namespace Web::HTML { @@ -30,6 +33,20 @@ JS::ThrowCompletionOr HTMLTableRowElement::initialize(JS::Realm& realm) return {}; } +void HTMLTableRowElement::apply_presentational_hints(CSS::StyleProperties& style) const +{ + Base::apply_presentational_hints(style); + for_each_attribute([&](auto& name, auto& value) { + if (name == HTML::AttributeNames::bgcolor) { + // 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; + } + }); +} + void HTMLTableRowElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h index dbef9b6d941..f4ec3340d3f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h @@ -32,6 +32,7 @@ private: virtual JS::ThrowCompletionOr initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; + virtual void apply_presentational_hints(CSS::StyleProperties&) const override; JS::GCPtr mutable m_cells; };