1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:37:35 +00:00

LibWeb: Shift SVG paintable clip rectangle by scroll offset

Rectangles should be recorded using absolute coordinates, including
the scroll offset.
This commit is contained in:
Aliaksandr Kalenik 2024-02-06 11:14:32 +01:00 committed by Andreas Kling
parent 677bcea771
commit d43dbe2842
3 changed files with 50 additions and 1 deletions

View file

@ -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<int>());
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<int>());
}
void SVGSVGPaintable::after_children_paint(PaintContext& context, PaintPhase phase) const