HTMLMarqueeElement.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2020, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Bindings/HTMLMarqueeElementPrototype.h>
  7. #include <LibWeb/HTML/HTMLMarqueeElement.h>
  8. #include <LibWeb/HTML/Window.h>
  9. namespace Web::HTML {
  10. HTMLMarqueeElement::HTMLMarqueeElement(DOM::Document& document, DOM::QualifiedName qualified_name)
  11. : HTMLElement(document, move(qualified_name))
  12. {
  13. set_prototype(&window().ensure_web_prototype<Bindings::HTMLMarqueeElementPrototype>("HTMLMarqueeElement"));
  14. }
  15. HTMLMarqueeElement::~HTMLMarqueeElement() = default;
  16. void HTMLMarqueeElement::apply_presentational_hints(CSS::StyleProperties& style) const
  17. {
  18. HTMLElement::apply_presentational_hints(style);
  19. for_each_attribute([&](auto& name, auto& value) {
  20. if (name == HTML::AttributeNames::bgcolor) {
  21. auto color = Color::from_string(value);
  22. if (color.has_value())
  23. style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()));
  24. }
  25. });
  26. }
  27. }