LibWeb: Take a ColorResolutionContext in color_or_fallback

Taking a ColorResolutionContext directly instead of creating one from a
layout node allows us to call this from places where we don't have a
layout node.
This commit is contained in:
Callum Law 2025-07-19 13:28:14 +12:00 committed by Sam Atkins
commit a19a6deaa4
Notes: github-actions[bot] 2025-08-04 10:30:45 +00:00
3 changed files with 8 additions and 8 deletions

View file

@ -224,12 +224,12 @@ LengthBox ComputedProperties::length_box(PropertyID left_id, PropertyID top_id,
return box;
}
Color ComputedProperties::color_or_fallback(PropertyID id, Layout::NodeWithStyle const& node, Color fallback) const
Color ComputedProperties::color_or_fallback(PropertyID id, ColorResolutionContext color_resolution_context, Color fallback) const
{
auto const& value = property(id);
if (!value.has_color())
return fallback;
return value.to_color(ColorResolutionContext::for_layout_node_with_style(node)).value();
return value.to_color(color_resolution_context).value();
}
// https://drafts.csswg.org/css-color-adjust-1/#determine-the-used-color-scheme