1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 19:45:08 +00:00

LibWeb: Use Layout::Box::paint_box() accessor in more places

This commit is contained in:
Andreas Kling 2022-03-10 15:50:16 +01:00
parent 02b316fd5c
commit 9461e44afa
22 changed files with 60 additions and 61 deletions

View file

@ -62,8 +62,8 @@ void InProcessWebView::set_preferred_color_scheme(CSS::PreferredColorScheme colo
void InProcessWebView::page_did_layout()
{
VERIFY(layout_root());
VERIFY(layout_root()->m_paint_box);
set_content_size(layout_root()->m_paint_box->content_size().to_type<int>());
VERIFY(layout_root()->paint_box());
set_content_size(layout_root()->paint_box()->content_size().to_type<int>());
}
void InProcessWebView::page_did_change_title(const String& title)
@ -179,13 +179,13 @@ void InProcessWebView::layout_and_sync_size()
bool had_horizontal_scrollbar = horizontal_scrollbar().is_visible();
page().top_level_browsing_context().set_size(available_size());
set_content_size(layout_root()->m_paint_box->content_size().to_type<int>());
set_content_size(layout_root()->paint_box()->content_size().to_type<int>());
// 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().top_level_browsing_context().set_size(available_size());
set_content_size(layout_root()->m_paint_box->content_size().to_type<int>());
set_content_size(layout_root()->paint_box()->content_size().to_type<int>());
}
page().top_level_browsing_context().set_viewport_scroll_offset({ horizontal_scrollbar().value(), vertical_scrollbar().value() });