mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-28 23:39:02 +00:00
LibHTML: Parse link, alink and vlink in <body> and pass to Document
This patch adds HTMLBodyElement::parse_attribute() where we extract the link colors and stash them away on Document.
This commit is contained in:
parent
772718b8d8
commit
83a6474d82
Notes:
sideshowbarker
2024-07-19 11:48:14 +09:00
Author: https://github.com/awesomekling
Commit: 83a6474d82
4 changed files with 48 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
#include <LibHTML/CSS/StyleProperties.h>
|
||||
#include <LibHTML/CSS/StyleValue.h>
|
||||
#include <LibHTML/DOM/Document.h>
|
||||
#include <LibHTML/DOM/HTMLBodyElement.h>
|
||||
|
||||
HTMLBodyElement::HTMLBodyElement(Document& document, const String& tag_name)
|
||||
|
@ -25,3 +26,20 @@ void HTMLBodyElement::apply_presentational_hints(StyleProperties& style) const
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
void HTMLBodyElement::parse_attribute(const String& name, const String& value)
|
||||
{
|
||||
if (name == "link") {
|
||||
auto color = Color::from_string(value);
|
||||
if (color.has_value())
|
||||
document().set_link_color(color.value());
|
||||
} else if (name == "alink") {
|
||||
auto color = Color::from_string(value);
|
||||
if (color.has_value())
|
||||
document().set_active_link_color(color.value());
|
||||
} else if (name == "vlink") {
|
||||
auto color = Color::from_string(value);
|
||||
if (color.has_value())
|
||||
document().set_visited_link_color(color.value());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue