mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 16:47:34 +00:00
LibWeb: Apply scroll offset to PushStackingContext command
In cases where the stacking context painting requires a separate bitmap, the destination position needs to be translated by the scrolling offset to ensure it ends up in the correct position.
This commit is contained in:
parent
384c6cf0f9
commit
5484062095
5 changed files with 150 additions and 1 deletions
|
@ -198,6 +198,8 @@ public:
|
|||
void set_enclosing_scroll_frame_offset(CSSPixelPoint offset) { m_enclosing_scroll_frame_offset = offset; }
|
||||
void set_corner_clip_radii(BorderRadiiData const& corner_radii) { m_corner_clip_radii = corner_radii; }
|
||||
|
||||
Optional<int> scroll_frame_id() const { return m_scroll_frame_id; }
|
||||
|
||||
protected:
|
||||
explicit PaintableBox(Layout::Box const&);
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ struct PushStackingContext {
|
|||
|
||||
void translate_by(Gfx::IntPoint const& offset)
|
||||
{
|
||||
post_transform_translation.translate_by(offset);
|
||||
source_paintable_rect.translate_by(offset);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -319,9 +319,13 @@ void StackingContext::paint(PaintContext& context) const
|
|||
}
|
||||
}
|
||||
|
||||
context.recording_painter().save();
|
||||
if (paintable().is_paintable_box() && paintable_box().scroll_frame_id().has_value())
|
||||
context.recording_painter().set_scroll_frame_id(*paintable_box().scroll_frame_id());
|
||||
context.recording_painter().push_stacking_context(push_stacking_context_params);
|
||||
paint_internal(context);
|
||||
context.recording_painter().pop_stacking_context();
|
||||
context.recording_painter().restore();
|
||||
}
|
||||
|
||||
template<typename Callback>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue