mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 03:37:53 +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:
@@ -29,12 +29,10 @@ String StyleProperties::string_or_fallback(const StringView& property_name, cons
|
||||
return value.value()->to_string();
|
||||
}
|
||||
|
||||
Color StyleProperties::color_or_fallback(const StringView& property_name, Color fallback) const
|
||||
Color StyleProperties::color_or_fallback(const StringView& property_name, const Document& document, Color fallback) const
|
||||
{
|
||||
auto value = property(property_name);
|
||||
if (!value.has_value())
|
||||
return fallback;
|
||||
if (value.value()->type() != StyleValue::Type::Color)
|
||||
return fallback;
|
||||
return static_cast<ColorStyleValue&>(*value.value()).color();
|
||||
return value.value()->to_color(document);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user