ladybird/Libraries/LibHTML/DOM/HTMLFontElement.cpp
Andreas Kling 31ac19543a LibHTML: Use an enum for CSS property ID's
Instead of using string everywhere, have the CSS parser produce enum
values, since they are a lot nicer to work with.

In the future we should generate most of this code based on a list of
supported CSS properties.
2019-10-08 15:35:05 +02:00

23 lines
653 B
C++

#include <LibHTML/CSS/StyleProperties.h>
#include <LibHTML/CSS/StyleValue.h>
#include <LibHTML/DOM/HTMLFontElement.h>
HTMLFontElement::HTMLFontElement(Document& document, const String& tag_name)
: HTMLElement(document, tag_name)
{
}
HTMLFontElement::~HTMLFontElement()
{
}
void HTMLFontElement::apply_presentational_hints(StyleProperties& style) const
{
for_each_attribute([&](auto& name, auto& value) {
if (name == "color") {
auto color = Color::from_string(value);
if (color.has_value())
style.set_property(CSS::PropertyID::Color, ColorStyleValue::create(color.value()));
}
});
}