mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:07:34 +00:00
LibWeb+WebContent: Don't relayout page on every scroll event
The WebContent process was redoing page layout every time you scrolled the page. This was a huge CPU hog for no reason. Fix this by only doing a relayout when the viewport is resized, not when it moves around.
This commit is contained in:
parent
964894dee6
commit
f24b674d7a
3 changed files with 24 additions and 4 deletions
|
@ -100,10 +100,7 @@ void PageHost::paint(const Gfx::IntRect& content_rect, Gfx::Bitmap& target)
|
|||
|
||||
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()->update_layout();
|
||||
page().main_frame().set_viewport_scroll_offset(rect.location());
|
||||
page().main_frame().set_viewport_rect(rect);
|
||||
}
|
||||
|
||||
void PageHost::page_did_invalidate(const Gfx::IntRect& content_rect)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue