HTMLMarqueeElement.cpp 851 B

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