Serenity Operating System
at master 39 lines 1.2 kB view raw
1/* 2 * Copyright (c) 2020, the SerenityOS developers. 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <LibWeb/Bindings/Intrinsics.h> 8#include <LibWeb/HTML/HTMLMarqueeElement.h> 9 10namespace Web::HTML { 11 12HTMLMarqueeElement::HTMLMarqueeElement(DOM::Document& document, DOM::QualifiedName qualified_name) 13 : HTMLElement(document, move(qualified_name)) 14{ 15} 16 17HTMLMarqueeElement::~HTMLMarqueeElement() = default; 18 19JS::ThrowCompletionOr<void> HTMLMarqueeElement::initialize(JS::Realm& realm) 20{ 21 MUST_OR_THROW_OOM(Base::initialize(realm)); 22 set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLMarqueeElementPrototype>(realm, "HTMLMarqueeElement")); 23 24 return {}; 25} 26 27void HTMLMarqueeElement::apply_presentational_hints(CSS::StyleProperties& style) const 28{ 29 HTMLElement::apply_presentational_hints(style); 30 for_each_attribute([&](auto& name, auto& value) { 31 if (name == HTML::AttributeNames::bgcolor) { 32 auto color = Color::from_string(value); 33 if (color.has_value()) 34 style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value())); 35 } 36 }); 37} 38 39}