mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWeb: Layout viewport rect was lagging behind when resizing
Layout was using an outdated viewport rect that we set *after* doing a layout due to resize. That meant that layout-in-response-to-resize was always lagging behind the current size of the view. The root of this problem was how Frame kept both a viewport rect (with both scroll offset and size) and a frame size. To fix this, only store the viewport scroll offset, and always use the frame size. This way they can't get out of sync and the problem goes away. :^) Fixes #4250.
This commit is contained in:
@@ -103,7 +103,7 @@ void PageHost::set_viewport_rect(const Gfx::IntRect& rect)
|
||||
page().main_frame().set_size(rect.size());
|
||||
if (page().main_frame().document())
|
||||
page().main_frame().document()->layout();
|
||||
page().main_frame().set_viewport_rect(rect);
|
||||
page().main_frame().set_viewport_scroll_offset(rect.location());
|
||||
}
|
||||
|
||||
void PageHost::page_did_invalidate(const Gfx::IntRect& content_rect)
|
||||
|
||||
Reference in New Issue
Block a user