mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 06:14:58 +00:00
LibHTML: Add function for invalidating the document layout
This allows any external actor to signal that the document layout may be stale. This can be used when loading resources, changing the size or placement of an element, adding/removing nodes, or really any time.
This commit is contained in:
parent
15a016d3e3
commit
ef8b754a46
3 changed files with 15 additions and 0 deletions
|
@ -31,7 +31,12 @@ void HtmlView::set_document(Document* document)
|
|||
{
|
||||
if (document == m_document)
|
||||
return;
|
||||
|
||||
if (m_document)
|
||||
m_document->on_invalidate_layout = nullptr;
|
||||
|
||||
m_document = document;
|
||||
m_document->on_invalidate_layout = [this]() { layout_and_sync_size(); };
|
||||
|
||||
main_frame().set_document(document);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue