1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibWeb: Update PageView content size on page relayout

If the layout changes and the page becomes taller or shorter for some
reason, we need to update the PageView's scrollable content size.
This commit is contained in:
Andreas Kling 2020-06-23 18:02:08 +02:00
parent 0166a1fa74
commit 78f10942ba
4 changed files with 9 additions and 0 deletions

View file

@ -245,6 +245,8 @@ void Document::layout()
}
m_layout_root->layout();
m_layout_root->set_needs_display();
frame()->page().client().page_did_layout();
}
void Document::update_style()

View file

@ -84,6 +84,7 @@ public:
virtual void page_did_request_scroll_to_anchor([[maybe_unused]] const String& fragment) { }
virtual void page_did_invalidate(const Gfx::IntRect&) { }
virtual void page_did_change_favicon(const Gfx::Bitmap&) { }
virtual void page_did_layout() { }
};
}

View file

@ -66,6 +66,11 @@ PageView::~PageView()
{
}
void PageView::page_did_layout()
{
set_content_size(layout_root()->size().to_int_size());
}
void PageView::page_did_change_title(const String& title)
{
if (on_title_change)

View file

@ -108,6 +108,7 @@ private:
virtual void page_did_request_scroll_to_anchor(const String& fragment) override;
virtual void page_did_invalidate(const Gfx::IntRect&) override;
virtual void page_did_change_favicon(const Gfx::Bitmap&) override;
virtual void page_did_layout() override;
void layout_and_sync_size();