mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 19:04:58 +00:00
LibHTML: Respect the link color set via <body link>
The default style for "a" tags now has { color: -libhtml-link; }.
We implement this vendor-specific property by querying the containing
document for the appropriate link color.
Currently we only use the basic link color, but in the future this can
be extended to remember visited links, etc.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "StyleValue.h"
|
||||
#include <LibHTML/CSS/StyleValue.h>
|
||||
#include <LibHTML/DOM/Document.h>
|
||||
|
||||
StyleValue::StyleValue(Type type)
|
||||
: m_type(type)
|
||||
@@ -8,3 +9,22 @@ StyleValue::StyleValue(Type type)
|
||||
StyleValue::~StyleValue()
|
||||
{
|
||||
}
|
||||
|
||||
String IdentifierStyleValue::to_string() const
|
||||
{
|
||||
switch (id()) {
|
||||
case CSS::ValueID::Invalid:
|
||||
return "(invalid)";
|
||||
case CSS::ValueID::VendorSpecificLink:
|
||||
return "-libhtml-link";
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
Color IdentifierStyleValue::to_color(const Document& document) const
|
||||
{
|
||||
if (id() == CSS::ValueID::VendorSpecificLink)
|
||||
return document.link_color();
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user