mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:18:11 +00:00
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. :^)
This commit is contained in:
parent
15e35b0d71
commit
4fe987ba00
1 changed files with 0 additions and 2 deletions
|
@ -237,14 +237,12 @@ void InProcessWebView::layout_and_sync_size()
|
||||||
bool had_horizontal_scrollbar = horizontal_scrollbar().is_visible();
|
bool had_horizontal_scrollbar = horizontal_scrollbar().is_visible();
|
||||||
|
|
||||||
page().main_frame().set_size(available_size());
|
page().main_frame().set_size(available_size());
|
||||||
document()->layout();
|
|
||||||
set_content_size(layout_root()->size().to_type<int>());
|
set_content_size(layout_root()->size().to_type<int>());
|
||||||
|
|
||||||
// NOTE: If layout caused us to gain or lose scrollbars, we have to lay out again
|
// 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.
|
// 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()) {
|
if (had_vertical_scrollbar != vertical_scrollbar().is_visible() || had_horizontal_scrollbar != horizontal_scrollbar().is_visible()) {
|
||||||
page().main_frame().set_size(available_size());
|
page().main_frame().set_size(available_size());
|
||||||
document()->layout();
|
|
||||||
set_content_size(layout_root()->size().to_type<int>());
|
set_content_size(layout_root()->size().to_type<int>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue