1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

LibWeb: Move Window from DOM directory & namespace to HTML

The Window object is part of the HTML spec. :^)
https://html.spec.whatwg.org/multipage/window-object.html
This commit is contained in:
Linus Groh 2022-03-07 23:08:26 +01:00
parent 2dfb617c5b
commit 1422bd45eb
63 changed files with 133 additions and 133 deletions

View file

@ -2804,8 +2804,8 @@ void generate_prototype_implementation(IDL::Interface const& interface)
#include <LibWeb/DOM/Event.h> #include <LibWeb/DOM/Event.h>
#include <LibWeb/DOM/IDLEventListener.h> #include <LibWeb/DOM/IDLEventListener.h>
#include <LibWeb/DOM/Range.h> #include <LibWeb/DOM/Range.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/Scripting/Environments.h> #include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Origin.h> #include <LibWeb/Origin.h>
#if __has_include(<LibWeb/Bindings/@prototype_base_class@.h>) #if __has_include(<LibWeb/Bindings/@prototype_base_class@.h>)

View file

@ -45,7 +45,7 @@ struct TestWebGlobalObject : public Web::Bindings::WindowObject {
JS_OBJECT(TestWebGlobalObject, Web::Bindings::WindowObject); JS_OBJECT(TestWebGlobalObject, Web::Bindings::WindowObject);
public: public:
TestWebGlobalObject(Web::DOM::Window& window) TestWebGlobalObject(Web::HTML::Window& window)
: Web::Bindings::WindowObject(window) : Web::Bindings::WindowObject(window)
{ {
} }

View file

@ -9,7 +9,7 @@
#include <LibWeb/Bindings/HTMLAudioElementWrapper.h> #include <LibWeb/Bindings/HTMLAudioElementWrapper.h>
#include <LibWeb/Bindings/NodeWrapperFactory.h> #include <LibWeb/Bindings/NodeWrapperFactory.h>
#include <LibWeb/DOM/ElementFactory.h> #include <LibWeb/DOM/ElementFactory.h>
#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/Window.h>
#include <LibWeb/Namespace.h> #include <LibWeb/Namespace.h>
namespace Web::Bindings { namespace Web::Bindings {

View file

@ -9,7 +9,7 @@
#include <LibWeb/Bindings/ImageConstructor.h> #include <LibWeb/Bindings/ImageConstructor.h>
#include <LibWeb/Bindings/NodeWrapperFactory.h> #include <LibWeb/Bindings/NodeWrapperFactory.h>
#include <LibWeb/DOM/ElementFactory.h> #include <LibWeb/DOM/ElementFactory.h>
#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/Window.h>
#include <LibWeb/Namespace.h> #include <LibWeb/Namespace.h>
namespace Web::Bindings { namespace Web::Bindings {

View file

@ -17,7 +17,7 @@
#include <LibWeb/Bindings/WindowObject.h> #include <LibWeb/Bindings/WindowObject.h>
#include <LibWeb/DOM/DOMException.h> #include <LibWeb/DOM/DOMException.h>
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/Window.h>
namespace Web::Bindings { namespace Web::Bindings {

View file

@ -12,11 +12,11 @@
#include <LibJS/Runtime/VM.h> #include <LibJS/Runtime/VM.h>
#include <LibWeb/Bindings/MainThreadVM.h> #include <LibWeb/Bindings/MainThreadVM.h>
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/PromiseRejectionEvent.h> #include <LibWeb/HTML/PromiseRejectionEvent.h>
#include <LibWeb/HTML/Scripting/ClassicScript.h> #include <LibWeb/HTML/Scripting/ClassicScript.h>
#include <LibWeb/HTML/Scripting/Environments.h> #include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Scripting/ExceptionReporter.h> #include <LibWeb/HTML/Scripting/ExceptionReporter.h>
#include <LibWeb/HTML/Window.h>
namespace Web::Bindings { namespace Web::Bindings {

View file

@ -38,18 +38,18 @@
#include <LibWeb/Crypto/Crypto.h> #include <LibWeb/Crypto/Crypto.h>
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Event.h> #include <LibWeb/DOM/Event.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/HTML/EventHandler.h> #include <LibWeb/HTML/EventHandler.h>
#include <LibWeb/HTML/Scripting/Environments.h> #include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Storage.h> #include <LibWeb/HTML/Storage.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Origin.h> #include <LibWeb/Origin.h>
#include <LibWeb/Page/Page.h> #include <LibWeb/Page/Page.h>
#include <LibWeb/WebAssembly/WebAssemblyObject.h> #include <LibWeb/WebAssembly/WebAssemblyObject.h>
namespace Web::Bindings { namespace Web::Bindings {
WindowObject::WindowObject(DOM::Window& impl) WindowObject::WindowObject(HTML::Window& impl)
: m_impl(impl) : m_impl(impl)
{ {
impl.set_wrapper({}, *this); impl.set_wrapper({}, *this);
@ -164,7 +164,7 @@ JS::ThrowCompletionOr<bool> WindowObject::internal_set_prototype_of(JS::Object*
return set_immutable_prototype(prototype); return set_immutable_prototype(prototype);
} }
static JS::ThrowCompletionOr<DOM::Window*> impl_from(JS::VM& vm, JS::GlobalObject& global_object) static JS::ThrowCompletionOr<HTML::Window*> impl_from(JS::VM& vm, JS::GlobalObject& global_object)
{ {
// Since this is a non built-in function we must treat it as non-strict mode // Since this is a non built-in function we must treat it as non-strict mode
// this means that a nullish this_value should be converted to the // this means that a nullish this_value should be converted to the

View file

@ -30,12 +30,12 @@ class WindowObject
JS_OBJECT(WindowObject, JS::GlobalObject); JS_OBJECT(WindowObject, JS::GlobalObject);
public: public:
explicit WindowObject(DOM::Window&); explicit WindowObject(HTML::Window&);
virtual void initialize_global_object() override; virtual void initialize_global_object() override;
virtual ~WindowObject() override; virtual ~WindowObject() override;
DOM::Window& impl() { return *m_impl; } HTML::Window& impl() { return *m_impl; }
const DOM::Window& impl() const { return *m_impl; } const HTML::Window& impl() const { return *m_impl; }
Origin origin() const; Origin origin() const;
@ -135,7 +135,7 @@ private:
ENUMERATE_GLOBAL_EVENT_HANDLERS(__ENUMERATE); ENUMERATE_GLOBAL_EVENT_HANDLERS(__ENUMERATE);
#undef __ENUMERATE #undef __ENUMERATE
NonnullRefPtr<DOM::Window> m_impl; NonnullRefPtr<HTML::Window> m_impl;
LocationObject* m_location_object { nullptr }; LocationObject* m_location_object { nullptr };

View file

@ -99,7 +99,6 @@ set(SOURCES
DOM/Text.cpp DOM/Text.cpp
DOM/Text.idl DOM/Text.idl
DOM/Timer.cpp DOM/Timer.cpp
DOM/Window.cpp
DOMParsing/InnerHTML.cpp DOMParsing/InnerHTML.cpp
DOMTreeModel.cpp DOMTreeModel.cpp
Dump.cpp Dump.cpp
@ -214,6 +213,7 @@ set(SOURCES
HTML/SyntaxHighlighter/SyntaxHighlighter.cpp HTML/SyntaxHighlighter/SyntaxHighlighter.cpp
HTML/TagNames.cpp HTML/TagNames.cpp
HTML/TextMetrics.cpp HTML/TextMetrics.cpp
HTML/Window.cpp
HTML/Worker.cpp HTML/Worker.cpp
HTML/WorkerDebugConsoleClient.cpp HTML/WorkerDebugConsoleClient.cpp
HTML/WorkerGlobalScope.cpp HTML/WorkerGlobalScope.cpp

View file

@ -34,7 +34,7 @@ public:
NonnullRefPtr<MediaList> const& media() const { return m_media; } NonnullRefPtr<MediaList> const& media() const { return m_media; }
bool evaluate(DOM::Window const& window) { return m_media->evaluate(window); } bool evaluate(HTML::Window const& window) { return m_media->evaluate(window); }
private: private:
explicit CSSMediaRule(NonnullRefPtr<MediaList>&&, NonnullRefPtrVector<CSSRule>&&); explicit CSSMediaRule(NonnullRefPtr<MediaList>&&, NonnullRefPtrVector<CSSRule>&&);

View file

@ -103,7 +103,7 @@ void CSSRuleList::for_each_effective_style_rule(Function<void(CSSStyleRule const
} }
} }
bool CSSRuleList::evaluate_media_queries(DOM::Window const& window) bool CSSRuleList::evaluate_media_queries(HTML::Window const& window)
{ {
bool any_media_queries_changed_match_state = false; bool any_media_queries_changed_match_state = false;

View file

@ -53,7 +53,7 @@ public:
void for_each_effective_style_rule(Function<void(CSSStyleRule const&)> const& callback) const; void for_each_effective_style_rule(Function<void(CSSStyleRule const&)> const& callback) const;
// Returns whether the match state of any media queries changed after evaluation. // Returns whether the match state of any media queries changed after evaluation.
bool evaluate_media_queries(DOM::Window const&); bool evaluate_media_queries(HTML::Window const&);
private: private:
explicit CSSRuleList(NonnullRefPtrVector<CSSRule>&&); explicit CSSRuleList(NonnullRefPtrVector<CSSRule>&&);

View file

@ -62,7 +62,7 @@ void CSSStyleSheet::for_each_effective_style_rule(Function<void(CSSStyleRule con
m_rules->for_each_effective_style_rule(callback); m_rules->for_each_effective_style_rule(callback);
} }
bool CSSStyleSheet::evaluate_media_queries(DOM::Window const& window) bool CSSStyleSheet::evaluate_media_queries(HTML::Window const& window)
{ {
return m_rules->evaluate_media_queries(window); return m_rules->evaluate_media_queries(window);
} }

View file

@ -48,7 +48,7 @@ public:
void for_each_effective_style_rule(Function<void(CSSStyleRule const&)> const& callback) const; void for_each_effective_style_rule(Function<void(CSSStyleRule const&)> const& callback) const;
// Returns whether the match state of any media queries changed after evaluation. // Returns whether the match state of any media queries changed after evaluation.
bool evaluate_media_queries(DOM::Window const&); bool evaluate_media_queries(HTML::Window const&);
private: private:
explicit CSSStyleSheet(NonnullRefPtrVector<CSSRule>); explicit CSSStyleSheet(NonnullRefPtrVector<CSSRule>);

View file

@ -65,7 +65,7 @@ void MediaList::delete_medium(String medium)
// FIXME: If nothing was removed, then throw a NotFoundError exception. // FIXME: If nothing was removed, then throw a NotFoundError exception.
} }
bool MediaList::evaluate(DOM::Window const& window) bool MediaList::evaluate(HTML::Window const& window)
{ {
for (auto& media : m_media) for (auto& media : m_media)
media.evaluate(window); media.evaluate(window);

View file

@ -29,7 +29,7 @@ public:
void append_medium(String); void append_medium(String);
void delete_medium(String); void delete_medium(String);
bool evaluate(DOM::Window const&); bool evaluate(HTML::Window const&);
bool matches() const; bool matches() const;
private: private:

View file

@ -7,7 +7,7 @@
#include <LibWeb/CSS/MediaQuery.h> #include <LibWeb/CSS/MediaQuery.h>
#include <LibWeb/CSS/Serialize.h> #include <LibWeb/CSS/Serialize.h>
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/Window.h>
namespace Web::CSS { namespace Web::CSS {
@ -77,7 +77,7 @@ String MediaFeature::to_string() const
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();
} }
bool MediaFeature::evaluate(DOM::Window const& window) const bool MediaFeature::evaluate(HTML::Window const& window) const
{ {
auto maybe_queried_value = window.query_media_feature(m_name); auto maybe_queried_value = window.query_media_feature(m_name);
if (!maybe_queried_value.has_value()) if (!maybe_queried_value.has_value())
@ -122,7 +122,7 @@ bool MediaFeature::evaluate(DOM::Window const& window) const
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();
} }
bool MediaFeature::compare(DOM::Window const& window, MediaFeatureValue left, Comparison comparison, MediaFeatureValue right) bool MediaFeature::compare(HTML::Window const& window, MediaFeatureValue left, Comparison comparison, MediaFeatureValue right)
{ {
if (!left.is_same_type(right)) if (!left.is_same_type(right))
return false; return false;
@ -298,7 +298,7 @@ String MediaCondition::to_string() const
return builder.to_string(); return builder.to_string();
} }
MatchResult MediaCondition::evaluate(DOM::Window const& window) const MatchResult MediaCondition::evaluate(HTML::Window const& window) const
{ {
switch (type) { switch (type) {
case Type::Single: case Type::Single:
@ -369,7 +369,7 @@ String MediaQuery::to_string() const
return builder.to_string(); return builder.to_string();
} }
bool MediaQuery::evaluate(DOM::Window const& window) bool MediaQuery::evaluate(HTML::Window const& window)
{ {
auto matches_media = [](MediaType media) -> MatchResult { auto matches_media = [](MediaType media) -> MatchResult {
switch (media) { switch (media) {

View file

@ -140,7 +140,7 @@ public:
return feature; return feature;
} }
bool evaluate(DOM::Window const&) const; bool evaluate(HTML::Window const&) const;
String to_string() const; String to_string() const;
private: private:
@ -159,7 +159,7 @@ private:
{ {
} }
static bool compare(DOM::Window const& window, MediaFeatureValue left, Comparison comparison, MediaFeatureValue right); static bool compare(HTML::Window const& window, MediaFeatureValue left, Comparison comparison, MediaFeatureValue right);
struct Range { struct Range {
MediaFeatureValue left_value; MediaFeatureValue left_value;
@ -196,7 +196,7 @@ struct MediaCondition {
static NonnullOwnPtr<MediaCondition> from_and_list(NonnullOwnPtrVector<MediaCondition>&&); static NonnullOwnPtr<MediaCondition> from_and_list(NonnullOwnPtrVector<MediaCondition>&&);
static NonnullOwnPtr<MediaCondition> from_or_list(NonnullOwnPtrVector<MediaCondition>&&); static NonnullOwnPtr<MediaCondition> from_or_list(NonnullOwnPtrVector<MediaCondition>&&);
MatchResult evaluate(DOM::Window const&) const; MatchResult evaluate(HTML::Window const&) const;
String to_string() const; String to_string() const;
private: private:
@ -234,7 +234,7 @@ public:
static NonnullRefPtr<MediaQuery> create() { return adopt_ref(*new MediaQuery); } static NonnullRefPtr<MediaQuery> create() { return adopt_ref(*new MediaQuery); }
bool matches() const { return m_matches; } bool matches() const { return m_matches; }
bool evaluate(DOM::Window const&); bool evaluate(HTML::Window const&);
String to_string() const; String to_string() const;
private: private:

View file

@ -11,7 +11,7 @@
namespace Web::CSS { namespace Web::CSS {
Screen::Screen(DOM::Window& window) Screen::Screen(HTML::Window& window)
: RefCountForwarder(window) : RefCountForwarder(window)
{ {
} }

View file

@ -9,20 +9,20 @@
#include <AK/RefCountForwarder.h> #include <AK/RefCountForwarder.h>
#include <LibGfx/Rect.h> #include <LibGfx/Rect.h>
#include <LibWeb/Bindings/Wrappable.h> #include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/Forward.h> #include <LibWeb/Forward.h>
#include <LibWeb/HTML/Window.h>
namespace Web::CSS { namespace Web::CSS {
class Screen final class Screen final
: public RefCountForwarder<DOM::Window> : public RefCountForwarder<HTML::Window>
, public Bindings::Wrappable { , public Bindings::Wrappable {
public: public:
using WrapperType = Bindings::ScreenWrapper; using WrapperType = Bindings::ScreenWrapper;
using AllowOwnPtr = TrueType; using AllowOwnPtr = TrueType;
static NonnullOwnPtr<Screen> create(Badge<DOM::Window>, DOM::Window& window) static NonnullOwnPtr<Screen> create(Badge<HTML::Window>, HTML::Window& window)
{ {
return adopt_own(*new Screen(window)); return adopt_own(*new Screen(window));
} }
@ -35,9 +35,9 @@ public:
u32 pixel_depth() const { return 24; } u32 pixel_depth() const { return 24; }
private: private:
explicit Screen(DOM::Window&); explicit Screen(HTML::Window&);
DOM::Window const& window() const { return ref_count_target(); } HTML::Window const& window() const { return ref_count_target(); }
Gfx::IntRect screen_rect() const; Gfx::IntRect screen_rect() const;
}; };

View file

@ -11,8 +11,8 @@
#include <LibWeb/Bindings/WindowObject.h> #include <LibWeb/Bindings/WindowObject.h>
#include <LibWeb/Bindings/Wrappable.h> #include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/DOM/AbortSignal.h> #include <LibWeb/DOM/AbortSignal.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/Forward.h> #include <LibWeb/Forward.h>
#include <LibWeb/HTML/Window.h>
namespace Web::DOM { namespace Web::DOM {

View file

@ -10,8 +10,8 @@
#include <AK/Weakable.h> #include <AK/Weakable.h>
#include <LibWeb/Bindings/Wrappable.h> #include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/DOM/EventTarget.h> #include <LibWeb/DOM/EventTarget.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/Forward.h> #include <LibWeb/Forward.h>
#include <LibWeb/HTML/Window.h>
namespace Web::DOM { namespace Web::DOM {

View file

@ -5,7 +5,7 @@
*/ */
#include <LibWeb/DOM/Comment.h> #include <LibWeb/DOM/Comment.h>
#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/Window.h>
#include <LibWeb/Layout/TextNode.h> #include <LibWeb/Layout/TextNode.h>
namespace Web::DOM { namespace Web::DOM {

View file

@ -34,7 +34,6 @@
#include <LibWeb/DOM/Range.h> #include <LibWeb/DOM/Range.h>
#include <LibWeb/DOM/ShadowRoot.h> #include <LibWeb/DOM/ShadowRoot.h>
#include <LibWeb/DOM/Text.h> #include <LibWeb/DOM/Text.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/Dump.h> #include <LibWeb/Dump.h>
#include <LibWeb/HTML/AttributeNames.h> #include <LibWeb/HTML/AttributeNames.h>
#include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/BrowsingContext.h>
@ -56,6 +55,7 @@
#include <LibWeb/HTML/Parser/HTMLParser.h> #include <LibWeb/HTML/Parser/HTMLParser.h>
#include <LibWeb/HTML/Scripting/ExceptionReporter.h> #include <LibWeb/HTML/Scripting/ExceptionReporter.h>
#include <LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h> #include <LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Layout/BlockFormattingContext.h> #include <LibWeb/Layout/BlockFormattingContext.h>
#include <LibWeb/Layout/InitialContainingBlock.h> #include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Layout/TreeBuilder.h> #include <LibWeb/Layout/TreeBuilder.h>
@ -75,7 +75,7 @@ Document::Document(const AK::URL& url)
, m_style_computer(make<CSS::StyleComputer>(*this)) , m_style_computer(make<CSS::StyleComputer>(*this))
, m_style_sheets(CSS::StyleSheetList::create(*this)) , m_style_sheets(CSS::StyleSheetList::create(*this))
, m_url(url) , m_url(url)
, m_window(Window::create_with_document(*this)) , m_window(HTML::Window::create_with_document(*this))
, m_implementation(DOMImplementation::create({}, *this)) , m_implementation(DOMImplementation::create({}, *this))
, m_history(HTML::History::create(*this)) , m_history(HTML::History::create(*this))
{ {

View file

@ -242,7 +242,7 @@ public:
void removed_last_ref(); void removed_last_ref();
Window& window() { return *m_window; } HTML::Window& window() { return *m_window; }
ExceptionOr<void> write(Vector<String> const& strings); ExceptionOr<void> write(Vector<String> const& strings);
ExceptionOr<void> writeln(Vector<String> const& strings); ExceptionOr<void> writeln(Vector<String> const& strings);
@ -250,7 +250,7 @@ public:
ExceptionOr<Document*> open(String const& = "", String const& = ""); ExceptionOr<Document*> open(String const& = "", String const& = "");
ExceptionOr<void> close(); ExceptionOr<void> close();
Window* default_view() { return m_window; } HTML::Window* default_view() { return m_window; }
const String& content_type() const { return m_content_type; } const String& content_type() const { return m_content_type; }
void set_content_type(const String& content_type) { m_content_type = content_type; } void set_content_type(const String& content_type) { m_content_type = content_type; }
@ -360,7 +360,7 @@ private:
WeakPtr<HTML::BrowsingContext> m_browsing_context; WeakPtr<HTML::BrowsingContext> m_browsing_context;
AK::URL m_url; AK::URL m_url;
RefPtr<Window> m_window; RefPtr<HTML::Window> m_window;
RefPtr<Layout::InitialContainingBlock> m_layout_root; RefPtr<Layout::InitialContainingBlock> m_layout_root;

View file

@ -33,7 +33,7 @@ interface Document : Node {
readonly attribute Window? defaultView; readonly attribute Window? defaultView;
[CEReactions] Document open(optional DOMString unused1, optional DOMString unused2); [CEReactions] Document open(optional DOMString unused1, optional DOMString unused2);
// FIXME: implement ExceptionOr<Window> Document::open(...) // FIXME: implement ExceptionOr<HTML::Window> Document::open(...)
// WindowProxy? open(USVString url, DOMString name, DOMString features); // WindowProxy? open(USVString url, DOMString name, DOMString features);
[CEReactions] undefined close(); [CEReactions] undefined close();
[CEReactions] undefined write(DOMString... text); [CEReactions] undefined write(DOMString... text);

View file

@ -5,7 +5,7 @@
*/ */
#include <LibWeb/DOM/DocumentFragment.h> #include <LibWeb/DOM/DocumentFragment.h>
#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/Window.h>
namespace Web::DOM { namespace Web::DOM {

View file

@ -22,9 +22,9 @@
#include <LibWeb/DOM/IDLEventListener.h> #include <LibWeb/DOM/IDLEventListener.h>
#include <LibWeb/DOM/Node.h> #include <LibWeb/DOM/Node.h>
#include <LibWeb/DOM/ShadowRoot.h> #include <LibWeb/DOM/ShadowRoot.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/EventNames.h> #include <LibWeb/HTML/EventNames.h>
#include <LibWeb/HTML/Scripting/ExceptionReporter.h> #include <LibWeb/HTML/Scripting/ExceptionReporter.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/UIEvents/MouseEvent.h> #include <LibWeb/UIEvents/MouseEvent.h>
namespace Web::DOM { namespace Web::DOM {
@ -190,7 +190,7 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr<
target_override = target; target_override = target;
} else { } else {
// NOTE: This can be done because legacy_target_override is only set for events targeted at Window. // NOTE: This can be done because legacy_target_override is only set for events targeted at Window.
target_override = verify_cast<Window>(*target).associated_document(); target_override = verify_cast<HTML::Window>(*target).associated_document();
} }
RefPtr<EventTarget> activation_target; RefPtr<EventTarget> activation_target;
@ -229,7 +229,7 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr<
touch_targets.append(retarget(touch_target, parent)); touch_targets.append(retarget(touch_target, parent));
} }
if (is<Window>(parent) if (is<HTML::Window>(parent)
|| (is<Node>(parent) && verify_cast<Node>(*target).root().is_shadow_including_inclusive_ancestor_of(verify_cast<Node>(*parent)))) { || (is<Node>(parent) && verify_cast<Node>(*target).root().is_shadow_including_inclusive_ancestor_of(verify_cast<Node>(*parent)))) {
if (is_activation_event && event->bubbles() && !activation_target && parent->activation_behavior) if (is_activation_event && event->bubbles() && !activation_target && parent->activation_behavior)
activation_target = parent; activation_target = parent;

View file

@ -25,7 +25,6 @@
#include <LibWeb/DOM/EventDispatcher.h> #include <LibWeb/DOM/EventDispatcher.h>
#include <LibWeb/DOM/EventTarget.h> #include <LibWeb/DOM/EventTarget.h>
#include <LibWeb/DOM/IDLEventListener.h> #include <LibWeb/DOM/IDLEventListener.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/ErrorEvent.h> #include <LibWeb/HTML/ErrorEvent.h>
#include <LibWeb/HTML/EventHandler.h> #include <LibWeb/HTML/EventHandler.h>
#include <LibWeb/HTML/EventNames.h> #include <LibWeb/HTML/EventNames.h>
@ -33,6 +32,7 @@
#include <LibWeb/HTML/HTMLBodyElement.h> #include <LibWeb/HTML/HTMLBodyElement.h>
#include <LibWeb/HTML/HTMLFormElement.h> #include <LibWeb/HTML/HTMLFormElement.h>
#include <LibWeb/HTML/HTMLFrameSetElement.h> #include <LibWeb/HTML/HTMLFrameSetElement.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/UIEvents/EventNames.h> #include <LibWeb/UIEvents/EventNames.h>
namespace Web::DOM { namespace Web::DOM {
@ -315,8 +315,8 @@ Bindings::CallbackType* EventTarget::get_current_value_of_event_handler(FlyStrin
element = element_event_target; element = element_event_target;
document = element_event_target->document(); document = element_event_target->document();
} else { } else {
VERIFY(is<Window>(this)); VERIFY(is<HTML::Window>(this));
auto* window_event_target = verify_cast<Window>(this); auto* window_event_target = verify_cast<HTML::Window>(this);
document = window_event_target->associated_document(); document = window_event_target->associated_document();
} }
@ -346,7 +346,7 @@ Bindings::CallbackType* EventTarget::get_current_value_of_event_handler(FlyStrin
StringBuilder builder; StringBuilder builder;
// sourceText // sourceText
if (name == HTML::EventNames::error && is<Window>(this)) { if (name == HTML::EventNames::error && is<HTML::Window>(this)) {
// -> If name is onerror and eventTarget is a Window object // -> If name is onerror and eventTarget is a Window object
// The string formed by concatenating "function ", name, "(event, source, lineno, colno, error) {", U+000A LF, body, U+000A LF, and "}". // The string formed by concatenating "function ", name, "(event, source, lineno, colno, error) {", U+000A LF, body, U+000A LF, and "}".
builder.appendff("function {}(event, source, lineno, colno, error) {{\n{}\n}}", name, body); builder.appendff("function {}(event, source, lineno, colno, error) {{\n{}\n}}", name, body);
@ -511,14 +511,14 @@ void EventTarget::activate_event_handler(FlyString const& name, HTML::EventHandl
// FIXME: This is guess work on what global object the NativeFunction should be allocated on. // FIXME: This is guess work on what global object the NativeFunction should be allocated on.
// For <body> or <frameset> elements who just had an element attribute set, it will be this's wrapper, as `this` is the result of determine_target_of_event_handler // For <body> or <frameset> elements who just had an element attribute set, it will be this's wrapper, as `this` is the result of determine_target_of_event_handler
// returning the element's document's global object, which is the DOM::Window object. // returning the element's document's global object, which is the HTML::Window object.
// For any other HTMLElement who just had an element attribute set, `this` will be that HTMLElement, so the global object is this's document's realm's global object. // For any other HTMLElement who just had an element attribute set, `this` will be that HTMLElement, so the global object is this's document's realm's global object.
// For anything else, it came from JavaScript, so use the global object of the provided callback function. // For anything else, it came from JavaScript, so use the global object of the provided callback function.
// Sadly, this doesn't work if an element attribute is set on a <body> element before any script is run, as Window::wrapper() will be null. // Sadly, this doesn't work if an element attribute is set on a <body> element before any script is run, as Window::wrapper() will be null.
JS::GlobalObject* global_object = nullptr; JS::GlobalObject* global_object = nullptr;
if (is_attribute == IsAttribute::Yes) { if (is_attribute == IsAttribute::Yes) {
if (is<Window>(this)) { if (is<HTML::Window>(this)) {
auto* window_global_object = verify_cast<Window>(this)->wrapper(); auto* window_global_object = verify_cast<HTML::Window>(this)->wrapper();
global_object = static_cast<JS::GlobalObject*>(window_global_object); global_object = static_cast<JS::GlobalObject*>(window_global_object);
} else { } else {
auto* html_element = verify_cast<HTML::HTMLElement>(this); auto* html_element = verify_cast<HTML::HTMLElement>(this);
@ -606,7 +606,7 @@ JS::ThrowCompletionOr<void> EventTarget::process_event_handler_for_event(FlyStri
// 3. Let special error event handling be true if event is an ErrorEvent object, event's type is error, and event's currentTarget implements the WindowOrWorkerGlobalScope mixin. // 3. Let special error event handling be true if event is an ErrorEvent object, event's type is error, and event's currentTarget implements the WindowOrWorkerGlobalScope mixin.
// Otherwise, let special error event handling be false. // Otherwise, let special error event handling be false.
// FIXME: This doesn't check for WorkerGlobalScape as we don't currently have it. // FIXME: This doesn't check for WorkerGlobalScape as we don't currently have it.
bool special_error_event_handling = is<HTML::ErrorEvent>(event) && event.type() == HTML::EventNames::error && is<Window>(event.current_target().ptr()); bool special_error_event_handling = is<HTML::ErrorEvent>(event) && event.type() == HTML::EventNames::error && is<HTML::Window>(event.current_target().ptr());
// 4. Process the Event object event as follows: // 4. Process the Event object event as follows:
JS::Completion return_value_or_error; JS::Completion return_value_or_error;

View file

@ -9,11 +9,11 @@
#include <LibWeb/DOM/DocumentType.h> #include <LibWeb/DOM/DocumentType.h>
#include <LibWeb/DOM/Node.h> #include <LibWeb/DOM/Node.h>
#include <LibWeb/DOM/Range.h> #include <LibWeb/DOM/Range.h>
#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/Window.h>
namespace Web::DOM { namespace Web::DOM {
NonnullRefPtr<Range> Range::create(Window& window) NonnullRefPtr<Range> Range::create(HTML::Window& window)
{ {
return Range::create(window.associated_document()); return Range::create(window.associated_document());
} }

View file

@ -18,7 +18,7 @@ public:
virtual ~Range() override; virtual ~Range() override;
static NonnullRefPtr<Range> create(Document&); static NonnullRefPtr<Range> create(Document&);
static NonnullRefPtr<Range> create(Window&); static NonnullRefPtr<Range> create(HTML::Window&);
static NonnullRefPtr<Range> create(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset); static NonnullRefPtr<Range> create(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset);
static NonnullRefPtr<Range> create_with_global_object(Bindings::WindowObject&); static NonnullRefPtr<Range> create_with_global_object(Bindings::WindowObject&);

View file

@ -5,8 +5,8 @@
*/ */
#include <LibWeb/DOM/Text.h> #include <LibWeb/DOM/Text.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/HTMLInputElement.h> #include <LibWeb/HTML/HTMLInputElement.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Layout/TextNode.h> #include <LibWeb/Layout/TextNode.h>
namespace Web::DOM { namespace Web::DOM {

View file

@ -6,16 +6,16 @@
#include <LibCore/Timer.h> #include <LibCore/Timer.h>
#include <LibWeb/DOM/Timer.h> #include <LibWeb/DOM/Timer.h>
#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/Window.h>
namespace Web::DOM { namespace Web::DOM {
NonnullRefPtr<Timer> Timer::create(Window& window, i32 milliseconds, Function<void()> callback, i32 id) NonnullRefPtr<Timer> Timer::create(HTML::Window& window, i32 milliseconds, Function<void()> callback, i32 id)
{ {
return adopt_ref(*new Timer(window, milliseconds, move(callback), id)); return adopt_ref(*new Timer(window, milliseconds, move(callback), id));
} }
Timer::Timer(Window& window, i32 milliseconds, Function<void()> callback, i32 id) Timer::Timer(HTML::Window& window, i32 milliseconds, Function<void()> callback, i32 id)
: m_window(window) : m_window(window)
, m_id(id) , m_id(id)
{ {

View file

@ -15,16 +15,16 @@ namespace Web::DOM {
class Timer final : public RefCounted<Timer> { class Timer final : public RefCounted<Timer> {
public: public:
static NonnullRefPtr<Timer> create(Window& window, i32 milliseconds, Function<void()> callback, i32 id); static NonnullRefPtr<Timer> create(HTML::Window& window, i32 milliseconds, Function<void()> callback, i32 id);
~Timer(); ~Timer();
void start(); void start();
private: private:
Timer(Window& window, i32 milliseconds, Function<void()> callback, i32 id); Timer(HTML::Window& window, i32 milliseconds, Function<void()> callback, i32 id);
RefPtr<Core::Timer> m_timer; RefPtr<Core::Timer> m_timer;
Window& m_window; HTML::Window& m_window;
i32 m_id { 0 }; i32 m_id { 0 };
}; };

View file

@ -120,7 +120,6 @@ class StaticNodeList;
class StaticRange; class StaticRange;
class Text; class Text;
class Timer; class Timer;
class Window;
enum class QuirksMode; enum class QuirksMode;
struct EventListenerOptions; struct EventListenerOptions;
struct AddEventListenerOptions; struct AddEventListenerOptions;
@ -235,6 +234,7 @@ class WorkerDebugConsoleClient;
class Storage; class Storage;
class SubmitEvent; class SubmitEvent;
class TextMetrics; class TextMetrics;
class Window;
class WindowEnvironmentSettingsObject; class WindowEnvironmentSettingsObject;
class Worker; class Worker;
class WorkerEnvironmentSettingsObject; class WorkerEnvironmentSettingsObject;

View file

@ -6,12 +6,12 @@
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/HTMLCollection.h> #include <LibWeb/DOM/HTMLCollection.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/HTML/BrowsingContextContainer.h> #include <LibWeb/HTML/BrowsingContextContainer.h>
#include <LibWeb/HTML/EventLoop/EventLoop.h> #include <LibWeb/HTML/EventLoop/EventLoop.h>
#include <LibWeb/HTML/HTMLAnchorElement.h> #include <LibWeb/HTML/HTMLAnchorElement.h>
#include <LibWeb/HTML/HTMLInputElement.h> #include <LibWeb/HTML/HTMLInputElement.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Layout/BreakNode.h> #include <LibWeb/Layout/BreakNode.h>
#include <LibWeb/Layout/InitialContainingBlock.h> #include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Layout/TextNode.h> #include <LibWeb/Layout/TextNode.h>

View file

@ -13,12 +13,12 @@
#include <LibWeb/Bindings/CanvasRenderingContext2DWrapper.h> #include <LibWeb/Bindings/CanvasRenderingContext2DWrapper.h>
#include <LibWeb/Bindings/WindowObject.h> #include <LibWeb/Bindings/WindowObject.h>
#include <LibWeb/DOM/ExceptionOr.h> #include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/CanvasRenderingContext2D.h> #include <LibWeb/HTML/CanvasRenderingContext2D.h>
#include <LibWeb/HTML/HTMLCanvasElement.h> #include <LibWeb/HTML/HTMLCanvasElement.h>
#include <LibWeb/HTML/HTMLImageElement.h> #include <LibWeb/HTML/HTMLImageElement.h>
#include <LibWeb/HTML/ImageData.h> #include <LibWeb/HTML/ImageData.h>
#include <LibWeb/HTML/TextMetrics.h> #include <LibWeb/HTML/TextMetrics.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Layout/TextNode.h> #include <LibWeb/Layout/TextNode.h>
namespace Web::HTML { namespace Web::HTML {

View file

@ -37,7 +37,7 @@ public:
protected: protected:
CloseEvent(FlyString const& event_name, CloseEventInit const& event_init) CloseEvent(FlyString const& event_name, CloseEventInit const& event_init)
: Event(event_name, event_init) : DOM::Event(event_name, event_init)
, m_was_clean(event_init.was_clean) , m_was_clean(event_init.was_clean)
, m_code(event_init.code) , m_code(event_init.code)
, m_reason(event_init.reason) , m_reason(event_init.reason)

View file

@ -9,10 +9,10 @@
#include <LibJS/Runtime/VM.h> #include <LibJS/Runtime/VM.h>
#include <LibWeb/Bindings/MainThreadVM.h> #include <LibWeb/Bindings/MainThreadVM.h>
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/HTML/EventLoop/EventLoop.h> #include <LibWeb/HTML/EventLoop/EventLoop.h>
#include <LibWeb/HTML/Scripting/Environments.h> #include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/HighResolutionTime/Performance.h> #include <LibWeb/HighResolutionTime/Performance.h>
namespace Web::HTML { namespace Web::HTML {

View file

@ -7,8 +7,8 @@
#include <LibWeb/CSS/StyleProperties.h> #include <LibWeb/CSS/StyleProperties.h>
#include <LibWeb/CSS/StyleValue.h> #include <LibWeb/CSS/StyleValue.h>
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/HTMLBodyElement.h> #include <LibWeb/HTML/HTMLBodyElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML { namespace Web::HTML {

View file

@ -11,13 +11,13 @@
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/ExceptionOr.h> #include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/DOM/IDLEventListener.h> #include <LibWeb/DOM/IDLEventListener.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/HTML/BrowsingContextContainer.h> #include <LibWeb/HTML/BrowsingContextContainer.h>
#include <LibWeb/HTML/EventHandler.h> #include <LibWeb/HTML/EventHandler.h>
#include <LibWeb/HTML/HTMLAnchorElement.h> #include <LibWeb/HTML/HTMLAnchorElement.h>
#include <LibWeb/HTML/HTMLBodyElement.h> #include <LibWeb/HTML/HTMLBodyElement.h>
#include <LibWeb/HTML/HTMLElement.h> #include <LibWeb/HTML/HTMLElement.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Layout/Box.h> #include <LibWeb/Layout/Box.h>
#include <LibWeb/Layout/BreakNode.h> #include <LibWeb/Layout/BreakNode.h>
#include <LibWeb/Layout/TextNode.h> #include <LibWeb/Layout/TextNode.h>

View file

@ -54,7 +54,7 @@ protected:
private: private:
// ^HTML::GlobalEventHandlers // ^HTML::GlobalEventHandlers
virtual EventTarget& global_event_handlers_to_event_target() override { return *this; } virtual DOM::EventTarget& global_event_handlers_to_event_target() override { return *this; }
enum class ContentEditableState { enum class ContentEditableState {
True, True,

View file

@ -11,10 +11,10 @@
#include <LibWeb/DOM/Event.h> #include <LibWeb/DOM/Event.h>
#include <LibWeb/DOM/ShadowRoot.h> #include <LibWeb/DOM/ShadowRoot.h>
#include <LibWeb/DOM/Text.h> #include <LibWeb/DOM/Text.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/EventNames.h> #include <LibWeb/HTML/EventNames.h>
#include <LibWeb/HTML/HTMLScriptElement.h> #include <LibWeb/HTML/HTMLScriptElement.h>
#include <LibWeb/HTML/Scripting/ClassicScript.h> #include <LibWeb/HTML/Scripting/ClassicScript.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Loader/ResourceLoader.h> #include <LibWeb/Loader/ResourceLoader.h>
namespace Web::HTML { namespace Web::HTML {

View file

@ -9,8 +9,8 @@
#include <AK/RefCounted.h> #include <AK/RefCounted.h>
#include <LibWeb/Bindings/Wrappable.h> #include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/DOM/EventTarget.h> #include <LibWeb/DOM/EventTarget.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/Forward.h> #include <LibWeb/Forward.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML { namespace Web::HTML {

View file

@ -16,7 +16,6 @@
#include <LibWeb/DOM/Event.h> #include <LibWeb/DOM/Event.h>
#include <LibWeb/DOM/ProcessingInstruction.h> #include <LibWeb/DOM/ProcessingInstruction.h>
#include <LibWeb/DOM/Text.h> #include <LibWeb/DOM/Text.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/EventLoop/EventLoop.h> #include <LibWeb/HTML/EventLoop/EventLoop.h>
#include <LibWeb/HTML/EventNames.h> #include <LibWeb/HTML/EventNames.h>
#include <LibWeb/HTML/HTMLFormElement.h> #include <LibWeb/HTML/HTMLFormElement.h>
@ -27,6 +26,7 @@
#include <LibWeb/HTML/Parser/HTMLEncodingDetection.h> #include <LibWeb/HTML/Parser/HTMLEncodingDetection.h>
#include <LibWeb/HTML/Parser/HTMLParser.h> #include <LibWeb/HTML/Parser/HTMLParser.h>
#include <LibWeb/HTML/Parser/HTMLToken.h> #include <LibWeb/HTML/Parser/HTMLToken.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Namespace.h> #include <LibWeb/Namespace.h>
#include <LibWeb/SVG/TagNames.h> #include <LibWeb/SVG/TagNames.h>
@ -276,7 +276,7 @@ void HTMLParser::the_end()
return; return;
// 3. Let window be the Document's relevant global object. // 3. Let window be the Document's relevant global object.
NonnullRefPtr<DOM::Window> window = document->window(); NonnullRefPtr<Window> window = document->window();
// FIXME: 4. Set the Document's load timing info's load event start time to the current high resolution time given window. // FIXME: 4. Set the Document's load timing info's load event start time to the current high resolution time given window.

View file

@ -8,9 +8,9 @@
#include <LibWeb/Bindings/MainThreadVM.h> #include <LibWeb/Bindings/MainThreadVM.h>
#include <LibWeb/Bindings/WindowObject.h> #include <LibWeb/Bindings/WindowObject.h>
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/PromiseRejectionEvent.h> #include <LibWeb/HTML/PromiseRejectionEvent.h>
#include <LibWeb/HTML/Scripting/Environments.h> #include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML { namespace Web::HTML {

View file

@ -10,7 +10,7 @@
namespace Web::HTML { namespace Web::HTML {
WindowEnvironmentSettingsObject::WindowEnvironmentSettingsObject(DOM::Window& window, JS::ExecutionContext& execution_context) WindowEnvironmentSettingsObject::WindowEnvironmentSettingsObject(Window& window, JS::ExecutionContext& execution_context)
: EnvironmentSettingsObject(execution_context) : EnvironmentSettingsObject(execution_context)
, m_window(window) , m_window(window)
{ {

View file

@ -6,8 +6,8 @@
#pragma once #pragma once
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/Scripting/Environments.h> #include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML { namespace Web::HTML {
@ -24,9 +24,9 @@ public:
virtual CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override; virtual CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override;
private: private:
WindowEnvironmentSettingsObject(DOM::Window&, JS::ExecutionContext& execution_context); WindowEnvironmentSettingsObject(Window&, JS::ExecutionContext& execution_context);
NonnullRefPtr<DOM::Window> m_window; NonnullRefPtr<Window> m_window;
}; };
} }

View file

@ -13,7 +13,7 @@
namespace Web::HTML { namespace Web::HTML {
// FIXME: This is a bit ugly, this implementation is basically a 1:1 copy of what is in ESO // FIXME: This is a bit ugly, this implementation is basically a 1:1 copy of what is in ESO
// just modified to use DOM::Document instead of DOM::Window since workers have no window // just modified to use DOM::Document instead of HTML::Window since workers have no window
class WorkerEnvironmentSettingsObject final class WorkerEnvironmentSettingsObject final
: public EnvironmentSettingsObject : public EnvironmentSettingsObject
, public Weakable<WorkerEnvironmentSettingsObject> { , public Weakable<WorkerEnvironmentSettingsObject> {

View file

@ -16,7 +16,6 @@
#include <LibWeb/DOM/Event.h> #include <LibWeb/DOM/Event.h>
#include <LibWeb/DOM/EventDispatcher.h> #include <LibWeb/DOM/EventDispatcher.h>
#include <LibWeb/DOM/Timer.h> #include <LibWeb/DOM/Timer.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/HTML/EventLoop/EventLoop.h> #include <LibWeb/HTML/EventLoop/EventLoop.h>
#include <LibWeb/HTML/MessageEvent.h> #include <LibWeb/HTML/MessageEvent.h>
@ -24,12 +23,13 @@
#include <LibWeb/HTML/Scripting/ClassicScript.h> #include <LibWeb/HTML/Scripting/ClassicScript.h>
#include <LibWeb/HTML/Scripting/ExceptionReporter.h> #include <LibWeb/HTML/Scripting/ExceptionReporter.h>
#include <LibWeb/HTML/Storage.h> #include <LibWeb/HTML/Storage.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/HighResolutionTime/Performance.h> #include <LibWeb/HighResolutionTime/Performance.h>
#include <LibWeb/Layout/InitialContainingBlock.h> #include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Page/Page.h> #include <LibWeb/Page/Page.h>
#include <LibWeb/Selection/Selection.h> #include <LibWeb/Selection/Selection.h>
namespace Web::DOM { namespace Web::HTML {
class RequestAnimationFrameCallback : public RefCounted<RequestAnimationFrameCallback> { class RequestAnimationFrameCallback : public RefCounted<RequestAnimationFrameCallback> {
public: public:
@ -107,13 +107,13 @@ void run_animation_frame_callbacks(DOM::Document&, double)
request_animation_frame_driver().run(); request_animation_frame_driver().run();
} }
NonnullRefPtr<Window> Window::create_with_document(Document& document) NonnullRefPtr<Window> Window::create_with_document(DOM::Document& document)
{ {
return adopt_ref(*new Window(document)); return adopt_ref(*new Window(document));
} }
Window::Window(Document& document) Window::Window(DOM::Document& document)
: EventTarget() : DOM::EventTarget()
, m_associated_document(document) , m_associated_document(document)
, m_performance(make<HighResolutionTime::Performance>(*this)) , m_performance(make<HighResolutionTime::Performance>(*this))
, m_crypto(Crypto::Crypto::create()) , m_crypto(Crypto::Crypto::create())
@ -174,7 +174,7 @@ void Window::clear_interval(i32 id)
m_timers.remove(id); m_timers.remove(id);
} }
void Window::deallocate_timer_id(Badge<Timer>, i32 id) void Window::deallocate_timer_id(Badge<DOM::Timer>, i32 id)
{ {
m_timer_id_allocator.deallocate(id); m_timer_id_allocator.deallocate(id);
} }
@ -262,7 +262,7 @@ i32 Window::run_timer_initialization_steps(Bindings::TimerHandler handler, i32 t
}; };
// 13. Run steps after a timeout given global, "setTimeout/setInterval", timeout, completionStep, and id. // 13. Run steps after a timeout given global, "setTimeout/setInterval", timeout, completionStep, and id.
auto timer = Timer::create(*this, timeout, move(completion_step), id); auto timer = DOM::Timer::create(*this, timeout, move(completion_step), id);
m_timers.set(id, timer); m_timers.set(id, timer);
timer->start(); timer->start();
@ -320,9 +320,9 @@ void Window::did_call_location_replace(Badge<Bindings::LocationObject>, String u
browsing_context->loader().load(move(new_url), FrameLoader::Type::Navigation); browsing_context->loader().load(move(new_url), FrameLoader::Type::Navigation);
} }
bool Window::dispatch_event(NonnullRefPtr<Event> event) bool Window::dispatch_event(NonnullRefPtr<DOM::Event> event)
{ {
return EventDispatcher::dispatch(*this, event, true); return DOM::EventDispatcher::dispatch(*this, event, true);
} }
JS::Object* Window::create_wrapper(JS::GlobalObject& global_object) JS::Object* Window::create_wrapper(JS::GlobalObject& global_object)

View file

@ -20,16 +20,16 @@
#include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/HTML/GlobalEventHandlers.h> #include <LibWeb/HTML/GlobalEventHandlers.h>
namespace Web::DOM { namespace Web::HTML {
class RequestAnimationFrameCallback; class RequestAnimationFrameCallback;
class Window final class Window final
: public RefCounted<Window> : public RefCounted<Window>
, public EventTarget , public DOM::EventTarget
, public HTML::GlobalEventHandlers { , public HTML::GlobalEventHandlers {
public: public:
static NonnullRefPtr<Window> create_with_document(Document&); static NonnullRefPtr<Window> create_with_document(DOM::Document&);
~Window(); ~Window();
using RefCounted::ref; using RefCounted::ref;
@ -37,15 +37,15 @@ public:
virtual void ref_event_target() override { RefCounted::ref(); } virtual void ref_event_target() override { RefCounted::ref(); }
virtual void unref_event_target() override { RefCounted::unref(); } virtual void unref_event_target() override { RefCounted::unref(); }
virtual bool dispatch_event(NonnullRefPtr<Event>) override; virtual bool dispatch_event(NonnullRefPtr<DOM::Event>) override;
virtual JS::Object* create_wrapper(JS::GlobalObject&) override; virtual JS::Object* create_wrapper(JS::GlobalObject&) override;
Page* page(); Page* page();
Page const* page() const; Page const* page() const;
// https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window // https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window
Document const& associated_document() const { return *m_associated_document; } DOM::Document const& associated_document() const { return *m_associated_document; }
Document& associated_document() { return *m_associated_document; } DOM::Document& associated_document() { return *m_associated_document; }
// https://html.spec.whatwg.org/multipage/window-object.html#window-bc // https://html.spec.whatwg.org/multipage/window-object.html#window-bc
HTML::BrowsingContext const* browsing_context() const { return m_associated_document->browsing_context(); } HTML::BrowsingContext const* browsing_context() const { return m_associated_document->browsing_context(); }
@ -76,7 +76,7 @@ public:
void set_wrapper(Badge<Bindings::WindowObject>, Bindings::WindowObject&); void set_wrapper(Badge<Bindings::WindowObject>, Bindings::WindowObject&);
void deallocate_timer_id(Badge<Timer>, i32); void deallocate_timer_id(Badge<DOM::Timer>, i32);
HighResolutionTime::Performance& performance() { return *m_performance; } HighResolutionTime::Performance& performance() { return *m_performance; }
@ -84,8 +84,8 @@ public:
CSS::Screen& screen() { return *m_screen; } CSS::Screen& screen() { return *m_screen; }
Event const* current_event() const { return m_current_event; } DOM::Event const* current_event() const { return m_current_event; }
void set_current_event(Event* event) { m_current_event = event; } void set_current_event(DOM::Event* event) { m_current_event = event; }
NonnullRefPtr<CSS::CSSStyleDeclaration> get_computed_style(DOM::Element&) const; NonnullRefPtr<CSS::CSSStyleDeclaration> get_computed_style(DOM::Element&) const;
NonnullRefPtr<CSS::MediaQueryList> match_media(String); NonnullRefPtr<CSS::MediaQueryList> match_media(String);
@ -110,7 +110,7 @@ public:
DOM::ExceptionOr<void> post_message(JS::Value, String const& target_origin); DOM::ExceptionOr<void> post_message(JS::Value, String const& target_origin);
private: private:
explicit Window(Document&); explicit Window(DOM::Document&);
// ^HTML::GlobalEventHandlers // ^HTML::GlobalEventHandlers
virtual DOM::EventTarget& global_event_handlers_to_event_target() override { return *this; } virtual DOM::EventTarget& global_event_handlers_to_event_target() override { return *this; }
@ -122,17 +122,17 @@ private:
i32 run_timer_initialization_steps(Bindings::TimerHandler handler, i32 timeout, JS::MarkedVector<JS::Value> arguments, Repeat repeat, Optional<i32> previous_id = {}); i32 run_timer_initialization_steps(Bindings::TimerHandler handler, i32 timeout, JS::MarkedVector<JS::Value> arguments, Repeat repeat, Optional<i32> previous_id = {});
// https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window // https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window
WeakPtr<Document> m_associated_document; WeakPtr<DOM::Document> m_associated_document;
WeakPtr<Bindings::WindowObject> m_wrapper; WeakPtr<Bindings::WindowObject> m_wrapper;
IDAllocator m_timer_id_allocator; IDAllocator m_timer_id_allocator;
HashMap<int, NonnullRefPtr<Timer>> m_timers; HashMap<int, NonnullRefPtr<DOM::Timer>> m_timers;
NonnullOwnPtr<HighResolutionTime::Performance> m_performance; NonnullOwnPtr<HighResolutionTime::Performance> m_performance;
NonnullRefPtr<Crypto::Crypto> m_crypto; NonnullRefPtr<Crypto::Crypto> m_crypto;
NonnullOwnPtr<CSS::Screen> m_screen; NonnullOwnPtr<CSS::Screen> m_screen;
RefPtr<Event> m_current_event; RefPtr<DOM::Event> m_current_event;
HashMap<i32, NonnullRefPtr<RequestAnimationFrameCallback>> m_request_animation_frame_callbacks; HashMap<i32, NonnullRefPtr<RequestAnimationFrameCallback>> m_request_animation_frame_callbacks;
}; };

View file

@ -8,12 +8,12 @@
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Event.h> #include <LibWeb/DOM/Event.h>
#include <LibWeb/DOM/EventDispatcher.h> #include <LibWeb/DOM/EventDispatcher.h>
#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/Window.h>
#include <LibWeb/HighResolutionTime/Performance.h> #include <LibWeb/HighResolutionTime/Performance.h>
namespace Web::HighResolutionTime { namespace Web::HighResolutionTime {
Performance::Performance(DOM::Window& window) Performance::Performance(HTML::Window& window)
: DOM::EventTarget() : DOM::EventTarget()
, m_window(window) , m_window(window)
, m_timing(make<NavigationTiming::PerformanceTiming>(window)) , m_timing(make<NavigationTiming::PerformanceTiming>(window))

View file

@ -21,7 +21,7 @@ public:
using WrapperType = Bindings::PerformanceWrapper; using WrapperType = Bindings::PerformanceWrapper;
using AllowOwnPtr = TrueType; using AllowOwnPtr = TrueType;
explicit Performance(DOM::Window&); explicit Performance(HTML::Window&);
~Performance(); ~Performance();
double now() const { return m_timer.elapsed(); } double now() const { return m_timer.elapsed(); }
@ -35,7 +35,7 @@ public:
virtual JS::Object* create_wrapper(JS::GlobalObject&) override; virtual JS::Object* create_wrapper(JS::GlobalObject&) override;
private: private:
DOM::Window& m_window; HTML::Window& m_window;
Core::ElapsedTimer m_timer; Core::ElapsedTimer m_timer;
OwnPtr<NavigationTiming::PerformanceTiming> m_timing; OwnPtr<NavigationTiming::PerformanceTiming> m_timing;

View file

@ -8,7 +8,7 @@
namespace Web::NavigationTiming { namespace Web::NavigationTiming {
PerformanceTiming::PerformanceTiming(DOM::Window& window) PerformanceTiming::PerformanceTiming(HTML::Window& window)
: RefCountForwarder(window) : RefCountForwarder(window)
{ {
} }

View file

@ -9,18 +9,18 @@
#include <AK/RefCountForwarder.h> #include <AK/RefCountForwarder.h>
#include <AK/StdLibExtras.h> #include <AK/StdLibExtras.h>
#include <LibWeb/Bindings/Wrappable.h> #include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/Window.h>
namespace Web::NavigationTiming { namespace Web::NavigationTiming {
class PerformanceTiming final class PerformanceTiming final
: public RefCountForwarder<DOM::Window> : public RefCountForwarder<HTML::Window>
, public Bindings::Wrappable { , public Bindings::Wrappable {
public: public:
using WrapperType = Bindings::PerformanceTimingWrapper; using WrapperType = Bindings::PerformanceTimingWrapper;
using AllowOwnPtr = TrueType; using AllowOwnPtr = TrueType;
explicit PerformanceTiming(DOM::Window&); explicit PerformanceTiming(HTML::Window&);
~PerformanceTiming(); ~PerformanceTiming();
u32 navigation_start() { return 0; } u32 navigation_start() { return 0; }

View file

@ -8,11 +8,11 @@
#include <LibGUI/Event.h> #include <LibGUI/Event.h>
#include <LibWeb/DOM/Range.h> #include <LibWeb/DOM/Range.h>
#include <LibWeb/DOM/Text.h> #include <LibWeb/DOM/Text.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/HTML/HTMLAnchorElement.h> #include <LibWeb/HTML/HTMLAnchorElement.h>
#include <LibWeb/HTML/HTMLIFrameElement.h> #include <LibWeb/HTML/HTMLIFrameElement.h>
#include <LibWeb/HTML/HTMLImageElement.h> #include <LibWeb/HTML/HTMLImageElement.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Layout/InitialContainingBlock.h> #include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Page/EventHandler.h> #include <LibWeb/Page/EventHandler.h>
#include <LibWeb/Page/Page.h> #include <LibWeb/Page/Page.h>

View file

@ -8,12 +8,12 @@
#include <AK/RefPtr.h> #include <AK/RefPtr.h>
#include <LibWeb/DOM/Event.h> #include <LibWeb/DOM/Event.h>
#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/Window.h>
namespace Web::UIEvents { namespace Web::UIEvents {
struct UIEventInit : public DOM::EventInit { struct UIEventInit : public DOM::EventInit {
RefPtr<DOM::Window> view { nullptr }; RefPtr<HTML::Window> view { nullptr };
int detail { 0 }; int detail { 0 };
}; };
@ -33,10 +33,10 @@ public:
virtual ~UIEvent() override { } virtual ~UIEvent() override { }
DOM::Window const* view() const { return m_view; } HTML::Window const* view() const { return m_view; }
int detail() const { return m_detail; } int detail() const { return m_detail; }
void init_ui_event(String const& type, bool bubbles, bool cancelable, DOM::Window* view, int detail) void init_ui_event(String const& type, bool bubbles, bool cancelable, HTML::Window* view, int detail)
{ {
init_event(type, bubbles, cancelable); init_event(type, bubbles, cancelable);
m_view = view; m_view = view;
@ -55,7 +55,7 @@ protected:
{ {
} }
RefPtr<DOM::Window> m_view; RefPtr<HTML::Window> m_view;
int m_detail { 0 }; int m_detail { 0 };
}; };

View file

@ -18,11 +18,11 @@
#include <LibWeb/DOM/EventDispatcher.h> #include <LibWeb/DOM/EventDispatcher.h>
#include <LibWeb/DOM/ExceptionOr.h> #include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/DOM/IDLEventListener.h> #include <LibWeb/DOM/IDLEventListener.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HTML/CloseEvent.h> #include <LibWeb/HTML/CloseEvent.h>
#include <LibWeb/HTML/EventHandler.h> #include <LibWeb/HTML/EventHandler.h>
#include <LibWeb/HTML/EventNames.h> #include <LibWeb/HTML/EventNames.h>
#include <LibWeb/HTML/MessageEvent.h> #include <LibWeb/HTML/MessageEvent.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Origin.h> #include <LibWeb/Origin.h>
#include <LibWeb/WebSockets/WebSocket.h> #include <LibWeb/WebSockets/WebSocket.h>
@ -67,7 +67,7 @@ DOM::ExceptionOr<NonnullRefPtr<WebSocket>> WebSocket::create_with_global_object(
return WebSocket::create(window.impl(), url_record); return WebSocket::create(window.impl(), url_record);
} }
WebSocket::WebSocket(DOM::Window& window, AK::URL& url) WebSocket::WebSocket(HTML::Window& window, AK::URL& url)
: EventTarget() : EventTarget()
, m_window(window) , m_window(window)
{ {

View file

@ -59,7 +59,7 @@ public:
using WrapperType = Bindings::WebSocketWrapper; using WrapperType = Bindings::WebSocketWrapper;
static NonnullRefPtr<WebSocket> create(DOM::Window& window, AK::URL& url) static NonnullRefPtr<WebSocket> create(HTML::Window& window, AK::URL& url)
{ {
return adopt_ref(*new WebSocket(window, url)); return adopt_ref(*new WebSocket(window, url));
} }
@ -100,9 +100,9 @@ private:
void on_error(); void on_error();
void on_close(u16 code, String reason, bool was_clean); void on_close(u16 code, String reason, bool was_clean);
explicit WebSocket(DOM::Window&, AK::URL&); explicit WebSocket(HTML::Window&, AK::URL&);
NonnullRefPtr<DOM::Window> m_window; NonnullRefPtr<HTML::Window> m_window;
AK::URL m_url; AK::URL m_url;
String m_binary_type { "blob" }; String m_binary_type { "blob" };

View file

@ -22,10 +22,10 @@
#include <LibWeb/DOM/EventDispatcher.h> #include <LibWeb/DOM/EventDispatcher.h>
#include <LibWeb/DOM/ExceptionOr.h> #include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/DOM/IDLEventListener.h> #include <LibWeb/DOM/IDLEventListener.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/Fetch/AbstractOperations.h> #include <LibWeb/Fetch/AbstractOperations.h>
#include <LibWeb/HTML/EventHandler.h> #include <LibWeb/HTML/EventHandler.h>
#include <LibWeb/HTML/EventNames.h> #include <LibWeb/HTML/EventNames.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Loader/ResourceLoader.h> #include <LibWeb/Loader/ResourceLoader.h>
#include <LibWeb/Origin.h> #include <LibWeb/Origin.h>
#include <LibWeb/Page/Page.h> #include <LibWeb/Page/Page.h>
@ -35,7 +35,7 @@
namespace Web::XHR { namespace Web::XHR {
XMLHttpRequest::XMLHttpRequest(DOM::Window& window) XMLHttpRequest::XMLHttpRequest(HTML::Window& window)
: XMLHttpRequestEventTarget() : XMLHttpRequestEventTarget()
, m_window(window) , m_window(window)
, m_response_type(Bindings::XMLHttpRequestResponseType::Empty) , m_response_type(Bindings::XMLHttpRequestResponseType::Empty)

View file

@ -34,7 +34,7 @@ public:
using WrapperType = Bindings::XMLHttpRequestWrapper; using WrapperType = Bindings::XMLHttpRequestWrapper;
static NonnullRefPtr<XMLHttpRequest> create(DOM::Window& window) static NonnullRefPtr<XMLHttpRequest> create(HTML::Window& window)
{ {
return adopt_ref(*new XMLHttpRequest(window)); return adopt_ref(*new XMLHttpRequest(window));
} }
@ -86,9 +86,9 @@ private:
Optional<Vector<String>> get_decode_and_split(String const& header_name, HashMap<String, String, CaseInsensitiveStringTraits> const& header_list) const; Optional<Vector<String>> get_decode_and_split(String const& header_name, HashMap<String, String, CaseInsensitiveStringTraits> const& header_list) const;
Optional<MimeSniff::MimeType> extract_mime_type(HashMap<String, String, CaseInsensitiveStringTraits> const& header_list) const; Optional<MimeSniff::MimeType> extract_mime_type(HashMap<String, String, CaseInsensitiveStringTraits> const& header_list) const;
explicit XMLHttpRequest(DOM::Window&); explicit XMLHttpRequest(HTML::Window&);
NonnullRefPtr<DOM::Window> m_window; NonnullRefPtr<HTML::Window> m_window;
ReadyState m_ready_state { ReadyState::Unsent }; ReadyState m_ready_state { ReadyState::Unsent };
unsigned m_status { 0 }; unsigned m_status { 0 };

View file

@ -17,11 +17,11 @@
#include <LibWeb/Bindings/MainThreadVM.h> #include <LibWeb/Bindings/MainThreadVM.h>
#include <LibWeb/Cookie/ParsedCookie.h> #include <LibWeb/Cookie/ParsedCookie.h>
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Window.h>
#include <LibWeb/Dump.h> #include <LibWeb/Dump.h>
#include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/HTML/Scripting/ClassicScript.h> #include <LibWeb/HTML/Scripting/ClassicScript.h>
#include <LibWeb/HTML/Storage.h> #include <LibWeb/HTML/Storage.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Layout/InitialContainingBlock.h> #include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Loader/ContentFilter.h> #include <LibWeb/Loader/ContentFilter.h>
#include <LibWeb/Loader/ResourceLoader.h> #include <LibWeb/Loader/ResourceLoader.h>

View file

@ -10,7 +10,7 @@
#include <LibWeb/Bindings/NodeWrapperFactory.h> #include <LibWeb/Bindings/NodeWrapperFactory.h>
#include <LibWeb/Bindings/WindowObject.h> #include <LibWeb/Bindings/WindowObject.h>
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/Window.h>
namespace WebContent { namespace WebContent {