LibWeb: Ensure layout is up to date before resolving canvas colors

This commit is contained in:
Tim Ledbetter 2025-10-27 10:06:59 +00:00 committed by Jelle Raaijmakers
parent 4dbae64dce
commit 9da723b5c6
Notes: github-actions[bot] 2025-10-27 23:57:00 +00:00
11 changed files with 210 additions and 56 deletions

View file

@ -1053,9 +1053,9 @@ void CanvasRenderingContext2D::set_shadow_color(String color)
auto style_value = parse_css_value(CSS::Parser::ParsingParams(), color, CSS::PropertyID::Color);
if (style_value && style_value->has_color()) {
CSS::ColorResolutionContext color_resolution_context {};
context.document().update_layout(DOM::UpdateLayoutReason::CanvasRenderingContext2DSetShadowColor);
if (auto node = context.layout_node()) {
color_resolution_context = CSS::ColorResolutionContext::for_layout_node_with_style(*context.layout_node());
color_resolution_context = CSS::ColorResolutionContext::for_layout_node_with_style(*node);
}
auto parsedValue = style_value->to_color(color_resolution_context).value_or(Color::Black);