LibWeb: Support relative lengths in calc color values

Gains us ~40 WPT tests.
This commit is contained in:
Callum Law 2025-06-29 17:18:05 +12:00 committed by Sam Atkins
commit 9ab7c5d08d
Notes: github-actions[bot] 2025-07-04 12:20:09 +00:00
17 changed files with 169 additions and 74 deletions

View file

@ -1687,10 +1687,13 @@ void Document::obtain_theme_color()
// 4. If color is not failure, then return color.
if (!css_value.is_null() && css_value->has_color()) {
Optional<Layout::NodeWithStyle const&> root_node;
if (html_element() && html_element()->layout_node())
CSS::CalculationResolutionContext resolution_context;
if (html_element() && html_element()->layout_node()) {
root_node = *html_element()->layout_node();
resolution_context.length_resolution_context = CSS::Length::ResolutionContext::for_layout_node(*html_element()->layout_node());
}
theme_color = css_value->to_color(root_node, {});
theme_color = css_value->to_color(root_node, resolution_context);
return TraversalDecision::Break;
}
}