mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:17:45 +00:00
LibWeb: Take in account scroll offset in painting
This commit is contained in:
parent
3eb9ae4ed5
commit
fa56ce11a9
1 changed files with 10 additions and 2 deletions
|
@ -26,8 +26,16 @@ namespace Web::Painting {
|
||||||
|
|
||||||
static void paint_node(Layout::Node const& layout_node, PaintContext& context, PaintPhase phase)
|
static void paint_node(Layout::Node const& layout_node, PaintContext& context, PaintPhase phase)
|
||||||
{
|
{
|
||||||
if (auto const* paintable = layout_node.paintable())
|
if (auto const* paintable = layout_node.paintable()) {
|
||||||
paintable->paint(context, phase);
|
if (paintable->containing_block() && paintable->containing_block()->is_scrollable()) {
|
||||||
|
Gfx::PainterStateSaver saver(context.painter());
|
||||||
|
auto scroll_offset = -paintable->containing_block()->scroll_offset();
|
||||||
|
context.painter().translate({ context.enclosing_device_pixels(scroll_offset.x()), context.enclosing_device_pixels(scroll_offset.y()) });
|
||||||
|
paintable->paint(context, phase);
|
||||||
|
} else {
|
||||||
|
paintable->paint(context, phase);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StackingContext::StackingContext(Layout::Box& box, StackingContext* parent, size_t index_in_tree_order)
|
StackingContext::StackingContext(Layout::Box& box, StackingContext* parent, size_t index_in_tree_order)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue