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

@ -1174,7 +1174,8 @@ Optional<String> effective_command_value(GC::Ptr<DOM::Node> node, FlyString cons
if (!background_color.has_value())
return NumericLimits<u8>::max();
VERIFY(is<Layout::NodeWithStyle>(node->layout_node()));
return background_color.value()->to_color(*static_cast<Layout::NodeWithStyle*>(node->layout_node()), {}).alpha();
auto& layout_node = *static_cast<Layout::NodeWithStyle*>(node->layout_node());
return background_color.value()->to_color(layout_node, { .length_resolution_context = CSS::Length::ResolutionContext::for_layout_node(layout_node) }).alpha();
};
while (resolved_background_alpha() == 0 && node->parent() && is<DOM::Element>(*node->parent()))
node = node->parent();