1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 18:55:07 +00:00

LibWeb: Add basic support for position:fixed

Fixed position elements have the ICB as their containing block.
The magic of fixed positioning is implemented at the rendering stage,
where we temporarily translate painting by the current scroll offset.

Note that "absolutely positioned" includes both position:absolute
and position:fixed.
This commit is contained in:
Andreas Kling 2020-06-12 14:19:03 +02:00
parent bd33bfd120
commit 137f6d44ec
8 changed files with 27 additions and 11 deletions

View file

@ -207,7 +207,7 @@ void PageView::paint_event(GUI::PaintEvent& event)
painter.translate(frame_thickness(), frame_thickness());
painter.translate(-horizontal_scrollbar().value(), -vertical_scrollbar().value());
RenderingContext context(painter, palette());
RenderingContext context(painter, palette(), { horizontal_scrollbar().value(), vertical_scrollbar().value() });
context.set_should_show_line_box_borders(m_should_show_line_box_borders);
context.set_viewport_rect(viewport_rect_in_content_coordinates());
layout_root()->render(context);