diff options
author | Andreas Kling <kling@serenityos.org> | 2021-02-10 09:54:16 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-10 09:54:16 +0100 |
commit | acd46dcb0c9b779efc97422e76ddf2eb51ffcf75 (patch) | |
tree | 008a4747022b01a390997242b6e5e9be42cc0715 /Userland/Libraries/LibWeb/HTML | |
parent | 5e91e61900f6d53d08b2420aa5a50069b2fa1e16 (diff) | |
download | serenity-acd46dcb0c9b779efc97422e76ddf2eb51ffcf75.zip |
LibWeb: Respect the bgcolor attribute on <marquee> elements
We don't yet animate marquees, but we can at least fill them with the
right background color.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp index ea92ca6b73..b47787b61f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp @@ -37,4 +37,16 @@ HTMLMarqueeElement::~HTMLMarqueeElement() { } +void HTMLMarqueeElement::apply_presentational_hints(CSS::StyleProperties& style) const +{ + HTMLElement::apply_presentational_hints(style); + 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, CSS::ColorStyleValue::create(color.value())); + } + }); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h index cf4446c372..b569b179d4 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h @@ -37,6 +37,9 @@ public: HTMLMarqueeElement(DOM::Document&, QualifiedName); virtual ~HTMLMarqueeElement() override; + +private: + virtual void apply_presentational_hints(CSS::StyleProperties&) const override; }; } |