HTMLFontElement.cpp 846 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/CSS/StyleProperties.h>
  7. #include <LibWeb/CSS/StyleValue.h>
  8. #include <LibWeb/HTML/HTMLFontElement.h>
  9. namespace Web::HTML {
  10. HTMLFontElement::HTMLFontElement(DOM::Document& document, QualifiedName qualified_name)
  11. : HTMLElement(document, move(qualified_name))
  12. {
  13. }
  14. HTMLFontElement::~HTMLFontElement()
  15. {
  16. }
  17. void HTMLFontElement::apply_presentational_hints(CSS::StyleProperties& style) const
  18. {
  19. for_each_attribute([&](auto& name, auto& value) {
  20. if (name.equals_ignoring_case("color")) {
  21. auto color = Color::from_string(value);
  22. if (color.has_value())
  23. style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()));
  24. }
  25. });
  26. }
  27. }