1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:27:45 +00:00

LibWeb: Add an interface to be notified of Document state changes

Some HTML elements, e.g. HTMLMediaElement, need to take action when the
document becomes inactive.
This commit is contained in:
Timothy Flynn 2023-05-04 08:48:53 -04:00 committed by Andreas Kling
parent 88b8969443
commit f78eadf00f
6 changed files with 92 additions and 1 deletions

View file

@ -394,6 +394,9 @@ public:
void register_node_iterator(Badge<NodeIterator>, NodeIterator&);
void unregister_node_iterator(Badge<NodeIterator>, NodeIterator&);
void register_document_observer(Badge<DocumentObserver>, DocumentObserver&);
void unregister_document_observer(Badge<DocumentObserver>, DocumentObserver&);
template<typename Callback>
void for_each_node_iterator(Callback callback)
{
@ -588,6 +591,8 @@ private:
HashTable<JS::GCPtr<NodeIterator>> m_node_iterators;
HashTable<JS::NonnullGCPtr<DocumentObserver>> m_document_observers;
// https://html.spec.whatwg.org/multipage/dom.html#is-initial-about:blank
bool m_is_initial_about_blank { false };