HTMLFontElement.cpp 653 B

1234567891011121314151617181920212223
  1. #include <LibHTML/CSS/StyleProperties.h>
  2. #include <LibHTML/CSS/StyleValue.h>
  3. #include <LibHTML/DOM/HTMLFontElement.h>
  4. HTMLFontElement::HTMLFontElement(Document& document, const String& tag_name)
  5. : HTMLElement(document, tag_name)
  6. {
  7. }
  8. HTMLFontElement::~HTMLFontElement()
  9. {
  10. }
  11. void HTMLFontElement::apply_presentational_hints(StyleProperties& style) const
  12. {
  13. for_each_attribute([&](auto& name, auto& value) {
  14. if (name == "color") {
  15. auto color = Color::from_string(value);
  16. if (color.has_value())
  17. style.set_property(CSS::PropertyID::Color, ColorStyleValue::create(color.value()));
  18. }
  19. });
  20. }