LibWeb: Resolve mask/clip in foreignObject's own coordinate space

We were neglecting to resolve these correctly, which caused them to get
the same metrics as the nearest viewport above the foreignObject.
This commit is contained in:
Andreas Kling 2025-07-09 13:18:29 +02:00 committed by Andreas Kling
commit aae0b52403
Notes: github-actions[bot] 2025-07-09 12:37:30 +00:00
3 changed files with 35 additions and 4 deletions

View file

@ -295,10 +295,11 @@ void SVGFormattingContext::layout_svg_element(Box const& child)
child_state.set_content_offset(transformed_rect.location());
child_state.set_content_width(transformed_rect.width());
child_state.set_content_height(transformed_rect.height());
child.for_each_child_of_type<SVGMaskBox>([&](SVGMaskBox const& child) {
layout_svg_element(child);
return IterationDecision::Continue;
});
if (auto* mask_box = child.first_child_of_type<SVGMaskBox>())
layout_mask_or_clip(*mask_box);
if (auto* clip_box = child.first_child_of_type<SVGClipBox>())
layout_mask_or_clip(*clip_box);
} else if (is<SVGGraphicsBox>(child)) {
layout_graphics_element(static_cast<SVGGraphicsBox const&>(child));
}