mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 02:09:24 +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:
parent
8eacb81eba
commit
2952f01e84
Notes:
sideshowbarker
2024-07-17 09:37:30 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 2952f01e84
Pull-request: https://github.com/SerenityOS/serenity/pull/22253
Issue: https://github.com/SerenityOS/serenity/issues/20554
4 changed files with 9 additions and 4 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue