mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-11-04 07:10:57 +00:00 
			
		
		
		
	Resulting in a massive rename across almost everywhere! Alongside the namespace change, we now have the following names: * JS::NonnullGCPtr -> GC::Ref * JS::GCPtr -> GC::Ptr * JS::HeapFunction -> GC::Function * JS::CellImpl -> GC::Cell * JS::Handle -> GC::Root
		
			
				
	
	
		
			43 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
/*
 | 
						|
 * Copyright (c) 2024, Tim Flynn <trflynn89@ladybird.org>
 | 
						|
 *
 | 
						|
 * SPDX-License-Identifier: BSD-2-Clause
 | 
						|
 */
 | 
						|
 | 
						|
#include <LibJS/Runtime/Realm.h>
 | 
						|
#include <LibWeb/HTML/Navigable.h>
 | 
						|
#include <LibWeb/HTML/NavigationObserver.h>
 | 
						|
 | 
						|
namespace Web::HTML {
 | 
						|
 | 
						|
GC_DEFINE_ALLOCATOR(NavigationObserver);
 | 
						|
 | 
						|
NavigationObserver::NavigationObserver(JS::Realm& realm, Navigable& navigable)
 | 
						|
    : Bindings::PlatformObject(realm)
 | 
						|
    , m_navigable(navigable)
 | 
						|
{
 | 
						|
    m_navigable->register_navigation_observer({}, *this);
 | 
						|
}
 | 
						|
 | 
						|
void NavigationObserver::visit_edges(Cell::Visitor& visitor)
 | 
						|
{
 | 
						|
    Base::visit_edges(visitor);
 | 
						|
    visitor.visit(m_navigable);
 | 
						|
    visitor.visit(m_navigation_complete);
 | 
						|
}
 | 
						|
 | 
						|
void NavigationObserver::finalize()
 | 
						|
{
 | 
						|
    Base::finalize();
 | 
						|
    m_navigable->unregister_navigation_observer({}, *this);
 | 
						|
}
 | 
						|
 | 
						|
void NavigationObserver::set_navigation_complete(Function<void()> callback)
 | 
						|
{
 | 
						|
    if (callback)
 | 
						|
        m_navigation_complete = GC::create_function(vm().heap(), move(callback));
 | 
						|
    else
 | 
						|
        m_navigation_complete = nullptr;
 | 
						|
}
 | 
						|
 | 
						|
}
 |