LibWeb: Allow SVG root elements to have visible overflow

We were overly aggressive in clipping SVG roots, which effectively made
them behave as if they always had `overflow: hidden`.

This fixes incorrect clipping of the logo on https://basecamp.com/
This commit is contained in:
Andreas Kling 2024-10-07 08:09:25 +02:00 committed by Andreas Kling
parent f2134dc1e9
commit 2fdf2b9215
Notes: github-actions[bot] 2024-10-07 07:32:16 +00:00
5 changed files with 28 additions and 2 deletions

View file

@ -0,0 +1,6 @@
<style>
svg {
height: 200px;
}
</style>
<svg class="visible" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="50" height="100" fill="green"></rect></svg>

View file

@ -0,0 +1,6 @@
<style>
svg {
height: 200px;
}
</style>
<svg class="visible" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="50" height="200" fill="green"></rect></svg>

View file

@ -0,0 +1,8 @@
<link rel="match" href="reference/svg-overflow-hidden-ref.html" />
<style>
svg {
width: 100px;
overflow: hidden;
}
</style>
<svg class="visible" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="50" height="200" fill="green"></rect></svg>

View file

@ -0,0 +1,8 @@
<link rel="match" href="reference/svg-overflow-visible-ref.html" />
<style>
svg {
width: 100px;
overflow: visible;
}
</style>
<svg class="visible" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="50" height="200" fill="green"></rect></svg>

View file

@ -32,9 +32,7 @@ void SVGSVGPaintable::before_children_paint(PaintContext& context, PaintPhase ph
if (phase != PaintPhase::Foreground)
return;
context.display_list_recorder().save();
auto clip_rect = absolute_rect();
context.display_list_recorder().set_scroll_frame_id(scroll_frame_id());
context.display_list_recorder().add_clip_rect(context.enclosing_device_rect(clip_rect).to_type<int>());
}
void SVGSVGPaintable::after_children_paint(PaintContext& context, PaintPhase phase) const