mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 23:35:08 +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:
parent
83a6474d82
commit
847072c2b1
9 changed files with 68 additions and 13 deletions
|
@ -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 {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue