diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index 2e6b1e86d7..1342715d5b 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -262,6 +262,9 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style) { auto& computed_values = static_cast(m_computed_values); + // NOTE: color must be set first to ensure currentColor can be resolved in other properties (e.g. background-color). + computed_values.set_color(computed_style.color_or_fallback(CSS::PropertyID::Color, *this, CSS::InitialValues::color())); + // NOTE: We have to be careful that font-related properties get set in the right order. // m_font is used by Length::to_px() when resolving sizes against this layout node. // That's why it has to be set before everything else. @@ -531,8 +534,6 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style) const_cast(*m_list_style_image).load_any_resources(document()); } - computed_values.set_color(computed_style.color_or_fallback(CSS::PropertyID::Color, *this, CSS::InitialValues::color())); - // FIXME: The default text decoration color value is `currentcolor`, but since we can't resolve that easily, // we just manually grab the value from `color`. This makes it dependent on `color` being // specified first, so it's far from ideal.