From 4fe987ba00b93745537277b6451d8f87dc964a30 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 2 Dec 2020 23:43:54 +0100 Subject: [PATCH] LibWeb: Don't layout twice for every InProcessWebView resize event Calling Frame::set_size() already triggered a relayout, so calling layout() again right after meant we did all the work one more time. Not being dumb like this makes resizing significantly smoother. :^) --- Libraries/LibWeb/InProcessWebView.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Libraries/LibWeb/InProcessWebView.cpp b/Libraries/LibWeb/InProcessWebView.cpp index c878f20750..40f33b32e3 100644 --- a/Libraries/LibWeb/InProcessWebView.cpp +++ b/Libraries/LibWeb/InProcessWebView.cpp @@ -237,14 +237,12 @@ void InProcessWebView::layout_and_sync_size() bool had_horizontal_scrollbar = horizontal_scrollbar().is_visible(); page().main_frame().set_size(available_size()); - document()->layout(); set_content_size(layout_root()->size().to_type()); // NOTE: If layout caused us to gain or lose scrollbars, we have to lay out again // since the scrollbars now take up some of the available space. if (had_vertical_scrollbar != vertical_scrollbar().is_visible() || had_horizontal_scrollbar != horizontal_scrollbar().is_visible()) { page().main_frame().set_size(available_size()); - document()->layout(); set_content_size(layout_root()->size().to_type()); }