mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 01:32:14 -05:00
f87041bf3a
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
46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
/*
|
|
* Copyright (c) 2022, Andrew Kaster <akaster@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/TypeCasts.h>
|
|
#include <LibGC/Ptr.h>
|
|
#include <LibJS/Runtime/Realm.h>
|
|
#include <LibWeb/Bindings/HostDefined.h>
|
|
#include <LibWeb/Forward.h>
|
|
|
|
namespace Web::Bindings {
|
|
|
|
struct PrincipalHostDefined : public HostDefined {
|
|
PrincipalHostDefined(GC::Ref<HTML::EnvironmentSettingsObject> eso, GC::Ref<Intrinsics> intrinsics, GC::Ref<Page> page)
|
|
: HostDefined(intrinsics)
|
|
, environment_settings_object(eso)
|
|
, page(page)
|
|
{
|
|
}
|
|
virtual ~PrincipalHostDefined() override = default;
|
|
virtual void visit_edges(JS::Cell::Visitor& visitor) override;
|
|
|
|
GC::Ref<HTML::EnvironmentSettingsObject> environment_settings_object;
|
|
GC::Ref<Page> page;
|
|
};
|
|
|
|
[[nodiscard]] inline HTML::EnvironmentSettingsObject& principal_host_defined_environment_settings_object(JS::Realm& realm)
|
|
{
|
|
return *verify_cast<PrincipalHostDefined>(realm.host_defined())->environment_settings_object;
|
|
}
|
|
|
|
[[nodiscard]] inline HTML::EnvironmentSettingsObject const& principal_host_defined_environment_settings_object(JS::Realm const& realm)
|
|
{
|
|
return *verify_cast<PrincipalHostDefined>(realm.host_defined())->environment_settings_object;
|
|
}
|
|
|
|
[[nodiscard]] inline Page& principal_host_defined_page(JS::Realm& realm)
|
|
{
|
|
return *verify_cast<PrincipalHostDefined>(realm.host_defined())->page;
|
|
}
|
|
|
|
}
|