1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 07:28:11 +00:00

LibWeb: Add pair of methods to apply/reset scroll offset of paintable

Separate scroll application from before_children_paint and
after_children_paint.
This commit is contained in:
Aliaksandr Kalenik 2023-12-11 16:47:40 +01:00 committed by Andreas Kling
parent 8eacb81eba
commit 2952f01e84
4 changed files with 9 additions and 4 deletions

View file

@ -430,14 +430,14 @@ Optional<CSSPixelRect> PaintableBox::calculate_overflow_clipped_rect() const
return m_clip_rect;
}
void PaintableBox::before_children_paint(PaintContext& context, PaintPhase) const
void PaintableBox::apply_scroll_offset(PaintContext& context, PaintPhase) const
{
auto scroll_offset = -this->scroll_offset();
context.translate_scroll_offset_by(scroll_offset);
context.recording_painter().translate({ context.enclosing_device_pixels(scroll_offset.x()), context.enclosing_device_pixels(scroll_offset.y()) });
}
void PaintableBox::after_children_paint(PaintContext& context, PaintPhase) const
void PaintableBox::reset_scroll_offset(PaintContext& context, PaintPhase) const
{
auto scroll_offset = this->scroll_offset();
context.translate_scroll_offset_by(scroll_offset);