
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.
30 lines
592 B
C++
30 lines
592 B
C++
#include <LibHTML/CSS/StyleValue.h>
|
|
#include <LibHTML/DOM/Document.h>
|
|
|
|
StyleValue::StyleValue(Type type)
|
|
: m_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 {};
|
|
}
|