diff --git a/Tests/LibWeb/Ref/reference/svg-inside-scroll-container-ref.html b/Tests/LibWeb/Ref/reference/svg-inside-scroll-container-ref.html new file mode 100644 index 0000000000..54288b73f6 --- /dev/null +++ b/Tests/LibWeb/Ref/reference/svg-inside-scroll-container-ref.html @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/Tests/LibWeb/Ref/svg-inside-scroll-container.html b/Tests/LibWeb/Ref/svg-inside-scroll-container.html new file mode 100644 index 0000000000..7eb86cd434 --- /dev/null +++ b/Tests/LibWeb/Ref/svg-inside-scroll-container.html @@ -0,0 +1,32 @@ + + + +
+ + + + + + + + + + + + + + + +
+ diff --git a/Userland/Libraries/LibWeb/Painting/SVGSVGPaintable.cpp b/Userland/Libraries/LibWeb/Painting/SVGSVGPaintable.cpp index c7354a630c..08dbd6d990 100644 --- a/Userland/Libraries/LibWeb/Painting/SVGSVGPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/SVGSVGPaintable.cpp @@ -30,7 +30,9 @@ void SVGSVGPaintable::before_children_paint(PaintContext& context, PaintPhase ph if (phase != PaintPhase::Foreground) return; context.recording_painter().save(); - context.recording_painter().add_clip_rect(context.enclosing_device_rect(absolute_rect()).to_type()); + auto clip_rect = absolute_rect(); + clip_rect.translate_by(enclosing_scroll_frame_offset().value_or({})); + context.recording_painter().add_clip_rect(context.enclosing_device_rect(clip_rect).to_type()); } void SVGSVGPaintable::after_children_paint(PaintContext& context, PaintPhase phase) const