mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Ensure layout is up to date before resolving canvas colors
This commit is contained in:
parent
4dbae64dce
commit
9da723b5c6
Notes:
github-actions[bot]
2025-10-27 23:57:00 +00:00
Author: https://github.com/tcl3
Commit: 9da723b5c6
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6600
Reviewed-by: https://github.com/gmta ✅
11 changed files with 210 additions and 56 deletions
|
|
@ -43,8 +43,10 @@ void CanvasFillStrokeStyles<IncludingClass>::set_fill_style(FillOrStrokeStyleVar
|
|||
if (style_value && style_value->has_color()) {
|
||||
CSS::ColorResolutionContext color_resolution_context {};
|
||||
|
||||
if (context && context->layout_node()) {
|
||||
color_resolution_context = CSS::ColorResolutionContext::for_layout_node_with_style(*context->layout_node());
|
||||
if (context) {
|
||||
context->document().update_layout(DOM::UpdateLayoutReason::CanvasRenderingContext2DSetFillStyle);
|
||||
if (context->layout_node())
|
||||
color_resolution_context = CSS::ColorResolutionContext::for_layout_node_with_style(*context->layout_node());
|
||||
}
|
||||
|
||||
auto parsedValue = style_value->to_color(color_resolution_context).value_or(Color::Black);
|
||||
|
|
@ -97,8 +99,10 @@ void CanvasFillStrokeStyles<IncludingClass>::set_stroke_style(FillOrStrokeStyleV
|
|||
if (style_value && style_value->has_color()) {
|
||||
CSS::ColorResolutionContext color_resolution_context {};
|
||||
|
||||
if (context && context->layout_node()) {
|
||||
color_resolution_context = CSS::ColorResolutionContext::for_layout_node_with_style(*context->layout_node());
|
||||
if (context) {
|
||||
context->document().update_layout(DOM::UpdateLayoutReason::CanvasRenderingContext2DSetStrokeStyle);
|
||||
if (context->layout_node())
|
||||
color_resolution_context = CSS::ColorResolutionContext::for_layout_node_with_style(*context->layout_node());
|
||||
}
|
||||
|
||||
auto parsedValue = style_value->to_color(color_resolution_context).value_or(Color::Black);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue