2020-01-18 11:38:21 +03:00
|
|
|
/*
|
2022-03-09 18:38:44 +03:00
|
|
|
* Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
|
2023-03-05 23:21:35 +03:00
|
|
|
* Copyright (c) 2021-2023, Linus Groh <linusg@serenityos.org>
|
2020-01-18 11:38:21 +03:00
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 11:38:21 +03:00
|
|
|
*/
|
|
|
|
|
2019-06-15 19:55:47 +03:00
|
|
|
#pragma once
|
|
|
|
|
2023-01-09 03:23:00 +03:00
|
|
|
#include <AK/DeprecatedFlyString.h>
|
2022-12-04 21:02:33 +03:00
|
|
|
#include <AK/DeprecatedString.h>
|
2019-10-06 14:58:18 +03:00
|
|
|
#include <AK/Function.h>
|
2021-08-30 17:52:08 +03:00
|
|
|
#include <AK/HashMap.h>
|
2019-06-29 22:42:07 +03:00
|
|
|
#include <AK/OwnPtr.h>
|
2019-10-05 11:16:27 +03:00
|
|
|
#include <AK/URL.h>
|
2022-02-15 19:36:27 +03:00
|
|
|
#include <AK/Vector.h>
|
2019-10-04 16:50:04 +03:00
|
|
|
#include <AK/WeakPtr.h>
|
2020-02-15 02:10:34 +03:00
|
|
|
#include <LibCore/Forward.h>
|
2020-03-14 14:41:51 +03:00
|
|
|
#include <LibJS/Forward.h>
|
2021-03-07 18:14:04 +03:00
|
|
|
#include <LibWeb/CSS/CSSStyleSheet.h>
|
2021-09-24 14:49:57 +03:00
|
|
|
#include <LibWeb/CSS/StyleComputer.h>
|
2020-06-04 17:06:32 +03:00
|
|
|
#include <LibWeb/CSS/StyleSheetList.h>
|
2021-04-14 00:30:41 +03:00
|
|
|
#include <LibWeb/Cookie/Cookie.h>
|
2020-03-28 11:12:13 +03:00
|
|
|
#include <LibWeb/DOM/NonElementParentNode.h>
|
2020-03-07 12:32:51 +03:00
|
|
|
#include <LibWeb/DOM/ParentNode.h>
|
2022-09-26 01:15:49 +03:00
|
|
|
#include <LibWeb/HTML/BrowsingContext.h>
|
2022-08-05 11:55:47 +03:00
|
|
|
#include <LibWeb/HTML/CrossOrigin/CrossOriginOpenerPolicy.h>
|
2021-09-26 13:08:50 +03:00
|
|
|
#include <LibWeb/HTML/DocumentReadyState.h>
|
2021-01-28 23:31:20 +03:00
|
|
|
#include <LibWeb/HTML/HTMLScriptElement.h>
|
2021-09-12 01:43:34 +03:00
|
|
|
#include <LibWeb/HTML/History.h>
|
2022-07-12 22:37:43 +03:00
|
|
|
#include <LibWeb/HTML/Origin.h>
|
2022-09-19 18:44:37 +03:00
|
|
|
#include <LibWeb/HTML/SandboxingFlagSet.h>
|
2021-10-14 18:12:53 +03:00
|
|
|
#include <LibWeb/HTML/Scripting/Environments.h>
|
2022-09-19 21:50:33 +03:00
|
|
|
#include <LibWeb/HTML/VisibilityState.h>
|
2022-08-28 14:42:07 +03:00
|
|
|
#include <LibWeb/HTML/Window.h>
|
2022-11-15 03:30:15 +03:00
|
|
|
#include <LibWeb/HTML/WindowProxy.h>
|
2022-09-25 19:03:42 +03:00
|
|
|
#include <LibWeb/WebIDL/ExceptionOr.h>
|
2019-06-15 19:55:47 +03:00
|
|
|
|
2020-07-26 20:37:56 +03:00
|
|
|
namespace Web::DOM {
|
2020-03-07 12:27:02 +03:00
|
|
|
|
2020-07-18 23:17:17 +03:00
|
|
|
enum class QuirksMode {
|
|
|
|
No,
|
|
|
|
Limited,
|
|
|
|
Yes
|
|
|
|
};
|
|
|
|
|
2022-09-21 01:03:53 +03:00
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#document-load-timing-info
|
|
|
|
struct DocumentLoadTimingInfo {
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#navigation-start-time
|
|
|
|
double navigation_start_time { 0 };
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#dom-interactive-time
|
|
|
|
double dom_interactive_time { 0 };
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#dom-content-loaded-event-start-time
|
|
|
|
double dom_content_loaded_event_start_time { 0 };
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#dom-content-loaded-event-end-time
|
|
|
|
double dom_content_loaded_event_end_time { 0 };
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#dom-complete-time
|
|
|
|
double dom_complete_time { 0 };
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#load-event-start-time
|
|
|
|
double load_event_start_time { 0 };
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#load-event-end-time
|
|
|
|
double load_event_end_time { 0 };
|
|
|
|
};
|
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#document-unload-timing-info
|
|
|
|
struct DocumentUnloadTimingInfo {
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#unload-event-start-time
|
|
|
|
double unload_event_start_time { 0 };
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#unload-event-end-time
|
|
|
|
double unload_event_end_time { 0 };
|
|
|
|
};
|
|
|
|
|
2020-03-28 11:12:13 +03:00
|
|
|
class Document
|
|
|
|
: public ParentNode
|
2020-09-20 20:22:44 +03:00
|
|
|
, public NonElementParentNode<Document>
|
2021-10-14 20:03:08 +03:00
|
|
|
, public HTML::GlobalEventHandlers {
|
2022-08-28 14:42:07 +03:00
|
|
|
WEB_PLATFORM_OBJECT(Document, ParentNode);
|
2020-03-14 15:15:11 +03:00
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
public:
|
2022-07-03 22:44:00 +03:00
|
|
|
enum class Type {
|
|
|
|
XML,
|
|
|
|
HTML
|
|
|
|
};
|
|
|
|
|
2023-02-14 23:49:02 +03:00
|
|
|
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Document>> create_and_initialize(Type, DeprecatedString content_type, HTML::NavigationParams);
|
2022-08-04 22:30:33 +03:00
|
|
|
|
2023-02-14 23:49:02 +03:00
|
|
|
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Document>> create(JS::Realm&, AK::URL const& url = "about:blank"sv);
|
|
|
|
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Document>> construct_impl(JS::Realm&);
|
2019-06-15 19:55:47 +03:00
|
|
|
virtual ~Document() override;
|
|
|
|
|
2023-03-07 01:34:48 +03:00
|
|
|
JS::GCPtr<Selection::Selection> get_selection() const;
|
2022-10-10 22:23:03 +03:00
|
|
|
|
2022-07-11 18:12:58 +03:00
|
|
|
size_t next_layout_node_serial_id(Badge<Layout::Node>) { return m_next_layout_node_serial_id++; }
|
|
|
|
size_t layout_node_count() const { return m_next_layout_node_serial_id; }
|
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
DeprecatedString cookie(Cookie::Source = Cookie::Source::NonHttp);
|
|
|
|
void set_cookie(DeprecatedString const&, Cookie::Source = Cookie::Source::NonHttp);
|
2021-03-14 18:35:28 +03:00
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
DeprecatedString referrer() const;
|
|
|
|
void set_referrer(DeprecatedString);
|
2021-09-11 13:29:06 +03:00
|
|
|
|
2021-09-13 00:33:23 +03:00
|
|
|
void set_url(const AK::URL& url) { m_url = url; }
|
|
|
|
AK::URL url() const { return m_url; }
|
2022-06-19 18:02:48 +03:00
|
|
|
AK::URL fallback_base_url() const;
|
|
|
|
AK::URL base_url() const;
|
|
|
|
|
2022-11-04 22:56:30 +03:00
|
|
|
void update_base_element(Badge<HTML::HTMLBaseElement>);
|
2023-02-25 20:44:51 +03:00
|
|
|
JS::GCPtr<HTML::HTMLBaseElement const> first_base_element_with_href_in_tree_order() const;
|
2019-10-05 11:16:27 +03:00
|
|
|
|
2022-12-06 04:12:49 +03:00
|
|
|
DeprecatedString url_string() const { return m_url.to_deprecated_string(); }
|
|
|
|
DeprecatedString document_uri() const { return m_url.to_deprecated_string(); }
|
2022-04-12 19:19:35 +03:00
|
|
|
|
2022-07-12 22:37:43 +03:00
|
|
|
HTML::Origin origin() const;
|
|
|
|
void set_origin(HTML::Origin const& origin);
|
2020-04-07 23:56:13 +03:00
|
|
|
|
2022-08-05 11:55:47 +03:00
|
|
|
HTML::CrossOriginOpenerPolicy const& cross_origin_opener_policy() const { return m_cross_origin_opener_policy; }
|
|
|
|
void set_cross_origin_opener_policy(HTML::CrossOriginOpenerPolicy policy) { m_cross_origin_opener_policy = move(policy); }
|
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
AK::URL parse_url(DeprecatedString const&) const;
|
2019-10-05 11:16:27 +03:00
|
|
|
|
2021-09-24 14:49:57 +03:00
|
|
|
CSS::StyleComputer& style_computer() { return *m_style_computer; }
|
|
|
|
const CSS::StyleComputer& style_computer() const { return *m_style_computer; }
|
2019-06-15 23:49:44 +03:00
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
CSS::StyleSheetList& style_sheets();
|
|
|
|
CSS::StyleSheetList const& style_sheets() const;
|
2019-06-15 23:49:44 +03:00
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
CSS::StyleSheetList* style_sheets_for_bindings() { return &style_sheets(); }
|
2021-03-08 13:22:18 +03:00
|
|
|
|
2023-01-09 03:23:00 +03:00
|
|
|
virtual DeprecatedFlyString node_name() const override { return "#document"; }
|
2019-09-28 23:59:16 +03:00
|
|
|
|
2019-10-14 18:54:17 +03:00
|
|
|
void set_hovered_node(Node*);
|
2022-08-28 14:42:07 +03:00
|
|
|
Node* hovered_node() { return m_hovered_node.ptr(); }
|
|
|
|
Node const* hovered_node() const { return m_hovered_node.ptr(); }
|
2019-09-29 12:50:35 +03:00
|
|
|
|
2019-11-09 13:58:50 +03:00
|
|
|
void set_inspected_node(Node*);
|
2022-08-28 14:42:07 +03:00
|
|
|
Node* inspected_node() { return m_inspected_node.ptr(); }
|
|
|
|
Node const* inspected_node() const { return m_inspected_node.ptr(); }
|
2019-11-09 13:58:50 +03:00
|
|
|
|
2021-02-22 16:00:47 +03:00
|
|
|
Element* document_element();
|
2022-04-01 20:58:27 +03:00
|
|
|
Element const* document_element() const;
|
2021-02-22 16:00:47 +03:00
|
|
|
|
2021-05-07 02:53:22 +03:00
|
|
|
HTML::HTMLHtmlElement* html_element();
|
|
|
|
HTML::HTMLHeadElement* head();
|
|
|
|
HTML::HTMLElement* body();
|
|
|
|
|
|
|
|
const HTML::HTMLHtmlElement* html_element() const
|
|
|
|
{
|
|
|
|
return const_cast<Document*>(this)->html_element();
|
|
|
|
}
|
|
|
|
|
|
|
|
const HTML::HTMLHeadElement* head() const
|
|
|
|
{
|
|
|
|
return const_cast<Document*>(this)->head();
|
|
|
|
}
|
|
|
|
|
|
|
|
const HTML::HTMLElement* body() const
|
|
|
|
{
|
|
|
|
return const_cast<Document*>(this)->body();
|
|
|
|
}
|
|
|
|
|
2022-09-25 19:03:42 +03:00
|
|
|
WebIDL::ExceptionOr<void> set_body(HTML::HTMLElement* new_body);
|
2019-09-29 17:24:57 +03:00
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
DeprecatedString title() const;
|
|
|
|
void set_title(DeprecatedString const&);
|
2019-09-29 17:24:57 +03:00
|
|
|
|
2021-11-18 17:01:28 +03:00
|
|
|
HTML::BrowsingContext* browsing_context() { return m_browsing_context.ptr(); }
|
|
|
|
HTML::BrowsingContext const* browsing_context() const { return m_browsing_context.ptr(); }
|
2019-10-04 16:50:04 +03:00
|
|
|
|
2022-09-20 22:44:42 +03:00
|
|
|
void set_browsing_context(HTML::BrowsingContext*);
|
|
|
|
|
2020-11-12 20:23:05 +03:00
|
|
|
Page* page();
|
2022-04-01 20:58:27 +03:00
|
|
|
Page const* page() const;
|
2020-11-12 20:23:05 +03:00
|
|
|
|
2022-04-01 20:58:27 +03:00
|
|
|
Color background_color(Gfx::Palette const&) const;
|
2021-11-12 15:11:01 +03:00
|
|
|
Vector<CSS::BackgroundLayerData> const* background_layers() const;
|
2019-10-04 22:05:52 +03:00
|
|
|
|
2020-01-13 22:33:15 +03:00
|
|
|
Color link_color() const;
|
2019-10-06 11:11:54 +03:00
|
|
|
void set_link_color(Color);
|
|
|
|
|
2020-01-13 22:33:15 +03:00
|
|
|
Color active_link_color() const;
|
2019-10-06 11:11:54 +03:00
|
|
|
void set_active_link_color(Color);
|
|
|
|
|
2020-01-13 22:33:15 +03:00
|
|
|
Color visited_link_color() const;
|
2019-10-06 11:11:54 +03:00
|
|
|
void set_visited_link_color(Color);
|
|
|
|
|
2019-10-28 22:51:45 +03:00
|
|
|
void force_layout();
|
2019-10-13 13:34:25 +03:00
|
|
|
|
2019-10-14 18:56:19 +03:00
|
|
|
void update_style();
|
|
|
|
void update_layout();
|
2019-10-06 14:58:18 +03:00
|
|
|
|
2021-10-05 23:30:53 +03:00
|
|
|
void set_needs_layout();
|
|
|
|
|
2022-03-09 19:57:45 +03:00
|
|
|
void invalidate_layout();
|
2022-03-21 12:58:51 +03:00
|
|
|
void invalidate_stacking_context_tree();
|
2022-03-09 19:57:45 +03:00
|
|
|
|
2022-04-01 20:58:27 +03:00
|
|
|
virtual bool is_child_allowed(Node const&) const override;
|
2019-10-13 00:26:47 +03:00
|
|
|
|
2023-02-25 13:04:29 +03:00
|
|
|
Layout::Viewport const* layout_node() const;
|
|
|
|
Layout::Viewport* layout_node();
|
2019-10-13 13:34:25 +03:00
|
|
|
|
2019-10-19 19:57:02 +03:00
|
|
|
void schedule_style_update();
|
2021-10-05 23:30:53 +03:00
|
|
|
void schedule_layout_update();
|
2019-10-19 19:57:02 +03:00
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
JS::NonnullGCPtr<HTMLCollection> get_elements_by_name(DeprecatedString const&);
|
2023-01-09 03:23:00 +03:00
|
|
|
JS::NonnullGCPtr<HTMLCollection> get_elements_by_class_name(DeprecatedFlyString const&);
|
2022-09-01 21:50:16 +03:00
|
|
|
|
|
|
|
JS::NonnullGCPtr<HTMLCollection> applets();
|
|
|
|
JS::NonnullGCPtr<HTMLCollection> anchors();
|
|
|
|
JS::NonnullGCPtr<HTMLCollection> images();
|
|
|
|
JS::NonnullGCPtr<HTMLCollection> embeds();
|
|
|
|
JS::NonnullGCPtr<HTMLCollection> plugins();
|
|
|
|
JS::NonnullGCPtr<HTMLCollection> links();
|
|
|
|
JS::NonnullGCPtr<HTMLCollection> forms();
|
|
|
|
JS::NonnullGCPtr<HTMLCollection> scripts();
|
2022-09-18 03:17:11 +03:00
|
|
|
JS::NonnullGCPtr<HTMLCollection> all();
|
2021-04-22 23:11:42 +03:00
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
DeprecatedString const& source() const { return m_source; }
|
|
|
|
void set_source(DeprecatedString source) { m_source = move(source); }
|
2019-11-25 02:27:41 +03:00
|
|
|
|
2021-10-14 18:12:53 +03:00
|
|
|
HTML::EnvironmentSettingsObject& relevant_settings_object();
|
2020-03-14 14:41:51 +03:00
|
|
|
|
2022-07-11 20:32:29 +03:00
|
|
|
JS::Value run_javascript(StringView source, StringView filename = "(unknown)"sv);
|
2020-04-04 23:12:37 +03:00
|
|
|
|
2023-01-09 03:23:00 +03:00
|
|
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> create_element(DeprecatedFlyString const& local_name);
|
2022-12-04 21:02:33 +03:00
|
|
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> create_element_ns(DeprecatedString const& namespace_, DeprecatedString const& qualified_name);
|
2022-08-28 14:42:07 +03:00
|
|
|
JS::NonnullGCPtr<DocumentFragment> create_document_fragment();
|
2022-12-04 21:02:33 +03:00
|
|
|
JS::NonnullGCPtr<Text> create_text_node(DeprecatedString const& data);
|
|
|
|
JS::NonnullGCPtr<Comment> create_comment(DeprecatedString const& data);
|
2022-12-13 15:24:56 +03:00
|
|
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<ProcessingInstruction>> create_processing_instruction(DeprecatedString const& target, DeprecatedString const& data);
|
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<Event>> create_event(DeprecatedString const& interface);
|
2022-08-09 02:06:47 +03:00
|
|
|
JS::NonnullGCPtr<Range> create_range();
|
2020-05-10 21:43:54 +03:00
|
|
|
|
2020-07-28 19:20:36 +03:00
|
|
|
void set_pending_parsing_blocking_script(Badge<HTML::HTMLScriptElement>, HTML::HTMLScriptElement*);
|
2022-08-28 14:42:07 +03:00
|
|
|
HTML::HTMLScriptElement* pending_parsing_blocking_script() { return m_pending_parsing_blocking_script.ptr(); }
|
|
|
|
JS::NonnullGCPtr<HTML::HTMLScriptElement> take_pending_parsing_blocking_script(Badge<HTML::HTMLParser>);
|
2020-05-24 23:00:46 +03:00
|
|
|
|
2020-07-28 19:20:36 +03:00
|
|
|
void add_script_to_execute_when_parsing_has_finished(Badge<HTML::HTMLScriptElement>, HTML::HTMLScriptElement&);
|
2022-08-28 14:42:07 +03:00
|
|
|
Vector<JS::Handle<HTML::HTMLScriptElement>> take_scripts_to_execute_when_parsing_has_finished(Badge<HTML::HTMLParser>);
|
|
|
|
Vector<JS::Handle<HTML::HTMLScriptElement>>& scripts_to_execute_when_parsing_has_finished() { return m_scripts_to_execute_when_parsing_has_finished; }
|
2020-05-30 13:26:15 +03:00
|
|
|
|
2020-07-28 19:20:36 +03:00
|
|
|
void add_script_to_execute_as_soon_as_possible(Badge<HTML::HTMLScriptElement>, HTML::HTMLScriptElement&);
|
2022-08-28 14:42:07 +03:00
|
|
|
Vector<JS::Handle<HTML::HTMLScriptElement>> take_scripts_to_execute_as_soon_as_possible(Badge<HTML::HTMLParser>);
|
|
|
|
Vector<JS::Handle<HTML::HTMLScriptElement>>& scripts_to_execute_as_soon_as_possible() { return m_scripts_to_execute_as_soon_as_possible; }
|
2020-05-30 13:26:15 +03:00
|
|
|
|
2022-09-17 18:36:47 +03:00
|
|
|
void add_script_to_execute_in_order_as_soon_as_possible(Badge<HTML::HTMLScriptElement>, HTML::HTMLScriptElement&);
|
|
|
|
Vector<JS::Handle<HTML::HTMLScriptElement>> take_scripts_to_execute_in_order_as_soon_as_possible(Badge<HTML::HTMLParser>);
|
|
|
|
Vector<JS::Handle<HTML::HTMLScriptElement>>& scripts_to_execute_in_order_as_soon_as_possible() { return m_scripts_to_execute_in_order_as_soon_as_possible; }
|
|
|
|
|
2020-07-18 23:17:17 +03:00
|
|
|
QuirksMode mode() const { return m_quirks_mode; }
|
|
|
|
bool in_quirks_mode() const { return m_quirks_mode == QuirksMode::Yes; }
|
|
|
|
void set_quirks_mode(QuirksMode mode) { m_quirks_mode = mode; }
|
2020-05-28 01:20:36 +03:00
|
|
|
|
2022-07-03 22:44:00 +03:00
|
|
|
Type document_type() const { return m_type; }
|
|
|
|
void set_document_type(Type type) { m_type = type; }
|
|
|
|
|
2022-11-03 02:14:27 +03:00
|
|
|
// https://dom.spec.whatwg.org/#html-document
|
|
|
|
bool is_html_document() const { return m_type == Type::HTML; }
|
|
|
|
|
2022-07-03 22:44:00 +03:00
|
|
|
// https://dom.spec.whatwg.org/#xml-document
|
|
|
|
bool is_xml_document() const { return m_type == Type::XML; }
|
|
|
|
|
2022-09-25 19:03:42 +03:00
|
|
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<Node>> import_node(JS::NonnullGCPtr<Node> node, bool deep);
|
2020-06-26 00:42:08 +03:00
|
|
|
void adopt_node(Node&);
|
2022-09-25 19:03:42 +03:00
|
|
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<Node>> adopt_node_binding(JS::NonnullGCPtr<Node>);
|
2020-06-26 00:42:08 +03:00
|
|
|
|
2022-04-01 20:58:27 +03:00
|
|
|
DocumentType const* doctype() const;
|
2022-12-04 21:02:33 +03:00
|
|
|
DeprecatedString const& compat_mode() const;
|
2020-07-18 23:17:17 +03:00
|
|
|
|
2020-08-02 17:05:59 +03:00
|
|
|
void set_editable(bool editable) { m_editable = editable; }
|
|
|
|
virtual bool is_editable() const final;
|
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
Element* focused_element() { return m_focused_element.ptr(); }
|
|
|
|
Element const* focused_element() const { return m_focused_element.ptr(); }
|
2020-08-14 20:40:37 +03:00
|
|
|
|
|
|
|
void set_focused_element(Element*);
|
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
Element const* active_element() const { return m_active_element.ptr(); }
|
2021-06-19 01:42:34 +03:00
|
|
|
|
|
|
|
void set_active_element(Element*);
|
|
|
|
|
2020-08-20 00:30:33 +03:00
|
|
|
bool created_for_appropriate_template_contents() const { return m_created_for_appropriate_template_contents; }
|
|
|
|
|
2022-10-29 14:06:24 +03:00
|
|
|
JS::NonnullGCPtr<Document> appropriate_template_contents_owner_document();
|
2020-08-20 00:30:33 +03:00
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
DeprecatedString ready_state() const;
|
2021-09-26 13:22:16 +03:00
|
|
|
void update_readiness(HTML::DocumentReadyState);
|
2020-08-31 15:56:16 +03:00
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
HTML::Window& window() const { return const_cast<HTML::Window&>(*m_window); }
|
2020-10-18 14:45:28 +03:00
|
|
|
|
2022-08-05 11:55:47 +03:00
|
|
|
void set_window(Badge<HTML::BrowsingContext>, HTML::Window&);
|
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
WebIDL::ExceptionOr<void> write(Vector<DeprecatedString> const& strings);
|
|
|
|
WebIDL::ExceptionOr<void> writeln(Vector<DeprecatedString> const& strings);
|
2022-02-19 17:58:21 +03:00
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
WebIDL::ExceptionOr<Document*> open(DeprecatedString const& = "", DeprecatedString const& = "");
|
|
|
|
WebIDL::ExceptionOr<JS::GCPtr<HTML::WindowProxy>> open(DeprecatedString const& url, DeprecatedString const& name, DeprecatedString const& features);
|
2022-09-25 19:03:42 +03:00
|
|
|
WebIDL::ExceptionOr<void> close();
|
2022-02-15 19:36:27 +03:00
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
HTML::Window* default_view() { return m_window.ptr(); }
|
2022-11-05 18:10:13 +03:00
|
|
|
HTML::Window const* default_view() const { return m_window.ptr(); }
|
2021-02-21 23:24:11 +03:00
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
DeprecatedString const& content_type() const { return m_content_type; }
|
|
|
|
void set_content_type(DeprecatedString const& content_type) { m_content_type = content_type; }
|
2020-11-13 08:02:15 +03:00
|
|
|
|
2021-05-12 11:32:41 +03:00
|
|
|
bool has_encoding() const { return m_encoding.has_value(); }
|
2022-12-04 21:02:33 +03:00
|
|
|
Optional<DeprecatedString> const& encoding() const { return m_encoding; }
|
|
|
|
DeprecatedString encoding_or_default() const { return m_encoding.value_or("UTF-8"); }
|
|
|
|
void set_encoding(Optional<DeprecatedString> const& encoding) { m_encoding = encoding; }
|
2020-11-13 14:16:28 +03:00
|
|
|
|
|
|
|
// NOTE: These are intended for the JS bindings
|
2022-12-04 21:02:33 +03:00
|
|
|
DeprecatedString character_set() const { return encoding_or_default(); }
|
|
|
|
DeprecatedString charset() const { return encoding_or_default(); }
|
|
|
|
DeprecatedString input_encoding() const { return encoding_or_default(); }
|
2020-11-13 14:16:28 +03:00
|
|
|
|
2020-11-21 21:32:39 +03:00
|
|
|
bool ready_for_post_load_tasks() const { return m_ready_for_post_load_tasks; }
|
|
|
|
void set_ready_for_post_load_tasks(bool ready) { m_ready_for_post_load_tasks = ready; }
|
|
|
|
|
|
|
|
void completely_finish_loading();
|
|
|
|
|
2022-08-08 16:52:48 +03:00
|
|
|
DOMImplementation* implementation();
|
2020-11-21 21:32:39 +03:00
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
JS::GCPtr<HTML::HTMLScriptElement> current_script() const { return m_current_script.ptr(); }
|
|
|
|
void set_current_script(Badge<HTML::HTMLScriptElement>, JS::GCPtr<HTML::HTMLScriptElement> script) { m_current_script = move(script); }
|
2021-01-28 23:31:20 +03:00
|
|
|
|
|
|
|
u32 ignore_destructive_writes_counter() const { return m_ignore_destructive_writes_counter; }
|
|
|
|
void increment_ignore_destructive_writes_counter() { m_ignore_destructive_writes_counter++; }
|
|
|
|
void decrement_ignore_destructive_writes_counter() { m_ignore_destructive_writes_counter--; }
|
|
|
|
|
2022-04-01 20:58:27 +03:00
|
|
|
virtual EventTarget* get_parent(Event const&) override;
|
2020-11-13 09:08:06 +03:00
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
DeprecatedString dump_dom_tree_as_json() const;
|
2021-06-07 18:32:24 +03:00
|
|
|
|
2021-09-09 03:11:11 +03:00
|
|
|
bool has_a_style_sheet_that_is_blocking_scripts() const;
|
|
|
|
|
2021-09-12 01:28:41 +03:00
|
|
|
bool is_fully_active() const;
|
2021-09-19 13:28:22 +03:00
|
|
|
bool is_active() const;
|
2021-09-12 01:28:41 +03:00
|
|
|
|
2022-09-02 14:50:24 +03:00
|
|
|
JS::NonnullGCPtr<HTML::History> history();
|
2023-03-05 23:21:35 +03:00
|
|
|
JS::NonnullGCPtr<HTML::History> history() const;
|
2021-09-12 01:43:34 +03:00
|
|
|
|
2023-01-18 20:41:12 +03:00
|
|
|
HTML::Location* location();
|
2021-09-12 16:59:49 +03:00
|
|
|
|
2021-09-26 02:03:42 +03:00
|
|
|
size_t number_of_things_delaying_the_load_event() { return m_number_of_things_delaying_the_load_event; }
|
2022-02-21 01:03:39 +03:00
|
|
|
void increment_number_of_things_delaying_the_load_event(Badge<DocumentLoadEventDelayer>);
|
|
|
|
void decrement_number_of_things_delaying_the_load_event(Badge<DocumentLoadEventDelayer>);
|
2021-09-26 02:03:42 +03:00
|
|
|
|
2021-09-26 13:26:39 +03:00
|
|
|
bool page_showing() const { return m_page_showing; }
|
|
|
|
void set_page_showing(bool value) { m_page_showing = value; }
|
|
|
|
|
2021-09-27 17:02:13 +03:00
|
|
|
bool hidden() const;
|
2022-12-04 21:02:33 +03:00
|
|
|
DeprecatedString visibility_state() const;
|
2021-09-27 17:02:13 +03:00
|
|
|
|
2022-09-19 18:17:20 +03:00
|
|
|
// https://html.spec.whatwg.org/multipage/interaction.html#update-the-visibility-state
|
2022-09-19 21:50:33 +03:00
|
|
|
void update_the_visibility_state(HTML::VisibilityState);
|
2022-09-19 18:17:20 +03:00
|
|
|
|
2022-09-20 22:44:42 +03:00
|
|
|
// NOTE: This does not fire any events, unlike update_the_visibility_state().
|
|
|
|
void set_visibility_state(Badge<HTML::BrowsingContext>, HTML::VisibilityState);
|
|
|
|
|
2021-10-03 17:42:03 +03:00
|
|
|
void run_the_resize_steps();
|
2022-09-17 18:40:26 +03:00
|
|
|
void run_the_scroll_steps();
|
2021-10-03 17:42:03 +03:00
|
|
|
|
2021-10-04 19:41:35 +03:00
|
|
|
void evaluate_media_queries_and_report_changes();
|
2022-08-28 14:42:07 +03:00
|
|
|
void add_media_query_list(JS::NonnullGCPtr<CSS::MediaQueryList>);
|
2021-10-04 19:41:35 +03:00
|
|
|
|
2022-02-03 22:06:54 +03:00
|
|
|
bool has_focus() const;
|
|
|
|
|
2022-02-21 23:54:21 +03:00
|
|
|
void set_parser(Badge<HTML::HTMLParser>, HTML::HTMLParser&);
|
|
|
|
void detach_parser(Badge<HTML::HTMLParser>);
|
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
static bool is_valid_name(DeprecatedString const&);
|
2022-02-26 12:00:49 +03:00
|
|
|
|
2022-02-26 19:26:37 +03:00
|
|
|
struct PrefixAndTagName {
|
2023-01-09 03:23:00 +03:00
|
|
|
DeprecatedFlyString prefix;
|
|
|
|
DeprecatedFlyString tag_name;
|
2022-02-26 19:26:37 +03:00
|
|
|
};
|
2022-12-04 21:02:33 +03:00
|
|
|
static WebIDL::ExceptionOr<PrefixAndTagName> validate_qualified_name(JS::Realm&, DeprecatedString const& qualified_name);
|
2022-02-26 19:26:37 +03:00
|
|
|
|
2022-08-08 23:56:19 +03:00
|
|
|
JS::NonnullGCPtr<NodeIterator> create_node_iterator(Node& root, unsigned what_to_show, JS::GCPtr<NodeFilter>);
|
2022-08-09 00:03:27 +03:00
|
|
|
JS::NonnullGCPtr<TreeWalker> create_tree_walker(Node& root, unsigned what_to_show, JS::GCPtr<NodeFilter>);
|
2022-03-09 16:34:32 +03:00
|
|
|
|
2022-03-09 18:38:44 +03:00
|
|
|
void register_node_iterator(Badge<NodeIterator>, NodeIterator&);
|
|
|
|
void unregister_node_iterator(Badge<NodeIterator>, NodeIterator&);
|
|
|
|
|
|
|
|
template<typename Callback>
|
|
|
|
void for_each_node_iterator(Callback callback)
|
|
|
|
{
|
2022-08-28 14:42:07 +03:00
|
|
|
for (auto& node_iterator : m_node_iterators)
|
2022-03-09 18:38:44 +03:00
|
|
|
callback(*node_iterator);
|
|
|
|
}
|
|
|
|
|
2022-03-19 20:10:59 +03:00
|
|
|
bool needs_full_style_update() const { return m_needs_full_style_update; }
|
|
|
|
void set_needs_full_style_update(bool b) { m_needs_full_style_update = b; }
|
|
|
|
|
2022-04-03 20:56:15 +03:00
|
|
|
bool has_active_favicon() const { return m_active_favicon; }
|
2022-04-03 20:49:38 +03:00
|
|
|
void check_favicon_after_loading_link_resource();
|
|
|
|
|
2022-08-01 17:19:55 +03:00
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#is-initial-about:blank
|
|
|
|
bool is_initial_about_blank() const { return m_is_initial_about_blank; }
|
|
|
|
void set_is_initial_about_blank(bool b) { m_is_initial_about_blank = b; }
|
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
DeprecatedString domain() const;
|
|
|
|
void set_domain(DeprecatedString const& domain);
|
2022-09-14 17:50:47 +03:00
|
|
|
|
2022-09-17 18:40:26 +03:00
|
|
|
auto& pending_scroll_event_targets() { return m_pending_scroll_event_targets; }
|
|
|
|
auto& pending_scrollend_event_targets() { return m_pending_scrollend_event_targets; }
|
|
|
|
|
2022-09-19 14:29:56 +03:00
|
|
|
// https://html.spec.whatwg.org/#completely-loaded
|
|
|
|
bool is_completely_loaded() const;
|
|
|
|
|
2022-09-19 18:44:37 +03:00
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#concept-document-navigation-id
|
2022-12-04 21:02:33 +03:00
|
|
|
Optional<DeprecatedString> navigation_id() const;
|
|
|
|
void set_navigation_id(Optional<DeprecatedString>);
|
2022-09-19 18:44:37 +03:00
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/origin.html#active-sandboxing-flag-set
|
|
|
|
HTML::SandboxingFlagSet active_sandboxing_flag_set() const;
|
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#concept-document-policy-container
|
|
|
|
HTML::PolicyContainer policy_container() const;
|
|
|
|
|
2022-09-19 21:50:33 +03:00
|
|
|
// https://html.spec.whatwg.org/multipage/browsers.html#list-of-the-descendant-browsing-contexts
|
2022-10-17 12:06:50 +03:00
|
|
|
Vector<JS::Handle<HTML::BrowsingContext>> list_of_descendant_browsing_contexts() const;
|
2022-09-19 21:50:33 +03:00
|
|
|
|
2022-09-20 22:44:42 +03:00
|
|
|
// https://html.spec.whatwg.org/multipage/window-object.html#discard-a-document
|
|
|
|
void discard();
|
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#abort-a-document
|
|
|
|
void abort();
|
|
|
|
|
2022-09-21 02:06:47 +03:00
|
|
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#unload-a-document
|
|
|
|
void unload(bool recursive_flag = false, Optional<DocumentUnloadTimingInfo> = {});
|
|
|
|
|
2022-09-20 22:44:42 +03:00
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#active-parser
|
2022-10-17 11:46:11 +03:00
|
|
|
JS::GCPtr<HTML::HTMLParser> active_parser();
|
2022-09-20 22:44:42 +03:00
|
|
|
|
2022-09-21 01:03:53 +03:00
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#load-timing-info
|
2022-09-21 01:43:38 +03:00
|
|
|
DocumentLoadTimingInfo& load_timing_info() { return m_load_timing_info; }
|
|
|
|
DocumentLoadTimingInfo const& load_timing_info() const { return m_load_timing_info; }
|
2022-09-21 01:03:53 +03:00
|
|
|
void set_load_timing_info(DocumentLoadTimingInfo const& load_timing_info) { m_load_timing_info = load_timing_info; }
|
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#previous-document-unload-timing
|
2022-09-21 01:43:38 +03:00
|
|
|
DocumentUnloadTimingInfo& previous_document_unload_timing() { return m_previous_document_unload_timing; }
|
|
|
|
DocumentUnloadTimingInfo const& previous_document_unload_timing() const { return m_previous_document_unload_timing; }
|
2022-09-21 01:03:53 +03:00
|
|
|
void set_previous_document_unload_timing(DocumentUnloadTimingInfo const& previous_document_unload_timing) { m_previous_document_unload_timing = previous_document_unload_timing; }
|
|
|
|
|
2022-10-16 16:53:15 +03:00
|
|
|
void did_stop_being_active_document_in_browsing_context(Badge<HTML::BrowsingContext>);
|
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
bool query_command_supported(DeprecatedString const&) const;
|
2022-11-05 17:48:57 +03:00
|
|
|
|
2022-12-11 19:56:37 +03:00
|
|
|
DeprecatedString dump_accessibility_tree_as_json();
|
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
protected:
|
2023-01-28 20:33:35 +03:00
|
|
|
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
2022-08-28 14:42:07 +03:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
|
2019-06-15 19:55:47 +03:00
|
|
|
private:
|
2022-09-26 01:15:49 +03:00
|
|
|
Document(JS::Realm&, AK::URL const&);
|
2020-10-23 09:31:26 +03:00
|
|
|
|
2021-02-04 00:47:50 +03:00
|
|
|
// ^HTML::GlobalEventHandlers
|
2023-01-09 03:23:00 +03:00
|
|
|
virtual EventTarget& global_event_handlers_to_event_target(DeprecatedFlyString const&) final { return *this; }
|
2021-02-04 00:47:50 +03:00
|
|
|
|
2020-10-20 18:43:13 +03:00
|
|
|
void tear_down_layout_tree();
|
|
|
|
|
2022-03-20 18:18:43 +03:00
|
|
|
void evaluate_media_rules();
|
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
WebIDL::ExceptionOr<void> run_the_document_write_steps(DeprecatedString);
|
2022-02-22 00:34:54 +03:00
|
|
|
|
2022-07-11 18:12:58 +03:00
|
|
|
size_t m_next_layout_node_serial_id { 0 };
|
|
|
|
|
2021-09-24 14:49:57 +03:00
|
|
|
OwnPtr<CSS::StyleComputer> m_style_computer;
|
2022-08-28 14:42:07 +03:00
|
|
|
JS::GCPtr<CSS::StyleSheetList> m_style_sheets;
|
|
|
|
JS::GCPtr<Node> m_hovered_node;
|
|
|
|
JS::GCPtr<Node> m_inspected_node;
|
|
|
|
JS::GCPtr<Node> m_active_favicon;
|
2021-11-18 17:01:28 +03:00
|
|
|
WeakPtr<HTML::BrowsingContext> m_browsing_context;
|
2021-09-13 00:33:23 +03:00
|
|
|
AK::URL m_url;
|
2019-10-06 11:11:54 +03:00
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
JS::GCPtr<HTML::Window> m_window;
|
2020-04-01 19:53:28 +03:00
|
|
|
|
2023-02-25 13:04:29 +03:00
|
|
|
JS::GCPtr<Layout::Viewport> m_layout_root;
|
2019-10-13 13:34:25 +03:00
|
|
|
|
2020-01-13 22:33:15 +03:00
|
|
|
Optional<Color> m_link_color;
|
|
|
|
Optional<Color> m_active_link_color;
|
|
|
|
Optional<Color> m_visited_link_color;
|
2019-10-19 19:57:02 +03:00
|
|
|
|
2022-09-07 21:30:31 +03:00
|
|
|
RefPtr<Platform::Timer> m_style_update_timer;
|
|
|
|
RefPtr<Platform::Timer> m_layout_update_timer;
|
2019-11-25 02:27:41 +03:00
|
|
|
|
2022-10-17 11:46:11 +03:00
|
|
|
JS::GCPtr<HTML::HTMLParser> m_parser;
|
2022-02-19 17:58:21 +03:00
|
|
|
bool m_active_parser_was_aborted { false };
|
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
DeprecatedString m_source;
|
2020-03-14 14:41:51 +03:00
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
JS::GCPtr<HTML::HTMLScriptElement> m_pending_parsing_blocking_script;
|
2022-09-17 18:36:47 +03:00
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
Vector<JS::Handle<HTML::HTMLScriptElement>> m_scripts_to_execute_when_parsing_has_finished;
|
2022-09-17 18:36:47 +03:00
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/scripting.html#list-of-scripts-that-will-execute-in-order-as-soon-as-possible
|
|
|
|
Vector<JS::Handle<HTML::HTMLScriptElement>> m_scripts_to_execute_in_order_as_soon_as_possible;
|
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/scripting.html#set-of-scripts-that-will-execute-as-soon-as-possible
|
2022-08-28 14:42:07 +03:00
|
|
|
Vector<JS::Handle<HTML::HTMLScriptElement>> m_scripts_to_execute_as_soon_as_possible;
|
2020-05-28 01:20:36 +03:00
|
|
|
|
2020-07-18 23:17:17 +03:00
|
|
|
QuirksMode m_quirks_mode { QuirksMode::No };
|
2022-07-03 22:44:00 +03:00
|
|
|
|
|
|
|
// https://dom.spec.whatwg.org/#concept-document-type
|
|
|
|
Type m_type { Type::HTML };
|
|
|
|
|
2020-08-02 17:05:59 +03:00
|
|
|
bool m_editable { false };
|
2020-08-14 20:40:37 +03:00
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
JS::GCPtr<Element> m_focused_element;
|
|
|
|
JS::GCPtr<Element> m_active_element;
|
2020-08-20 00:30:33 +03:00
|
|
|
|
|
|
|
bool m_created_for_appropriate_template_contents { false };
|
2022-08-28 14:42:07 +03:00
|
|
|
JS::GCPtr<Document> m_associated_inert_template_document;
|
2022-10-29 14:06:24 +03:00
|
|
|
JS::GCPtr<Document> m_appropriate_template_contents_owner_document;
|
2020-08-31 15:56:16 +03:00
|
|
|
|
2021-09-26 13:22:16 +03:00
|
|
|
HTML::DocumentReadyState m_readiness { HTML::DocumentReadyState::Loading };
|
2022-12-04 21:02:33 +03:00
|
|
|
DeprecatedString m_content_type { "application/xml" };
|
|
|
|
Optional<DeprecatedString> m_encoding;
|
2020-11-13 09:08:06 +03:00
|
|
|
|
2020-11-21 21:32:39 +03:00
|
|
|
bool m_ready_for_post_load_tasks { false };
|
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
JS::GCPtr<DOMImplementation> m_implementation;
|
|
|
|
JS::GCPtr<HTML::HTMLScriptElement> m_current_script;
|
2020-12-15 20:53:35 +03:00
|
|
|
|
|
|
|
bool m_should_invalidate_styles_on_attribute_changes { true };
|
2021-01-28 23:31:20 +03:00
|
|
|
|
|
|
|
u32 m_ignore_destructive_writes_counter { 0 };
|
2021-09-09 03:11:11 +03:00
|
|
|
|
2022-02-19 17:58:21 +03:00
|
|
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#unload-counter
|
|
|
|
u32 m_unload_counter { 0 };
|
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#throw-on-dynamic-markup-insertion-counter
|
|
|
|
u32 m_throw_on_dynamic_markup_insertion_counter { 0 };
|
|
|
|
|
2021-09-09 03:11:11 +03:00
|
|
|
// https://html.spec.whatwg.org/multipage/semantics.html#script-blocking-style-sheet-counter
|
|
|
|
u32 m_script_blocking_style_sheet_counter { 0 };
|
2021-09-12 01:43:34 +03:00
|
|
|
|
2022-09-02 14:50:24 +03:00
|
|
|
JS::GCPtr<HTML::History> m_history;
|
2021-09-26 02:03:42 +03:00
|
|
|
|
|
|
|
size_t m_number_of_things_delaying_the_load_event { 0 };
|
2021-09-26 13:26:39 +03:00
|
|
|
|
2022-09-20 22:44:42 +03:00
|
|
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#concept-document-salvageable
|
|
|
|
bool m_salvageable { true };
|
|
|
|
|
2021-09-26 13:26:39 +03:00
|
|
|
// https://html.spec.whatwg.org/#page-showing
|
|
|
|
bool m_page_showing { false };
|
2021-10-03 17:42:03 +03:00
|
|
|
|
|
|
|
// Used by run_the_resize_steps().
|
|
|
|
Gfx::IntSize m_last_viewport_size;
|
2021-10-04 19:41:35 +03:00
|
|
|
|
2022-09-17 18:40:26 +03:00
|
|
|
// https://w3c.github.io/csswg-drafts/cssom-view-1/#document-pending-scroll-event-targets
|
|
|
|
Vector<JS::NonnullGCPtr<EventTarget>> m_pending_scroll_event_targets;
|
|
|
|
|
|
|
|
// https://w3c.github.io/csswg-drafts/cssom-view-1/#document-pending-scrollend-event-targets
|
|
|
|
Vector<JS::NonnullGCPtr<EventTarget>> m_pending_scrollend_event_targets;
|
|
|
|
|
2021-10-04 19:41:35 +03:00
|
|
|
// Used by evaluate_media_queries_and_report_changes().
|
|
|
|
Vector<WeakPtr<CSS::MediaQueryList>> m_media_query_lists;
|
2021-10-05 23:30:53 +03:00
|
|
|
|
|
|
|
bool m_needs_layout { false };
|
2022-03-09 18:38:44 +03:00
|
|
|
|
2022-03-19 20:10:59 +03:00
|
|
|
bool m_needs_full_style_update { false };
|
|
|
|
|
2022-03-09 18:38:44 +03:00
|
|
|
HashTable<NodeIterator*> m_node_iterators;
|
2022-08-01 17:19:55 +03:00
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#is-initial-about:blank
|
|
|
|
bool m_is_initial_about_blank { false };
|
2022-08-05 11:54:01 +03:00
|
|
|
|
2022-08-05 11:55:47 +03:00
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#concept-document-coop
|
|
|
|
HTML::CrossOriginOpenerPolicy m_cross_origin_opener_policy;
|
|
|
|
|
2022-08-05 11:55:01 +03:00
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#the-document's-referrer
|
2022-12-04 21:02:33 +03:00
|
|
|
DeprecatedString m_referrer { "" };
|
2022-08-05 11:55:01 +03:00
|
|
|
|
2022-08-05 11:54:01 +03:00
|
|
|
// https://dom.spec.whatwg.org/#concept-document-origin
|
|
|
|
HTML::Origin m_origin;
|
2022-09-18 03:02:52 +03:00
|
|
|
|
|
|
|
JS::GCPtr<HTMLCollection> m_applets;
|
|
|
|
JS::GCPtr<HTMLCollection> m_anchors;
|
|
|
|
JS::GCPtr<HTMLCollection> m_images;
|
|
|
|
JS::GCPtr<HTMLCollection> m_embeds;
|
|
|
|
JS::GCPtr<HTMLCollection> m_links;
|
|
|
|
JS::GCPtr<HTMLCollection> m_forms;
|
|
|
|
JS::GCPtr<HTMLCollection> m_scripts;
|
2022-09-18 03:17:11 +03:00
|
|
|
JS::GCPtr<HTMLCollection> m_all;
|
2022-09-19 14:29:56 +03:00
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/#completely-loaded-time
|
|
|
|
Optional<AK::Time> m_completely_loaded_time;
|
2022-09-19 18:17:20 +03:00
|
|
|
|
2022-09-19 18:44:37 +03:00
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#concept-document-navigation-id
|
2022-12-04 21:02:33 +03:00
|
|
|
Optional<DeprecatedString> m_navigation_id;
|
2022-09-19 18:44:37 +03:00
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/origin.html#active-sandboxing-flag-set
|
|
|
|
HTML::SandboxingFlagSet m_active_sandboxing_flag_set;
|
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#concept-document-policy-container
|
|
|
|
HTML::PolicyContainer m_policy_container;
|
|
|
|
|
2022-09-19 18:17:20 +03:00
|
|
|
// https://html.spec.whatwg.org/multipage/interaction.html#visibility-state
|
2022-09-19 21:50:33 +03:00
|
|
|
HTML::VisibilityState m_visibility_state { HTML::VisibilityState::Hidden };
|
2022-09-21 01:03:53 +03:00
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#load-timing-info
|
|
|
|
DocumentLoadTimingInfo m_load_timing_info;
|
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/dom.html#previous-document-unload-timing
|
|
|
|
DocumentUnloadTimingInfo m_previous_document_unload_timing;
|
2022-10-10 22:23:03 +03:00
|
|
|
|
2022-10-11 13:24:57 +03:00
|
|
|
// https://w3c.github.io/selection-api/#dfn-selection
|
2022-10-10 22:23:03 +03:00
|
|
|
JS::GCPtr<Selection::Selection> m_selection;
|
2022-11-04 22:56:30 +03:00
|
|
|
|
|
|
|
// NOTE: This is a cache to make finding the first <base href> element O(1).
|
2023-02-25 20:44:51 +03:00
|
|
|
JS::GCPtr<HTML::HTMLBaseElement const> m_first_base_element_with_href_in_tree_order;
|
2019-06-15 19:55:47 +03:00
|
|
|
};
|
2022-03-09 18:38:44 +03:00
|
|
|
|
2019-10-06 21:37:39 +03:00
|
|
|
}
|