2020-04-01 13:53:28 -03:00
|
|
|
/*
|
2024-08-04 11:36:50 -03:00
|
|
|
* Copyright (c) 2020-2024, Andreas Kling <andreas@ladybird.org>
|
2023-01-18 14:41:12 -03:00
|
|
|
* Copyright (c) 2021-2023, Linus Groh <linusg@serenityos.org>
|
2020-04-01 13:53:28 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-04-01 13:53:28 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/Badge.h>
|
|
|
|
|
#include <AK/RefPtr.h>
|
2022-09-07 15:30:31 -03:00
|
|
|
#include <AK/TypeCasts.h>
|
2024-11-14 12:01:23 -03:00
|
|
|
#include <LibGC/Heap.h>
|
2024-03-18 00:22:27 -03:00
|
|
|
#include <LibURL/URL.h>
|
2022-09-24 18:39:23 -03:00
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2023-03-05 17:13:00 -03:00
|
|
|
#include <LibWeb/Bindings/WindowGlobalMixin.h>
|
2020-10-18 08:43:44 -03:00
|
|
|
#include <LibWeb/DOM/EventTarget.h>
|
2022-08-28 08:42:07 -03:00
|
|
|
#include <LibWeb/Forward.h>
|
2022-09-24 10:02:47 -03:00
|
|
|
#include <LibWeb/HTML/CrossOrigin/CrossOriginPropertyDescriptorMap.h>
|
2021-09-22 11:39:15 -03:00
|
|
|
#include <LibWeb/HTML/GlobalEventHandlers.h>
|
2023-02-27 21:23:53 -03:00
|
|
|
#include <LibWeb/HTML/MimeType.h>
|
2023-08-22 10:50:49 -03:00
|
|
|
#include <LibWeb/HTML/Navigable.h>
|
2023-02-27 21:23:53 -03:00
|
|
|
#include <LibWeb/HTML/Plugin.h>
|
2023-05-08 02:39:05 -03:00
|
|
|
#include <LibWeb/HTML/ScrollOptions.h>
|
2024-10-17 09:46:48 -03:00
|
|
|
#include <LibWeb/HTML/StructuredSerializeOptions.h>
|
2024-11-08 00:35:16 -03:00
|
|
|
#include <LibWeb/HTML/UniversalGlobalScope.h>
|
2022-06-27 15:48:54 -03:00
|
|
|
#include <LibWeb/HTML/WindowEventHandlers.h>
|
2023-03-06 08:08:15 -03:00
|
|
|
#include <LibWeb/HTML/WindowOrWorkerGlobalScope.h>
|
2023-03-06 20:38:44 -03:00
|
|
|
#include <LibWeb/RequestIdleCallback/IdleRequest.h>
|
2024-08-04 11:36:50 -03:00
|
|
|
#include <LibWeb/WebIDL/Types.h>
|
2020-04-01 13:53:28 -03:00
|
|
|
|
2022-03-07 19:08:26 -03:00
|
|
|
namespace Web::HTML {
|
2020-04-01 13:53:28 -03:00
|
|
|
|
2022-03-31 16:55:01 -03:00
|
|
|
class IdleCallback;
|
2021-09-12 21:03:06 -03:00
|
|
|
|
2023-03-06 17:53:49 -03:00
|
|
|
// https://w3c.github.io/csswg-drafts/cssom-view/#dictdef-scrolltooptions
|
|
|
|
|
struct ScrollToOptions : public ScrollOptions {
|
|
|
|
|
Optional<double> left;
|
|
|
|
|
Optional<double> top;
|
|
|
|
|
};
|
|
|
|
|
|
2023-11-06 17:22:56 -03:00
|
|
|
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#windowpostmessageoptions
|
|
|
|
|
struct WindowPostMessageOptions : public StructuredSerializeOptions {
|
|
|
|
|
String target_origin { "/"_string };
|
|
|
|
|
};
|
|
|
|
|
|
2024-12-03 04:31:14 -03:00
|
|
|
// https://html.spec.whatwg.org/multipage/webappapis.html#specifier-resolution-record
|
|
|
|
|
// A specifier resolution record is a struct. It has the following items:
|
|
|
|
|
struct SpecifierResolution {
|
|
|
|
|
// A serialized base URL
|
|
|
|
|
// A string-or-null that represents the base URL of the specifier, when one exists.
|
|
|
|
|
Optional<String> serialized_base_url;
|
|
|
|
|
|
|
|
|
|
// A specifier
|
|
|
|
|
// A string representing the specifier.
|
|
|
|
|
String specifier;
|
|
|
|
|
|
|
|
|
|
// A specifier as a URL
|
|
|
|
|
// A URL-or-null that represents the URL in case of a URL-like module specifier.
|
|
|
|
|
//
|
|
|
|
|
// Spec-Note: Implementations can replace specifier as a URL with a boolean that indicates
|
|
|
|
|
// that the specifier is either bare or URL-like that is special.
|
|
|
|
|
bool specifier_is_null_or_url_like_that_is_special { false };
|
|
|
|
|
};
|
|
|
|
|
|
2020-10-18 08:43:44 -03:00
|
|
|
class Window final
|
2022-08-28 08:42:07 -03:00
|
|
|
: public DOM::EventTarget
|
2023-03-11 15:11:20 -03:00
|
|
|
, public GlobalEventHandlers
|
|
|
|
|
, public WindowEventHandlers
|
2023-03-06 08:08:15 -03:00
|
|
|
, public WindowOrWorkerGlobalScopeMixin
|
2024-11-08 00:35:16 -03:00
|
|
|
, public UniversalGlobalScopeMixin
|
2023-03-05 12:52:34 -03:00
|
|
|
, public Bindings::WindowGlobalMixin {
|
2022-08-28 08:42:07 -03:00
|
|
|
WEB_PLATFORM_OBJECT(Window, DOM::EventTarget);
|
2024-11-14 12:01:23 -03:00
|
|
|
GC_DECLARE_ALLOCATOR(Window);
|
2022-08-28 08:42:07 -03:00
|
|
|
|
2020-04-01 13:53:28 -03:00
|
|
|
public:
|
2024-11-14 12:01:23 -03:00
|
|
|
[[nodiscard]] static GC::Ref<Window> create(JS::Realm&);
|
2020-04-01 13:53:28 -03:00
|
|
|
|
2022-08-28 08:42:07 -03:00
|
|
|
~Window();
|
2020-10-18 08:43:44 -03:00
|
|
|
|
2024-11-08 00:35:16 -03:00
|
|
|
using UniversalGlobalScopeMixin::atob;
|
|
|
|
|
using UniversalGlobalScopeMixin::btoa;
|
|
|
|
|
using UniversalGlobalScopeMixin::queue_microtask;
|
|
|
|
|
using UniversalGlobalScopeMixin::structured_clone;
|
2023-03-14 08:28:08 -03:00
|
|
|
using WindowOrWorkerGlobalScopeMixin::clear_interval;
|
|
|
|
|
using WindowOrWorkerGlobalScopeMixin::clear_timeout;
|
2024-04-04 22:48:58 -03:00
|
|
|
using WindowOrWorkerGlobalScopeMixin::create_image_bitmap;
|
2023-03-07 15:15:52 -03:00
|
|
|
using WindowOrWorkerGlobalScopeMixin::fetch;
|
2024-07-03 12:28:49 -03:00
|
|
|
using WindowOrWorkerGlobalScopeMixin::report_error;
|
2023-03-14 08:28:08 -03:00
|
|
|
using WindowOrWorkerGlobalScopeMixin::set_interval;
|
|
|
|
|
using WindowOrWorkerGlobalScopeMixin::set_timeout;
|
2023-03-06 08:14:45 -03:00
|
|
|
|
2023-03-06 08:08:15 -03:00
|
|
|
// ^DOM::EventTarget
|
2022-08-08 17:29:40 -03:00
|
|
|
virtual bool dispatch_event(DOM::Event&) override;
|
2020-10-18 08:43:44 -03:00
|
|
|
|
2023-03-06 08:08:15 -03:00
|
|
|
// ^WindowOrWorkerGlobalScopeMixin
|
2024-12-02 10:37:33 -03:00
|
|
|
virtual DOM::EventTarget& this_impl() override { return *this; }
|
|
|
|
|
virtual DOM::EventTarget const& this_impl() const override { return *this; }
|
2023-03-06 08:08:15 -03:00
|
|
|
|
2023-03-11 13:44:15 -03:00
|
|
|
// ^JS::Object
|
|
|
|
|
virtual JS::ThrowCompletionOr<bool> internal_set_prototype_of(JS::Object* prototype) override;
|
|
|
|
|
|
2023-12-15 16:33:16 -03:00
|
|
|
Page& page();
|
|
|
|
|
Page const& page() const;
|
2021-09-09 08:45:03 -03:00
|
|
|
|
2022-03-04 20:13:13 -03:00
|
|
|
// https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window
|
2022-03-07 19:08:26 -03:00
|
|
|
DOM::Document const& associated_document() const { return *m_associated_document; }
|
|
|
|
|
DOM::Document& associated_document() { return *m_associated_document; }
|
2022-08-04 16:19:30 -03:00
|
|
|
void set_associated_document(DOM::Document&);
|
2020-04-01 13:53:28 -03:00
|
|
|
|
2022-03-04 20:13:13 -03:00
|
|
|
// https://html.spec.whatwg.org/multipage/window-object.html#window-bc
|
2023-03-11 15:11:20 -03:00
|
|
|
BrowsingContext const* browsing_context() const;
|
|
|
|
|
BrowsingContext* browsing_context();
|
2022-08-28 08:42:07 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<Navigable> navigable() const;
|
2023-08-22 10:50:49 -03:00
|
|
|
|
2024-12-03 04:31:14 -03:00
|
|
|
void append_resolved_module(SpecifierResolution resolution) { m_resolved_module_set.append(move(resolution)); }
|
|
|
|
|
Vector<SpecifierResolution> const& resolved_module_set() const { return m_resolved_module_set; }
|
2022-10-22 23:05:46 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
WebIDL::ExceptionOr<GC::Ptr<WindowProxy>> window_open_steps(StringView url, StringView target, StringView features);
|
2024-10-20 09:48:52 -03:00
|
|
|
|
|
|
|
|
struct OpenedWindow {
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<Navigable> navigable;
|
2024-10-20 09:48:52 -03:00
|
|
|
TokenizedFeature::NoOpener no_opener { TokenizedFeature::NoOpener::No };
|
|
|
|
|
Navigable::WindowType window_type { Navigable::WindowType::ExistingOrNone };
|
|
|
|
|
};
|
|
|
|
|
WebIDL::ExceptionOr<OpenedWindow> window_open_steps_internal(StringView url, StringView target, StringView features);
|
|
|
|
|
|
2022-08-28 08:42:07 -03:00
|
|
|
DOM::Event* current_event() { return m_current_event.ptr(); }
|
|
|
|
|
DOM::Event const* current_event() const { return m_current_event.ptr(); }
|
2022-08-08 17:29:40 -03:00
|
|
|
void set_current_event(DOM::Event* event);
|
2020-11-21 15:32:39 -03:00
|
|
|
|
2022-03-08 13:51:33 -03:00
|
|
|
Optional<CSS::MediaFeatureValue> query_media_feature(CSS::MediaFeatureID) const;
|
2021-09-10 19:33:30 -03:00
|
|
|
|
2023-04-09 06:17:42 -03:00
|
|
|
void fire_a_page_transition_event(FlyString const& event_name, bool persisted);
|
2021-09-26 07:39:27 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
WebIDL::ExceptionOr<GC::Ref<Storage>> local_storage();
|
|
|
|
|
WebIDL::ExceptionOr<GC::Ref<Storage>> session_storage();
|
2022-02-08 15:38:29 -03:00
|
|
|
|
2022-03-31 16:55:01 -03:00
|
|
|
void start_an_idle_period();
|
|
|
|
|
|
2024-05-25 08:34:17 -03:00
|
|
|
// https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation
|
|
|
|
|
bool has_sticky_activation() const;
|
|
|
|
|
|
2022-09-19 12:46:34 -03:00
|
|
|
// https://html.spec.whatwg.org/multipage/interaction.html#transient-activation
|
|
|
|
|
bool has_transient_activation() const;
|
|
|
|
|
|
2024-05-25 10:24:07 -03:00
|
|
|
// https://html.spec.whatwg.org/multipage/interaction.html#history-action-activation
|
|
|
|
|
bool has_history_action_activation() const;
|
|
|
|
|
|
2023-03-05 18:22:34 -03:00
|
|
|
WebIDL::ExceptionOr<void> initialize_web_interfaces(Badge<WindowEnvironmentSettingsObject>);
|
2022-09-24 18:39:23 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
Vector<GC::Ref<Plugin>> pdf_viewer_plugin_objects();
|
|
|
|
|
Vector<GC::Ref<MimeType>> pdf_viewer_mime_type_objects();
|
2023-02-27 21:23:53 -03:00
|
|
|
|
2023-03-11 13:44:15 -03:00
|
|
|
CrossOriginPropertyDescriptorMap const& cross_origin_property_descriptor_map() const { return m_cross_origin_property_descriptor_map; }
|
|
|
|
|
CrossOriginPropertyDescriptorMap& cross_origin_property_descriptor_map() { return m_cross_origin_property_descriptor_map; }
|
|
|
|
|
|
2023-03-05 13:02:35 -03:00
|
|
|
// JS API functions
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ref<WindowProxy> window() const;
|
|
|
|
|
GC::Ref<WindowProxy> self() const;
|
|
|
|
|
GC::Ref<DOM::Document const> document() const;
|
2023-03-05 16:02:16 -03:00
|
|
|
String name() const;
|
|
|
|
|
void set_name(String const&);
|
2023-12-04 15:52:04 -03:00
|
|
|
String status() const;
|
2024-03-30 07:04:31 -03:00
|
|
|
void close();
|
|
|
|
|
bool closed() const;
|
2023-12-04 15:52:04 -03:00
|
|
|
void set_status(String const&);
|
2024-11-14 12:01:23 -03:00
|
|
|
[[nodiscard]] GC::Ref<Location> location();
|
|
|
|
|
GC::Ref<History> history() const;
|
|
|
|
|
GC::Ref<Navigation> navigation();
|
2024-12-05 06:56:47 -03:00
|
|
|
void stop();
|
2023-03-06 19:25:04 -03:00
|
|
|
void focus();
|
2024-03-30 07:04:31 -03:00
|
|
|
void blur();
|
2023-03-05 15:36:43 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ref<WindowProxy> frames() const;
|
2023-09-03 17:50:40 -03:00
|
|
|
u32 length();
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<WindowProxy const> top() const;
|
|
|
|
|
GC::Ptr<WindowProxy const> opener() const;
|
2024-03-12 20:39:59 -03:00
|
|
|
WebIDL::ExceptionOr<void> set_opener(JS::Value);
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<WindowProxy const> parent() const;
|
|
|
|
|
GC::Ptr<DOM::Element const> frame_element() const;
|
|
|
|
|
WebIDL::ExceptionOr<GC::Ptr<WindowProxy>> open(Optional<String> const& url, Optional<String> const& target, Optional<String> const& features);
|
2023-03-05 15:48:45 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
[[nodiscard]] GC::Ref<Navigator> navigator();
|
|
|
|
|
[[nodiscard]] GC::Ref<CloseWatcherManager> close_watcher_manager();
|
2023-03-05 14:55:03 -03:00
|
|
|
|
2023-03-05 13:02:35 -03:00
|
|
|
void alert(String const& message = {});
|
2023-03-05 14:21:24 -03:00
|
|
|
bool confirm(Optional<String> const& message);
|
2023-03-05 14:28:17 -03:00
|
|
|
Optional<String> prompt(Optional<String> const& message, Optional<String> const& default_);
|
2023-03-05 13:02:35 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
WebIDL::ExceptionOr<void> post_message(JS::Value message, String const&, Vector<GC::Root<JS::Object>> const&);
|
2023-11-06 17:22:56 -03:00
|
|
|
WebIDL::ExceptionOr<void> post_message(JS::Value message, WindowPostMessageOptions const&);
|
2023-03-05 14:36:59 -03:00
|
|
|
|
2025-01-12 06:50:03 -03:00
|
|
|
Variant<GC::Root<DOM::Event>, Empty> event() const;
|
2023-03-06 16:50:29 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
[[nodiscard]] GC::Ref<CSS::CSSStyleDeclaration> get_computed_style(DOM::Element&, Optional<String> const& pseudo_element) const;
|
2023-03-06 19:18:29 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
WebIDL::ExceptionOr<GC::Ref<CSS::MediaQueryList>> match_media(String const& query);
|
|
|
|
|
[[nodiscard]] GC::Ref<CSS::Screen> screen();
|
|
|
|
|
[[nodiscard]] GC::Ptr<CSS::VisualViewport> visual_viewport();
|
2023-03-06 16:51:05 -03:00
|
|
|
|
2023-03-06 16:51:33 -03:00
|
|
|
i32 inner_width() const;
|
|
|
|
|
i32 inner_height() const;
|
|
|
|
|
|
2024-02-21 06:17:27 -03:00
|
|
|
void move_to(long, long) const;
|
|
|
|
|
void move_by(long, long) const;
|
|
|
|
|
void resize_to(long, long) const;
|
|
|
|
|
void resize_by(long, long) const;
|
|
|
|
|
|
2023-03-06 16:51:44 -03:00
|
|
|
double scroll_x() const;
|
|
|
|
|
double scroll_y() const;
|
2023-03-06 17:53:49 -03:00
|
|
|
void scroll(ScrollToOptions const&);
|
|
|
|
|
void scroll(double x, double y);
|
2023-03-06 18:17:19 -03:00
|
|
|
void scroll_by(ScrollToOptions);
|
|
|
|
|
void scroll_by(double x, double y);
|
2023-03-06 16:51:44 -03:00
|
|
|
|
2023-03-06 18:38:09 -03:00
|
|
|
i32 screen_x() const;
|
|
|
|
|
i32 screen_y() const;
|
2023-03-06 19:02:09 -03:00
|
|
|
i32 outer_width() const;
|
|
|
|
|
i32 outer_height() const;
|
2023-03-06 19:10:10 -03:00
|
|
|
double device_pixel_ratio() const;
|
2023-03-06 18:38:09 -03:00
|
|
|
|
2024-10-30 21:13:31 -03:00
|
|
|
AnimationFrameCallbackDriver& animation_frame_callback_driver();
|
|
|
|
|
bool has_animation_frame_callbacks();
|
|
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
WebIDL::UnsignedLong request_animation_frame(GC::Ref<WebIDL::CallbackType>);
|
2024-08-04 11:36:50 -03:00
|
|
|
void cancel_animation_frame(WebIDL::UnsignedLong handle);
|
2023-03-07 15:12:58 -03:00
|
|
|
|
2023-03-06 20:38:44 -03:00
|
|
|
u32 request_idle_callback(WebIDL::CallbackType&, RequestIdleCallback::IdleRequestOptions const&);
|
2023-03-06 20:43:25 -03:00
|
|
|
void cancel_idle_callback(u32 handle);
|
2023-03-06 20:38:44 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<Selection::Selection> get_selection() const;
|
2023-03-06 19:34:48 -03:00
|
|
|
|
2024-04-14 03:38:10 -03:00
|
|
|
void capture_events();
|
|
|
|
|
void release_events();
|
|
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
[[nodiscard]] GC::Ref<CustomElementRegistry> custom_elements();
|
2023-03-29 19:46:18 -03:00
|
|
|
|
2024-05-29 13:07:37 -03:00
|
|
|
HighResolutionTime::DOMHighResTimeStamp last_activation_timestamp() const { return m_last_activation_timestamp; }
|
2023-05-30 19:13:56 -03:00
|
|
|
void set_last_activation_timestamp(HighResolutionTime::DOMHighResTimeStamp timestamp) { m_last_activation_timestamp = timestamp; }
|
|
|
|
|
|
2024-05-29 13:53:55 -03:00
|
|
|
void consume_user_activation();
|
|
|
|
|
|
2024-05-29 13:07:37 -03:00
|
|
|
HighResolutionTime::DOMHighResTimeStamp last_history_action_activation_timestamp() const { return m_last_history_action_activation_timestamp; }
|
2024-05-25 10:21:02 -03:00
|
|
|
void set_last_history_action_activation_timestamp(HighResolutionTime::DOMHighResTimeStamp timestamp) { m_last_history_action_activation_timestamp = timestamp; }
|
|
|
|
|
|
2024-05-29 13:14:40 -03:00
|
|
|
void consume_history_action_user_activation();
|
|
|
|
|
|
2023-11-23 14:22:23 -03:00
|
|
|
static void set_inspector_object_exposed(bool);
|
2023-07-21 06:59:49 -03:00
|
|
|
static void set_internals_object_exposed(bool);
|
|
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
[[nodiscard]] OrderedHashMap<FlyString, GC::Ref<Navigable>> document_tree_child_navigable_target_name_property_set();
|
2023-09-19 00:56:11 -03:00
|
|
|
|
2024-01-09 20:05:03 -03:00
|
|
|
[[nodiscard]] Vector<FlyString> supported_property_names() const override;
|
2024-07-25 02:36:10 -03:00
|
|
|
[[nodiscard]] JS::Value named_item_value(FlyString const&) const override;
|
2023-09-19 16:32:13 -03:00
|
|
|
|
2024-06-25 18:52:01 -03:00
|
|
|
bool find(String const& string);
|
|
|
|
|
|
2020-04-01 13:53:28 -03:00
|
|
|
private:
|
2022-08-28 08:42:07 -03:00
|
|
|
explicit Window(JS::Realm&);
|
|
|
|
|
|
|
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
2024-01-03 06:10:47 -03:00
|
|
|
virtual void finalize() override;
|
2020-04-01 13:53:28 -03:00
|
|
|
|
2021-09-22 11:39:15 -03:00
|
|
|
// ^HTML::GlobalEventHandlers
|
2024-11-14 12:01:23 -03:00
|
|
|
virtual GC::Ptr<DOM::EventTarget> global_event_handlers_to_event_target(FlyString const&) override { return *this; }
|
2021-09-22 11:39:15 -03:00
|
|
|
|
2022-06-27 15:48:54 -03:00
|
|
|
// ^HTML::WindowEventHandlers
|
2024-11-14 12:01:23 -03:00
|
|
|
virtual GC::Ptr<DOM::EventTarget> window_event_handlers_to_event_target() override { return *this; }
|
2022-06-27 15:48:54 -03:00
|
|
|
|
2022-03-31 16:55:01 -03:00
|
|
|
void invoke_idle_callbacks();
|
|
|
|
|
|
2023-09-19 19:40:42 -03:00
|
|
|
struct [[nodiscard]] NamedObjects {
|
2024-11-14 12:01:23 -03:00
|
|
|
Vector<GC::Ref<Navigable>> navigables;
|
|
|
|
|
Vector<GC::Ref<DOM::Element>> elements;
|
2023-09-19 19:40:42 -03:00
|
|
|
};
|
|
|
|
|
NamedObjects named_objects(StringView name);
|
|
|
|
|
|
2023-11-06 17:22:56 -03:00
|
|
|
WebIDL::ExceptionOr<void> window_post_message_steps(JS::Value, WindowPostMessageOptions const&);
|
|
|
|
|
|
2021-09-09 08:55:31 -03:00
|
|
|
// https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<DOM::Document> m_associated_document;
|
2021-09-09 08:55:31 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<DOM::Event> m_current_event;
|
2020-06-27 13:30:29 -03:00
|
|
|
|
2024-12-03 04:31:14 -03:00
|
|
|
// https://html.spec.whatwg.org/multipage/webappapis.html#resolved-module-set
|
|
|
|
|
// A global object has a resolved module set, a set of specifier resolution records, initially empty.
|
|
|
|
|
//
|
|
|
|
|
// Spec-Note: The resolved module set ensures that module specifier resolution returns the same result when called
|
|
|
|
|
// multiple times with the same (referrer, specifier) pair. It does that by ensuring that import map rules
|
|
|
|
|
// that impact the specifier in its referrer's scope cannot be defined after its initial resolution. For
|
|
|
|
|
// now, only Window global objects have their module set data structures modified from the initial empty one.
|
|
|
|
|
Vector<SpecifierResolution> m_resolved_module_set;
|
2022-10-22 23:05:46 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<CSS::Screen> m_screen;
|
|
|
|
|
GC::Ptr<Navigator> m_navigator;
|
|
|
|
|
GC::Ptr<Location> m_location;
|
|
|
|
|
GC::Ptr<CloseWatcherManager> m_close_watcher_manager;
|
2021-09-12 21:03:06 -03:00
|
|
|
|
2023-08-23 13:58:09 -03:00
|
|
|
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#window-navigation-api
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<Navigation> m_navigation;
|
2023-08-23 13:58:09 -03:00
|
|
|
|
2023-03-29 19:46:18 -03:00
|
|
|
// https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-api
|
2024-12-18 12:58:36 -03:00
|
|
|
// Each Window object has an associated custom element registry (a CustomElementRegistry object).
|
|
|
|
|
// It is set to a new CustomElementRegistry object when the Window object is created.
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<CustomElementRegistry> m_custom_element_registry;
|
2023-03-29 19:46:18 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<AnimationFrameCallbackDriver> m_animation_frame_callback_driver;
|
2022-03-31 16:55:01 -03:00
|
|
|
|
|
|
|
|
// https://w3c.github.io/requestidlecallback/#dfn-list-of-idle-request-callbacks
|
2023-03-06 10:17:01 -03:00
|
|
|
Vector<NonnullRefPtr<IdleCallback>> m_idle_request_callbacks;
|
2022-03-31 16:55:01 -03:00
|
|
|
// https://w3c.github.io/requestidlecallback/#dfn-list-of-runnable-idle-callbacks
|
2023-03-06 10:17:01 -03:00
|
|
|
Vector<NonnullRefPtr<IdleCallback>> m_runnable_idle_callbacks;
|
2022-03-31 16:55:01 -03:00
|
|
|
// https://w3c.github.io/requestidlecallback/#dfn-idle-callback-identifier
|
|
|
|
|
u32 m_idle_callback_identifier = 0;
|
2022-08-28 08:42:07 -03:00
|
|
|
|
2023-02-27 21:23:53 -03:00
|
|
|
// https://html.spec.whatwg.org/multipage/system-state.html#pdf-viewer-plugin-objects
|
2024-11-14 12:01:23 -03:00
|
|
|
Vector<GC::Ref<Plugin>> m_pdf_viewer_plugin_objects;
|
2023-02-27 21:23:53 -03:00
|
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/system-state.html#pdf-viewer-mime-type-objects
|
2024-11-14 12:01:23 -03:00
|
|
|
Vector<GC::Ref<MimeType>> m_pdf_viewer_mime_type_objects;
|
2023-02-27 21:23:53 -03:00
|
|
|
|
2023-03-11 13:44:15 -03:00
|
|
|
// [[CrossOriginPropertyDescriptorMap]], https://html.spec.whatwg.org/multipage/browsers.html#crossoriginpropertydescriptormap
|
|
|
|
|
CrossOriginPropertyDescriptorMap m_cross_origin_property_descriptor_map;
|
2023-05-30 19:13:56 -03:00
|
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/interaction.html#user-activation-data-model
|
2024-05-25 12:39:18 -03:00
|
|
|
HighResolutionTime::DOMHighResTimeStamp m_last_activation_timestamp { AK::Infinity<double> };
|
2023-06-22 17:46:46 -03:00
|
|
|
|
2024-05-25 10:21:02 -03:00
|
|
|
// https://html.spec.whatwg.org/multipage/interaction.html#last-history-action-activation-timestamp
|
|
|
|
|
HighResolutionTime::DOMHighResTimeStamp m_last_history_action_activation_timestamp { AK::Infinity<double> };
|
|
|
|
|
|
2023-12-04 15:52:04 -03:00
|
|
|
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-window-status
|
|
|
|
|
// When the Window object is created, the attribute must be set to the empty string. It does not do anything else.
|
|
|
|
|
String m_status;
|
2020-04-01 13:53:28 -03:00
|
|
|
};
|
|
|
|
|
|
2021-10-03 11:28:14 -03:00
|
|
|
void run_animation_frame_callbacks(DOM::Document&, double now);
|
|
|
|
|
|
2020-04-01 13:53:28 -03:00
|
|
|
}
|