From ca41c2e4a04600472a229879c370abc3ad7504d6 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 12 Jun 2020 22:47:51 +0200 Subject: [PATCH] LibWeb: Turn into background-color --- Libraries/LibWeb/DOM/HTMLTableCellElement.cpp | 11 +++++++++++ Libraries/LibWeb/DOM/HTMLTableCellElement.h | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Libraries/LibWeb/DOM/HTMLTableCellElement.cpp b/Libraries/LibWeb/DOM/HTMLTableCellElement.cpp index 19e3fcf95a..3e865bad1d 100644 --- a/Libraries/LibWeb/DOM/HTMLTableCellElement.cpp +++ b/Libraries/LibWeb/DOM/HTMLTableCellElement.cpp @@ -37,4 +37,15 @@ HTMLTableCellElement::~HTMLTableCellElement() { } +void HTMLTableCellElement::apply_presentational_hints(StyleProperties& style) const +{ + for_each_attribute([&](auto& name, auto& value) { + if (name == HTML::AttributeNames::bgcolor) { + auto color = Color::from_string(value); + if (color.has_value()) + style.set_property(CSS::PropertyID::BackgroundColor, ColorStyleValue::create(color.value())); + } + }); +} + } diff --git a/Libraries/LibWeb/DOM/HTMLTableCellElement.h b/Libraries/LibWeb/DOM/HTMLTableCellElement.h index 40272aab9f..15de7c51b0 100644 --- a/Libraries/LibWeb/DOM/HTMLTableCellElement.h +++ b/Libraries/LibWeb/DOM/HTMLTableCellElement.h @@ -30,10 +30,13 @@ namespace Web { -class HTMLTableCellElement : public HTMLElement { +class HTMLTableCellElement final : public HTMLElement { public: HTMLTableCellElement(Document&, const FlyString& tag_name); virtual ~HTMLTableCellElement() override; + +private: + virtual void apply_presentational_hints(StyleProperties&) const override; }; template<>