diff options
author | FalseHonesty <thefalsehonesty@gmail.com> | 2020-05-23 13:03:13 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-24 02:20:08 +0200 |
commit | 51e79a2bbcd1652d1980df301a72da72ee82f175 (patch) | |
tree | bc0d338a821cdbf1d533e7b3256ac483ab68ff70 /Libraries | |
parent | 391237a8e1dcd4467702977b51f23adf3a9e640d (diff) | |
download | serenity-51e79a2bbcd1652d1980df301a72da72ee82f175.zip |
LibWeb: Add hook to HtmlView when a new document is set
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibWeb/HtmlView.cpp | 3 | ||||
-rw-r--r-- | Libraries/LibWeb/HtmlView.h | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/Libraries/LibWeb/HtmlView.cpp b/Libraries/LibWeb/HtmlView.cpp index 57403b9a61..49bd81d61d 100644 --- a/Libraries/LibWeb/HtmlView.cpp +++ b/Libraries/LibWeb/HtmlView.cpp @@ -89,6 +89,9 @@ void HtmlView::set_document(Document* new_document) main_frame().set_document(new_document); + if (on_set_document) + on_set_document(new_document); + if (new_document) { new_document->on_layout_updated = [this] { layout_and_sync_size(); diff --git a/Libraries/LibWeb/HtmlView.h b/Libraries/LibWeb/HtmlView.h index 4804a12087..649535227e 100644 --- a/Libraries/LibWeb/HtmlView.h +++ b/Libraries/LibWeb/HtmlView.h @@ -65,6 +65,7 @@ public: Function<void(const URL&)> on_load_start; Function<void(const Gfx::Bitmap&)> on_favicon_change; Function<void(const URL&)> on_url_drop; + Function<void(Document*)> on_set_document; virtual bool accepts_focus() const override { return true; } |