1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:48:14 +00:00

LibWeb: Implement currentcolor special value

The `currentcolor` identifier represents the current value of the
`color` property. This is the default value for `border-color` and
`text-decoration-color`, and is generally useful to have. :^)
This commit is contained in:
Sam Atkins 2021-09-16 19:40:56 +01:00 committed by Andreas Kling
parent 86f78bff2a
commit 17bb913625
3 changed files with 9 additions and 0 deletions

View file

@ -33,6 +33,12 @@ String IdentifierStyleValue::to_string() const
Color IdentifierStyleValue::to_color(Layout::NodeWithStyle const& node) const
{
if (id() == CSS::ValueID::Currentcolor) {
if (!node.has_style())
return Color::Black;
return node.computed_values().color();
}
auto& document = node.document();
if (id() == CSS::ValueID::LibwebLink)
return document.link_color();