diff options
Diffstat (limited to 'Userland/Libraries/LibWeb/DOM/DocumentObserver.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/DocumentObserver.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/DocumentObserver.cpp b/Userland/Libraries/LibWeb/DOM/DocumentObserver.cpp new file mode 100644 index 0000000000..7ca2642af9 --- /dev/null +++ b/Userland/Libraries/LibWeb/DOM/DocumentObserver.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include <LibJS/Runtime/Realm.h> +#include <LibWeb/DOM/Document.h> +#include <LibWeb/DOM/DocumentObserver.h> + +namespace Web::DOM { + +DocumentObserver::DocumentObserver(JS::Realm& realm, DOM::Document& document) + : Bindings::PlatformObject(realm) + , m_document(document) +{ + m_document->register_document_observer({}, *this); +} + +void DocumentObserver::visit_edges(Cell::Visitor& visitor) +{ + Base::visit_edges(visitor); + visitor.visit(m_document); +} + +void DocumentObserver::finalize() +{ + Base::finalize(); + m_document->unregister_document_observer({}, *this); +} + +} |