mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 09:18:52 +00:00
LibHTML: Add support for <font color>
This was pleasantly trivial to implement with the new support for presentational hints. :^)
This commit is contained in:
parent
9808d35554
commit
8fb979148d
Notes:
sideshowbarker
2024-07-19 11:49:16 +09:00
Author: https://github.com/awesomekling
Commit: 8fb979148d
4 changed files with 39 additions and 1 deletions
23
Libraries/LibHTML/DOM/HTMLFontElement.cpp
Normal file
23
Libraries/LibHTML/DOM/HTMLFontElement.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#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("color", ColorStyleValue::create(color.value()));
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue