mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:52:45 +00:00 
			
		
		
		
	 70193c0009
			
		
	
	
		70193c0009
		
	
	
	
	
		
			
			With this change, Document now always has a Web::Page. This means we no longer rely on the breakable link between Document and BrowsingContext to find a relevant Web::Page. Fixes #22290
		
			
				
	
	
		
			41 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2022, Andrew Kaster <akaster@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/TypeCasts.h>
 | |
| #include <LibJS/Heap/GCPtr.h>
 | |
| #include <LibJS/Runtime/Realm.h>
 | |
| #include <LibWeb/Forward.h>
 | |
| 
 | |
| namespace Web::Bindings {
 | |
| 
 | |
| struct HostDefined : public JS::Realm::HostDefined {
 | |
|     HostDefined(JS::NonnullGCPtr<HTML::EnvironmentSettingsObject> eso, JS::NonnullGCPtr<Intrinsics> intrinsics, JS::NonnullGCPtr<Page> page)
 | |
|         : environment_settings_object(eso)
 | |
|         , intrinsics(intrinsics)
 | |
|         , page(page)
 | |
|     {
 | |
|     }
 | |
|     virtual ~HostDefined() override = default;
 | |
|     virtual void visit_edges(JS::Cell::Visitor& visitor) override;
 | |
| 
 | |
|     JS::NonnullGCPtr<HTML::EnvironmentSettingsObject> environment_settings_object;
 | |
|     JS::NonnullGCPtr<Intrinsics> intrinsics;
 | |
|     JS::NonnullGCPtr<Page> page;
 | |
| };
 | |
| 
 | |
| [[nodiscard]] inline HTML::EnvironmentSettingsObject& host_defined_environment_settings_object(JS::Realm& realm)
 | |
| {
 | |
|     return *verify_cast<HostDefined>(realm.host_defined())->environment_settings_object;
 | |
| }
 | |
| 
 | |
| [[nodiscard]] inline Page& host_defined_page(JS::Realm& realm)
 | |
| {
 | |
|     return *verify_cast<HostDefined>(realm.host_defined())->page;
 | |
| }
 | |
| 
 | |
| }
 |