mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:32:44 +00:00 
			
		
		
		
	 f78eadf00f
			
		
	
	
		f78eadf00f
		
	
	
	
	
		
			
			Some HTML elements, e.g. HTMLMediaElement, need to take action when the document becomes inactive.
		
			
				
	
	
		
			32 lines
		
	
	
	
		
			692 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
	
		
			692 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * 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);
 | |
| }
 | |
| 
 | |
| }
 |