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:
parent
0166a1fa74
commit
78f10942ba
4 changed files with 9 additions and 0 deletions
|
@ -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()
|
||||
|
|
|
@ -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() { }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue