HTMLMarqueeElement.cpp 956 B

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