1
Fork 0
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:
Conrad Pankoff 2019-10-06 22:58:18 +11:00 committed by Andreas Kling
parent 15a016d3e3
commit ef8b754a46
3 changed files with 15 additions and 0 deletions

View file

@ -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);