diff options
author | Linus Groh <mail@linusgroh.de> | 2022-03-07 23:08:26 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-03-08 00:30:30 +0100 |
commit | 1422bd45ebda117238c452b4cf2ba7d1b54ce453 (patch) | |
tree | c35ff8fb4ffb1c36ff0e17f5b27c4c89189fad76 /Userland | |
parent | 2dfb617c5bf5557052a4fded2cc37ab8574a5e93 (diff) | |
download | serenity-1422bd45ebda117238c452b4cf2ba7d1b54ce453.zip |
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
Diffstat (limited to 'Userland')
61 files changed, 131 insertions, 131 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp index 4a9d5d5c05..53656f0d55 100644 --- a/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp +++ b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp @@ -9,7 +9,7 @@ #include <LibWeb/Bindings/HTMLAudioElementWrapper.h> #include <LibWeb/Bindings/NodeWrapperFactory.h> #include <LibWeb/DOM/ElementFactory.h> -#include <LibWeb/DOM/Window.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/Namespace.h> namespace Web::Bindings { diff --git a/Userland/Libraries/LibWeb/Bindings/ImageConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/ImageConstructor.cpp index 9acff1182c..6456ac1b35 100644 --- a/Userland/Libraries/LibWeb/Bindings/ImageConstructor.cpp +++ b/Userland/Libraries/LibWeb/Bindings/ImageConstructor.cpp @@ -9,7 +9,7 @@ #include <LibWeb/Bindings/ImageConstructor.h> #include <LibWeb/Bindings/NodeWrapperFactory.h> #include <LibWeb/DOM/ElementFactory.h> -#include <LibWeb/DOM/Window.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/Namespace.h> namespace Web::Bindings { diff --git a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp index 52f0cef934..3e0c063c10 100644 --- a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp @@ -17,7 +17,7 @@ #include <LibWeb/Bindings/WindowObject.h> #include <LibWeb/DOM/DOMException.h> #include <LibWeb/DOM/Document.h> -#include <LibWeb/DOM/Window.h> +#include <LibWeb/HTML/Window.h> namespace Web::Bindings { diff --git a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp index 0586bbf471..b74a8d0fa8 100644 --- a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp +++ b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp @@ -12,11 +12,11 @@ #include <LibJS/Runtime/VM.h> #include <LibWeb/Bindings/MainThreadVM.h> #include <LibWeb/DOM/Document.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/PromiseRejectionEvent.h> #include <LibWeb/HTML/Scripting/ClassicScript.h> #include <LibWeb/HTML/Scripting/Environments.h> #include <LibWeb/HTML/Scripting/ExceptionReporter.h> +#include <LibWeb/HTML/Window.h> namespace Web::Bindings { diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp index bb2fd96f10..fb9079eb21 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp @@ -38,18 +38,18 @@ #include <LibWeb/Crypto/Crypto.h> #include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Event.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/EventHandler.h> #include <LibWeb/HTML/Scripting/Environments.h> #include <LibWeb/HTML/Storage.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/Origin.h> #include <LibWeb/Page/Page.h> #include <LibWeb/WebAssembly/WebAssemblyObject.h> namespace Web::Bindings { -WindowObject::WindowObject(DOM::Window& impl) +WindowObject::WindowObject(HTML::Window& impl) : m_impl(impl) { impl.set_wrapper({}, *this); @@ -164,7 +164,7 @@ JS::ThrowCompletionOr<bool> WindowObject::internal_set_prototype_of(JS::Object* 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 // this means that a nullish this_value should be converted to the diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.h b/Userland/Libraries/LibWeb/Bindings/WindowObject.h index 8efc18177e..2e35d12bef 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowObject.h +++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.h @@ -30,12 +30,12 @@ class WindowObject JS_OBJECT(WindowObject, JS::GlobalObject); public: - explicit WindowObject(DOM::Window&); + explicit WindowObject(HTML::Window&); virtual void initialize_global_object() override; virtual ~WindowObject() override; - DOM::Window& impl() { return *m_impl; } - const DOM::Window& impl() const { return *m_impl; } + HTML::Window& impl() { return *m_impl; } + const HTML::Window& impl() const { return *m_impl; } Origin origin() const; @@ -135,7 +135,7 @@ private: ENUMERATE_GLOBAL_EVENT_HANDLERS(__ENUMERATE); #undef __ENUMERATE - NonnullRefPtr<DOM::Window> m_impl; + NonnullRefPtr<HTML::Window> m_impl; LocationObject* m_location_object { nullptr }; diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 0862d85a98..ee93c33b23 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -99,7 +99,6 @@ set(SOURCES DOM/Text.cpp DOM/Text.idl DOM/Timer.cpp - DOM/Window.cpp DOMParsing/InnerHTML.cpp DOMTreeModel.cpp Dump.cpp @@ -214,6 +213,7 @@ set(SOURCES HTML/SyntaxHighlighter/SyntaxHighlighter.cpp HTML/TagNames.cpp HTML/TextMetrics.cpp + HTML/Window.cpp HTML/Worker.cpp HTML/WorkerDebugConsoleClient.cpp HTML/WorkerGlobalScope.cpp diff --git a/Userland/Libraries/LibWeb/CSS/CSSMediaRule.h b/Userland/Libraries/LibWeb/CSS/CSSMediaRule.h index b4833b31a6..43f475824b 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSMediaRule.h +++ b/Userland/Libraries/LibWeb/CSS/CSSMediaRule.h @@ -34,7 +34,7 @@ public: 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: explicit CSSMediaRule(NonnullRefPtr<MediaList>&&, NonnullRefPtrVector<CSSRule>&&); diff --git a/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp b/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp index 9ceed93f82..1f4e40447c 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp @@ -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; diff --git a/Userland/Libraries/LibWeb/CSS/CSSRuleList.h b/Userland/Libraries/LibWeb/CSS/CSSRuleList.h index 4c2fa5d9bd..1e88a87c9b 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSRuleList.h +++ b/Userland/Libraries/LibWeb/CSS/CSSRuleList.h @@ -53,7 +53,7 @@ public: 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. - bool evaluate_media_queries(DOM::Window const&); + bool evaluate_media_queries(HTML::Window const&); private: explicit CSSRuleList(NonnullRefPtrVector<CSSRule>&&); diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp b/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp index 5aa5a03bd3..36dc0b9df8 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp @@ -62,7 +62,7 @@ void CSSStyleSheet::for_each_effective_style_rule(Function<void(CSSStyleRule con 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); } diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.h b/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.h index 30d38337e5..45e255d029 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.h +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.h @@ -48,7 +48,7 @@ public: 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. - bool evaluate_media_queries(DOM::Window const&); + bool evaluate_media_queries(HTML::Window const&); private: explicit CSSStyleSheet(NonnullRefPtrVector<CSSRule>); diff --git a/Userland/Libraries/LibWeb/CSS/MediaList.cpp b/Userland/Libraries/LibWeb/CSS/MediaList.cpp index 17b81c95f1..4d98ca7241 100644 --- a/Userland/Libraries/LibWeb/CSS/MediaList.cpp +++ b/Userland/Libraries/LibWeb/CSS/MediaList.cpp @@ -65,7 +65,7 @@ void MediaList::delete_medium(String medium) // 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) media.evaluate(window); diff --git a/Userland/Libraries/LibWeb/CSS/MediaList.h b/Userland/Libraries/LibWeb/CSS/MediaList.h index d264654316..adee044916 100644 --- a/Userland/Libraries/LibWeb/CSS/MediaList.h +++ b/Userland/Libraries/LibWeb/CSS/MediaList.h @@ -29,7 +29,7 @@ public: void append_medium(String); void delete_medium(String); - bool evaluate(DOM::Window const&); + bool evaluate(HTML::Window const&); bool matches() const; private: diff --git a/Userland/Libraries/LibWeb/CSS/MediaQuery.cpp b/Userland/Libraries/LibWeb/CSS/MediaQuery.cpp index b16c4fa335..2253fcf535 100644 --- a/Userland/Libraries/LibWeb/CSS/MediaQuery.cpp +++ b/Userland/Libraries/LibWeb/CSS/MediaQuery.cpp @@ -7,7 +7,7 @@ #include <LibWeb/CSS/MediaQuery.h> #include <LibWeb/CSS/Serialize.h> #include <LibWeb/DOM/Document.h> -#include <LibWeb/DOM/Window.h> +#include <LibWeb/HTML/Window.h> namespace Web::CSS { @@ -77,7 +77,7 @@ String MediaFeature::to_string() const 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); if (!maybe_queried_value.has_value()) @@ -122,7 +122,7 @@ bool MediaFeature::evaluate(DOM::Window const& window) const 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)) return false; @@ -298,7 +298,7 @@ String MediaCondition::to_string() const return builder.to_string(); } -MatchResult MediaCondition::evaluate(DOM::Window const& window) const +MatchResult MediaCondition::evaluate(HTML::Window const& window) const { switch (type) { case Type::Single: @@ -369,7 +369,7 @@ String MediaQuery::to_string() const return builder.to_string(); } -bool MediaQuery::evaluate(DOM::Window const& window) +bool MediaQuery::evaluate(HTML::Window const& window) { auto matches_media = [](MediaType media) -> MatchResult { switch (media) { diff --git a/Userland/Libraries/LibWeb/CSS/MediaQuery.h b/Userland/Libraries/LibWeb/CSS/MediaQuery.h index 60871335d2..9cf0357b67 100644 --- a/Userland/Libraries/LibWeb/CSS/MediaQuery.h +++ b/Userland/Libraries/LibWeb/CSS/MediaQuery.h @@ -140,7 +140,7 @@ public: return feature; } - bool evaluate(DOM::Window const&) const; + bool evaluate(HTML::Window const&) const; String to_string() const; 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 { MediaFeatureValue left_value; @@ -196,7 +196,7 @@ struct MediaCondition { static NonnullOwnPtr<MediaCondition> from_and_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; private: @@ -234,7 +234,7 @@ public: static NonnullRefPtr<MediaQuery> create() { return adopt_ref(*new MediaQuery); } bool matches() const { return m_matches; } - bool evaluate(DOM::Window const&); + bool evaluate(HTML::Window const&); String to_string() const; private: diff --git a/Userland/Libraries/LibWeb/CSS/Screen.cpp b/Userland/Libraries/LibWeb/CSS/Screen.cpp index c4610b7f28..42ec725602 100644 --- a/Userland/Libraries/LibWeb/CSS/Screen.cpp +++ b/Userland/Libraries/LibWeb/CSS/Screen.cpp @@ -11,7 +11,7 @@ namespace Web::CSS { -Screen::Screen(DOM::Window& window) +Screen::Screen(HTML::Window& window) : RefCountForwarder(window) { } diff --git a/Userland/Libraries/LibWeb/CSS/Screen.h b/Userland/Libraries/LibWeb/CSS/Screen.h index d76a5c0620..ea6de94951 100644 --- a/Userland/Libraries/LibWeb/CSS/Screen.h +++ b/Userland/Libraries/LibWeb/CSS/Screen.h @@ -9,20 +9,20 @@ #include <AK/RefCountForwarder.h> #include <LibGfx/Rect.h> #include <LibWeb/Bindings/Wrappable.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/Forward.h> +#include <LibWeb/HTML/Window.h> namespace Web::CSS { class Screen final - : public RefCountForwarder<DOM::Window> + : public RefCountForwarder<HTML::Window> , public Bindings::Wrappable { public: using WrapperType = Bindings::ScreenWrapper; 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)); } @@ -35,9 +35,9 @@ public: u32 pixel_depth() const { return 24; } 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; }; diff --git a/Userland/Libraries/LibWeb/DOM/AbortController.h b/Userland/Libraries/LibWeb/DOM/AbortController.h index 1e6119eb73..a084fbe044 100644 --- a/Userland/Libraries/LibWeb/DOM/AbortController.h +++ b/Userland/Libraries/LibWeb/DOM/AbortController.h @@ -11,8 +11,8 @@ #include <LibWeb/Bindings/WindowObject.h> #include <LibWeb/Bindings/Wrappable.h> #include <LibWeb/DOM/AbortSignal.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/Forward.h> +#include <LibWeb/HTML/Window.h> namespace Web::DOM { diff --git a/Userland/Libraries/LibWeb/DOM/AbortSignal.h b/Userland/Libraries/LibWeb/DOM/AbortSignal.h index 2f91984ff8..180270ee34 100644 --- a/Userland/Libraries/LibWeb/DOM/AbortSignal.h +++ b/Userland/Libraries/LibWeb/DOM/AbortSignal.h @@ -10,8 +10,8 @@ #include <AK/Weakable.h> #include <LibWeb/Bindings/Wrappable.h> #include <LibWeb/DOM/EventTarget.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/Forward.h> +#include <LibWeb/HTML/Window.h> namespace Web::DOM { diff --git a/Userland/Libraries/LibWeb/DOM/Comment.cpp b/Userland/Libraries/LibWeb/DOM/Comment.cpp index 77abdb9b16..293250d00c 100644 --- a/Userland/Libraries/LibWeb/DOM/Comment.cpp +++ b/Userland/Libraries/LibWeb/DOM/Comment.cpp @@ -5,7 +5,7 @@ */ #include <LibWeb/DOM/Comment.h> -#include <LibWeb/DOM/Window.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/Layout/TextNode.h> namespace Web::DOM { diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 57fce26fb2..af4be273d3 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -34,7 +34,6 @@ #include <LibWeb/DOM/Range.h> #include <LibWeb/DOM/ShadowRoot.h> #include <LibWeb/DOM/Text.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/Dump.h> #include <LibWeb/HTML/AttributeNames.h> #include <LibWeb/HTML/BrowsingContext.h> @@ -56,6 +55,7 @@ #include <LibWeb/HTML/Parser/HTMLParser.h> #include <LibWeb/HTML/Scripting/ExceptionReporter.h> #include <LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/Layout/BlockFormattingContext.h> #include <LibWeb/Layout/InitialContainingBlock.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_sheets(CSS::StyleSheetList::create(*this)) , m_url(url) - , m_window(Window::create_with_document(*this)) + , m_window(HTML::Window::create_with_document(*this)) , m_implementation(DOMImplementation::create({}, *this)) , m_history(HTML::History::create(*this)) { diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index 3d45e33f0f..6da28d8a62 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -242,7 +242,7 @@ public: void removed_last_ref(); - Window& window() { return *m_window; } + HTML::Window& window() { return *m_window; } ExceptionOr<void> write(Vector<String> const& strings); ExceptionOr<void> writeln(Vector<String> const& strings); @@ -250,7 +250,7 @@ public: ExceptionOr<Document*> open(String const& = "", String const& = ""); 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; } void set_content_type(const String& content_type) { m_content_type = content_type; } @@ -360,7 +360,7 @@ private: WeakPtr<HTML::BrowsingContext> m_browsing_context; AK::URL m_url; - RefPtr<Window> m_window; + RefPtr<HTML::Window> m_window; RefPtr<Layout::InitialContainingBlock> m_layout_root; diff --git a/Userland/Libraries/LibWeb/DOM/Document.idl b/Userland/Libraries/LibWeb/DOM/Document.idl index 03aff632ea..50b1baceef 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.idl +++ b/Userland/Libraries/LibWeb/DOM/Document.idl @@ -33,7 +33,7 @@ interface Document : Node { readonly attribute Window? defaultView; [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); [CEReactions] undefined close(); [CEReactions] undefined write(DOMString... text); diff --git a/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp b/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp index a9ac6833f2..26c4075e8b 100644 --- a/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp +++ b/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp @@ -5,7 +5,7 @@ */ #include <LibWeb/DOM/DocumentFragment.h> -#include <LibWeb/DOM/Window.h> +#include <LibWeb/HTML/Window.h> namespace Web::DOM { diff --git a/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp b/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp index b037ac79d6..208920cdee 100644 --- a/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp +++ b/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp @@ -22,9 +22,9 @@ #include <LibWeb/DOM/IDLEventListener.h> #include <LibWeb/DOM/Node.h> #include <LibWeb/DOM/ShadowRoot.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/EventNames.h> #include <LibWeb/HTML/Scripting/ExceptionReporter.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/UIEvents/MouseEvent.h> namespace Web::DOM { @@ -190,7 +190,7 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr< target_override = target; } else { // 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; @@ -229,7 +229,7 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr< 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)))) { if (is_activation_event && event->bubbles() && !activation_target && parent->activation_behavior) activation_target = parent; diff --git a/Userland/Libraries/LibWeb/DOM/EventTarget.cpp b/Userland/Libraries/LibWeb/DOM/EventTarget.cpp index 8ba9dc6ecc..77419de0c5 100644 --- a/Userland/Libraries/LibWeb/DOM/EventTarget.cpp +++ b/Userland/Libraries/LibWeb/DOM/EventTarget.cpp @@ -25,7 +25,6 @@ #include <LibWeb/DOM/EventDispatcher.h> #include <LibWeb/DOM/EventTarget.h> #include <LibWeb/DOM/IDLEventListener.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/ErrorEvent.h> #include <LibWeb/HTML/EventHandler.h> #include <LibWeb/HTML/EventNames.h> @@ -33,6 +32,7 @@ #include <LibWeb/HTML/HTMLBodyElement.h> #include <LibWeb/HTML/HTMLFormElement.h> #include <LibWeb/HTML/HTMLFrameSetElement.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/UIEvents/EventNames.h> namespace Web::DOM { @@ -315,8 +315,8 @@ Bindings::CallbackType* EventTarget::get_current_value_of_event_handler(FlyStrin element = element_event_target; document = element_event_target->document(); } else { - VERIFY(is<Window>(this)); - auto* window_event_target = verify_cast<Window>(this); + VERIFY(is<HTML::Window>(this)); + auto* window_event_target = verify_cast<HTML::Window>(this); document = window_event_target->associated_document(); } @@ -346,7 +346,7 @@ Bindings::CallbackType* EventTarget::get_current_value_of_event_handler(FlyStrin StringBuilder builder; // 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 // 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); @@ -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. // 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 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. JS::GlobalObject* global_object = nullptr; if (is_attribute == IsAttribute::Yes) { - if (is<Window>(this)) { - auto* window_global_object = verify_cast<Window>(this)->wrapper(); + if (is<HTML::Window>(this)) { + auto* window_global_object = verify_cast<HTML::Window>(this)->wrapper(); global_object = static_cast<JS::GlobalObject*>(window_global_object); } else { 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. // Otherwise, let special error event handling be false. // 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: JS::Completion return_value_or_error; diff --git a/Userland/Libraries/LibWeb/DOM/Range.cpp b/Userland/Libraries/LibWeb/DOM/Range.cpp index 6c95a982e5..9daf788987 100644 --- a/Userland/Libraries/LibWeb/DOM/Range.cpp +++ b/Userland/Libraries/LibWeb/DOM/Range.cpp @@ -9,11 +9,11 @@ #include <LibWeb/DOM/DocumentType.h> #include <LibWeb/DOM/Node.h> #include <LibWeb/DOM/Range.h> -#include <LibWeb/DOM/Window.h> +#include <LibWeb/HTML/Window.h> namespace Web::DOM { -NonnullRefPtr<Range> Range::create(Window& window) +NonnullRefPtr<Range> Range::create(HTML::Window& window) { return Range::create(window.associated_document()); } diff --git a/Userland/Libraries/LibWeb/DOM/Range.h b/Userland/Libraries/LibWeb/DOM/Range.h index f7d73b1a85..1c84c0b34a 100644 --- a/Userland/Libraries/LibWeb/DOM/Range.h +++ b/Userland/Libraries/LibWeb/DOM/Range.h @@ -18,7 +18,7 @@ public: virtual ~Range() override; 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_with_global_object(Bindings::WindowObject&); diff --git a/Userland/Libraries/LibWeb/DOM/Text.cpp b/Userland/Libraries/LibWeb/DOM/Text.cpp index 9f50e29fd8..22df127689 100644 --- a/Userland/Libraries/LibWeb/DOM/Text.cpp +++ b/Userland/Libraries/LibWeb/DOM/Text.cpp @@ -5,8 +5,8 @@ */ #include <LibWeb/DOM/Text.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/HTMLInputElement.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/Layout/TextNode.h> namespace Web::DOM { diff --git a/Userland/Libraries/LibWeb/DOM/Timer.cpp b/Userland/Libraries/LibWeb/DOM/Timer.cpp index 262051e854..e99a96de06 100644 --- a/Userland/Libraries/LibWeb/DOM/Timer.cpp +++ b/Userland/Libraries/LibWeb/DOM/Timer.cpp @@ -6,16 +6,16 @@ #include <LibCore/Timer.h> #include <LibWeb/DOM/Timer.h> -#include <LibWeb/DOM/Window.h> +#include <LibWeb/HTML/Window.h> 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)); } -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_id(id) { diff --git a/Userland/Libraries/LibWeb/DOM/Timer.h b/Userland/Libraries/LibWeb/DOM/Timer.h index de40b93675..a9fb3a0970 100644 --- a/Userland/Libraries/LibWeb/DOM/Timer.h +++ b/Userland/Libraries/LibWeb/DOM/Timer.h @@ -15,16 +15,16 @@ namespace Web::DOM { class Timer final : public RefCounted<Timer> { 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(); void start(); 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; - Window& m_window; + HTML::Window& m_window; i32 m_id { 0 }; }; diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h index b6411825f6..245a331602 100644 --- a/Userland/Libraries/LibWeb/Forward.h +++ b/Userland/Libraries/LibWeb/Forward.h @@ -120,7 +120,6 @@ class StaticNodeList; class StaticRange; class Text; class Timer; -class Window; enum class QuirksMode; struct EventListenerOptions; struct AddEventListenerOptions; @@ -235,6 +234,7 @@ class WorkerDebugConsoleClient; class Storage; class SubmitEvent; class TextMetrics; +class Window; class WindowEnvironmentSettingsObject; class Worker; class WorkerEnvironmentSettingsObject; diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp index 1d0ca9d25f..7f6374f4be 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp @@ -6,12 +6,12 @@ #include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/HTMLCollection.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/BrowsingContextContainer.h> #include <LibWeb/HTML/EventLoop/EventLoop.h> #include <LibWeb/HTML/HTMLAnchorElement.h> #include <LibWeb/HTML/HTMLInputElement.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/Layout/BreakNode.h> #include <LibWeb/Layout/InitialContainingBlock.h> #include <LibWeb/Layout/TextNode.h> diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp index 248642db0f..f9247d4dc6 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp +++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp @@ -13,12 +13,12 @@ #include <LibWeb/Bindings/CanvasRenderingContext2DWrapper.h> #include <LibWeb/Bindings/WindowObject.h> #include <LibWeb/DOM/ExceptionOr.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/CanvasRenderingContext2D.h> #include <LibWeb/HTML/HTMLCanvasElement.h> #include <LibWeb/HTML/HTMLImageElement.h> #include <LibWeb/HTML/ImageData.h> #include <LibWeb/HTML/TextMetrics.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/Layout/TextNode.h> namespace Web::HTML { diff --git a/Userland/Libraries/LibWeb/HTML/CloseEvent.h b/Userland/Libraries/LibWeb/HTML/CloseEvent.h index 3b7c56f2f7..cff27b926c 100644 --- a/Userland/Libraries/LibWeb/HTML/CloseEvent.h +++ b/Userland/Libraries/LibWeb/HTML/CloseEvent.h @@ -37,7 +37,7 @@ public: protected: 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_code(event_init.code) , m_reason(event_init.reason) diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp index 259e7b4240..8eba3d3ddf 100644 --- a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp +++ b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp @@ -9,10 +9,10 @@ #include <LibJS/Runtime/VM.h> #include <LibWeb/Bindings/MainThreadVM.h> #include <LibWeb/DOM/Document.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/EventLoop/EventLoop.h> #include <LibWeb/HTML/Scripting/Environments.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/HighResolutionTime/Performance.h> namespace Web::HTML { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp index 4110f9a895..b521f104a3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp @@ -7,8 +7,8 @@ #include <LibWeb/CSS/StyleProperties.h> #include <LibWeb/CSS/StyleValue.h> #include <LibWeb/DOM/Document.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/HTMLBodyElement.h> +#include <LibWeb/HTML/Window.h> namespace Web::HTML { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp index b116fd20c9..ff09b7798b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -11,13 +11,13 @@ #include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/ExceptionOr.h> #include <LibWeb/DOM/IDLEventListener.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/BrowsingContextContainer.h> #include <LibWeb/HTML/EventHandler.h> #include <LibWeb/HTML/HTMLAnchorElement.h> #include <LibWeb/HTML/HTMLBodyElement.h> #include <LibWeb/HTML/HTMLElement.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/Layout/Box.h> #include <LibWeb/Layout/BreakNode.h> #include <LibWeb/Layout/TextNode.h> diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.h b/Userland/Libraries/LibWeb/HTML/HTMLElement.h index 1674a906c0..6e6239c56e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.h @@ -54,7 +54,7 @@ protected: private: // ^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 { True, diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp index 1381ff7e12..d900113a1d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp @@ -11,10 +11,10 @@ #include <LibWeb/DOM/Event.h> #include <LibWeb/DOM/ShadowRoot.h> #include <LibWeb/DOM/Text.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/EventNames.h> #include <LibWeb/HTML/HTMLScriptElement.h> #include <LibWeb/HTML/Scripting/ClassicScript.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/Loader/ResourceLoader.h> namespace Web::HTML { diff --git a/Userland/Libraries/LibWeb/HTML/MessageChannel.h b/Userland/Libraries/LibWeb/HTML/MessageChannel.h index a61851d21c..1d212db933 100644 --- a/Userland/Libraries/LibWeb/HTML/MessageChannel.h +++ b/Userland/Libraries/LibWeb/HTML/MessageChannel.h @@ -9,8 +9,8 @@ #include <AK/RefCounted.h> #include <LibWeb/Bindings/Wrappable.h> #include <LibWeb/DOM/EventTarget.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/Forward.h> +#include <LibWeb/HTML/Window.h> namespace Web::HTML { diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp index 351059e361..091c252356 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp @@ -16,7 +16,6 @@ #include <LibWeb/DOM/Event.h> #include <LibWeb/DOM/ProcessingInstruction.h> #include <LibWeb/DOM/Text.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/EventLoop/EventLoop.h> #include <LibWeb/HTML/EventNames.h> #include <LibWeb/HTML/HTMLFormElement.h> @@ -27,6 +26,7 @@ #include <LibWeb/HTML/Parser/HTMLEncodingDetection.h> #include <LibWeb/HTML/Parser/HTMLParser.h> #include <LibWeb/HTML/Parser/HTMLToken.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/Namespace.h> #include <LibWeb/SVG/TagNames.h> @@ -276,7 +276,7 @@ void HTMLParser::the_end() return; // 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. diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp index df416ba44b..b804e08793 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp +++ b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp @@ -8,9 +8,9 @@ #include <LibWeb/Bindings/MainThreadVM.h> #include <LibWeb/Bindings/WindowObject.h> #include <LibWeb/DOM/Document.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/PromiseRejectionEvent.h> #include <LibWeb/HTML/Scripting/Environments.h> +#include <LibWeb/HTML/Window.h> namespace Web::HTML { diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp index 089aaed189..14a541e6bb 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp +++ b/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp @@ -10,7 +10,7 @@ namespace Web::HTML { -WindowEnvironmentSettingsObject::WindowEnvironmentSettingsObject(DOM::Window& window, JS::ExecutionContext& execution_context) +WindowEnvironmentSettingsObject::WindowEnvironmentSettingsObject(Window& window, JS::ExecutionContext& execution_context) : EnvironmentSettingsObject(execution_context) , m_window(window) { diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h b/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h index 8577f82e04..e891c4f2bf 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h +++ b/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h @@ -6,8 +6,8 @@ #pragma once -#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/Scripting/Environments.h> +#include <LibWeb/HTML/Window.h> namespace Web::HTML { @@ -24,9 +24,9 @@ public: virtual CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override; private: - WindowEnvironmentSettingsObject(DOM::Window&, JS::ExecutionContext& execution_context); + WindowEnvironmentSettingsObject(Window&, JS::ExecutionContext& execution_context); - NonnullRefPtr<DOM::Window> m_window; + NonnullRefPtr<Window> m_window; }; } diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/WorkerEnvironmentSettingsObject.h b/Userland/Libraries/LibWeb/HTML/Scripting/WorkerEnvironmentSettingsObject.h index f31c69bbf0..0dd1e32657 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/WorkerEnvironmentSettingsObject.h +++ b/Userland/Libraries/LibWeb/HTML/Scripting/WorkerEnvironmentSettingsObject.h @@ -13,7 +13,7 @@ namespace Web::HTML { // 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 : public EnvironmentSettingsObject , public Weakable<WorkerEnvironmentSettingsObject> { diff --git a/Userland/Libraries/LibWeb/DOM/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index bf181124f0..cb6dc64a50 100644 --- a/Userland/Libraries/LibWeb/DOM/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -16,7 +16,6 @@ #include <LibWeb/DOM/Event.h> #include <LibWeb/DOM/EventDispatcher.h> #include <LibWeb/DOM/Timer.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/EventLoop/EventLoop.h> #include <LibWeb/HTML/MessageEvent.h> @@ -24,12 +23,13 @@ #include <LibWeb/HTML/Scripting/ClassicScript.h> #include <LibWeb/HTML/Scripting/ExceptionReporter.h> #include <LibWeb/HTML/Storage.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/HighResolutionTime/Performance.h> #include <LibWeb/Layout/InitialContainingBlock.h> #include <LibWeb/Page/Page.h> #include <LibWeb/Selection/Selection.h> -namespace Web::DOM { +namespace Web::HTML { class RequestAnimationFrameCallback : public RefCounted<RequestAnimationFrameCallback> { public: @@ -107,13 +107,13 @@ void run_animation_frame_callbacks(DOM::Document&, double) 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)); } -Window::Window(Document& document) - : EventTarget() +Window::Window(DOM::Document& document) + : DOM::EventTarget() , m_associated_document(document) , m_performance(make<HighResolutionTime::Performance>(*this)) , m_crypto(Crypto::Crypto::create()) @@ -174,7 +174,7 @@ void Window::clear_interval(i32 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); } @@ -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. - 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); 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); } -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) diff --git a/Userland/Libraries/LibWeb/DOM/Window.h b/Userland/Libraries/LibWeb/HTML/Window.h index e8b57be84b..4a96829038 100644 --- a/Userland/Libraries/LibWeb/DOM/Window.h +++ b/Userland/Libraries/LibWeb/HTML/Window.h @@ -20,16 +20,16 @@ #include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/GlobalEventHandlers.h> -namespace Web::DOM { +namespace Web::HTML { class RequestAnimationFrameCallback; class Window final : public RefCounted<Window> - , public EventTarget + , public DOM::EventTarget , public HTML::GlobalEventHandlers { public: - static NonnullRefPtr<Window> create_with_document(Document&); + static NonnullRefPtr<Window> create_with_document(DOM::Document&); ~Window(); using RefCounted::ref; @@ -37,15 +37,15 @@ public: virtual void ref_event_target() override { RefCounted::ref(); } 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; Page* page(); Page const* page() const; // https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window - Document const& associated_document() const { return *m_associated_document; } - Document& associated_document() { return *m_associated_document; } + DOM::Document const& associated_document() const { return *m_associated_document; } + DOM::Document& associated_document() { return *m_associated_document; } // https://html.spec.whatwg.org/multipage/window-object.html#window-bc 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 deallocate_timer_id(Badge<Timer>, i32); + void deallocate_timer_id(Badge<DOM::Timer>, i32); HighResolutionTime::Performance& performance() { return *m_performance; } @@ -84,8 +84,8 @@ public: CSS::Screen& screen() { return *m_screen; } - Event const* current_event() const { return m_current_event; } - void set_current_event(Event* event) { m_current_event = event; } + DOM::Event const* current_event() const { return m_current_event; } + void set_current_event(DOM::Event* event) { m_current_event = event; } NonnullRefPtr<CSS::CSSStyleDeclaration> get_computed_style(DOM::Element&) const; NonnullRefPtr<CSS::MediaQueryList> match_media(String); @@ -110,7 +110,7 @@ public: DOM::ExceptionOr<void> post_message(JS::Value, String const& target_origin); private: - explicit Window(Document&); + explicit Window(DOM::Document&); // ^HTML::GlobalEventHandlers 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 = {}); // 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; IDAllocator m_timer_id_allocator; - HashMap<int, NonnullRefPtr<Timer>> m_timers; + HashMap<int, NonnullRefPtr<DOM::Timer>> m_timers; NonnullOwnPtr<HighResolutionTime::Performance> m_performance; NonnullRefPtr<Crypto::Crypto> m_crypto; 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; }; diff --git a/Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp b/Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp index 9b6863be21..6fac7a0042 100644 --- a/Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp +++ b/Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp @@ -8,12 +8,12 @@ #include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Event.h> #include <LibWeb/DOM/EventDispatcher.h> -#include <LibWeb/DOM/Window.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/HighResolutionTime/Performance.h> namespace Web::HighResolutionTime { -Performance::Performance(DOM::Window& window) +Performance::Performance(HTML::Window& window) : DOM::EventTarget() , m_window(window) , m_timing(make<NavigationTiming::PerformanceTiming>(window)) diff --git a/Userland/Libraries/LibWeb/HighResolutionTime/Performance.h b/Userland/Libraries/LibWeb/HighResolutionTime/Performance.h index 7891c43b85..15fd0fa0c2 100644 --- a/Userland/Libraries/LibWeb/HighResolutionTime/Performance.h +++ b/Userland/Libraries/LibWeb/HighResolutionTime/Performance.h @@ -21,7 +21,7 @@ public: using WrapperType = Bindings::PerformanceWrapper; using AllowOwnPtr = TrueType; - explicit Performance(DOM::Window&); + explicit Performance(HTML::Window&); ~Performance(); double now() const { return m_timer.elapsed(); } @@ -35,7 +35,7 @@ public: virtual JS::Object* create_wrapper(JS::GlobalObject&) override; private: - DOM::Window& m_window; + HTML::Window& m_window; Core::ElapsedTimer m_timer; OwnPtr<NavigationTiming::PerformanceTiming> m_timing; diff --git a/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.cpp b/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.cpp index 8c669b7eb5..1f39cb2bb5 100644 --- a/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.cpp +++ b/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.cpp @@ -8,7 +8,7 @@ namespace Web::NavigationTiming { -PerformanceTiming::PerformanceTiming(DOM::Window& window) +PerformanceTiming::PerformanceTiming(HTML::Window& window) : RefCountForwarder(window) { } diff --git a/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.h b/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.h index ae1b98e0da..1c9739b90a 100644 --- a/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.h +++ b/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.h @@ -9,18 +9,18 @@ #include <AK/RefCountForwarder.h> #include <AK/StdLibExtras.h> #include <LibWeb/Bindings/Wrappable.h> -#include <LibWeb/DOM/Window.h> +#include <LibWeb/HTML/Window.h> namespace Web::NavigationTiming { class PerformanceTiming final - : public RefCountForwarder<DOM::Window> + : public RefCountForwarder<HTML::Window> , public Bindings::Wrappable { public: using WrapperType = Bindings::PerformanceTimingWrapper; using AllowOwnPtr = TrueType; - explicit PerformanceTiming(DOM::Window&); + explicit PerformanceTiming(HTML::Window&); ~PerformanceTiming(); u32 navigation_start() { return 0; } diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.cpp b/Userland/Libraries/LibWeb/Page/EventHandler.cpp index e5c0f3abd4..f16e99934c 100644 --- a/Userland/Libraries/LibWeb/Page/EventHandler.cpp +++ b/Userland/Libraries/LibWeb/Page/EventHandler.cpp @@ -8,11 +8,11 @@ #include <LibGUI/Event.h> #include <LibWeb/DOM/Range.h> #include <LibWeb/DOM/Text.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/HTMLAnchorElement.h> #include <LibWeb/HTML/HTMLIFrameElement.h> #include <LibWeb/HTML/HTMLImageElement.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/Layout/InitialContainingBlock.h> #include <LibWeb/Page/EventHandler.h> #include <LibWeb/Page/Page.h> diff --git a/Userland/Libraries/LibWeb/UIEvents/UIEvent.h b/Userland/Libraries/LibWeb/UIEvents/UIEvent.h index d410922179..920ec3a7e3 100644 --- a/Userland/Libraries/LibWeb/UIEvents/UIEvent.h +++ b/Userland/Libraries/LibWeb/UIEvents/UIEvent.h @@ -8,12 +8,12 @@ #include <AK/RefPtr.h> #include <LibWeb/DOM/Event.h> -#include <LibWeb/DOM/Window.h> +#include <LibWeb/HTML/Window.h> namespace Web::UIEvents { struct UIEventInit : public DOM::EventInit { - RefPtr<DOM::Window> view { nullptr }; + RefPtr<HTML::Window> view { nullptr }; int detail { 0 }; }; @@ -33,10 +33,10 @@ public: 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; } - 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); m_view = view; @@ -55,7 +55,7 @@ protected: { } - RefPtr<DOM::Window> m_view; + RefPtr<HTML::Window> m_view; int m_detail { 0 }; }; diff --git a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp index 220a3e2ad8..5e048f6bcc 100644 --- a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp +++ b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp @@ -18,11 +18,11 @@ #include <LibWeb/DOM/EventDispatcher.h> #include <LibWeb/DOM/ExceptionOr.h> #include <LibWeb/DOM/IDLEventListener.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/HTML/CloseEvent.h> #include <LibWeb/HTML/EventHandler.h> #include <LibWeb/HTML/EventNames.h> #include <LibWeb/HTML/MessageEvent.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/Origin.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); } -WebSocket::WebSocket(DOM::Window& window, AK::URL& url) +WebSocket::WebSocket(HTML::Window& window, AK::URL& url) : EventTarget() , m_window(window) { diff --git a/Userland/Libraries/LibWeb/WebSockets/WebSocket.h b/Userland/Libraries/LibWeb/WebSockets/WebSocket.h index 93273f40c5..9e9f30bed0 100644 --- a/Userland/Libraries/LibWeb/WebSockets/WebSocket.h +++ b/Userland/Libraries/LibWeb/WebSockets/WebSocket.h @@ -59,7 +59,7 @@ public: 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)); } @@ -100,9 +100,9 @@ private: void on_error(); 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; String m_binary_type { "blob" }; diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index 5bea6158cb..1464752aea 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -22,10 +22,10 @@ #include <LibWeb/DOM/EventDispatcher.h> #include <LibWeb/DOM/ExceptionOr.h> #include <LibWeb/DOM/IDLEventListener.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/Fetch/AbstractOperations.h> #include <LibWeb/HTML/EventHandler.h> #include <LibWeb/HTML/EventNames.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/Loader/ResourceLoader.h> #include <LibWeb/Origin.h> #include <LibWeb/Page/Page.h> @@ -35,7 +35,7 @@ namespace Web::XHR { -XMLHttpRequest::XMLHttpRequest(DOM::Window& window) +XMLHttpRequest::XMLHttpRequest(HTML::Window& window) : XMLHttpRequestEventTarget() , m_window(window) , m_response_type(Bindings::XMLHttpRequestResponseType::Empty) diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h index 9431e39fe6..f1f95d474b 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h @@ -34,7 +34,7 @@ public: using WrapperType = Bindings::XMLHttpRequestWrapper; - static NonnullRefPtr<XMLHttpRequest> create(DOM::Window& window) + static NonnullRefPtr<XMLHttpRequest> create(HTML::Window& 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<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 }; unsigned m_status { 0 }; diff --git a/Userland/Services/WebContent/ConnectionFromClient.cpp b/Userland/Services/WebContent/ConnectionFromClient.cpp index d9a52631b1..ecdeecaa63 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.cpp +++ b/Userland/Services/WebContent/ConnectionFromClient.cpp @@ -17,11 +17,11 @@ #include <LibWeb/Bindings/MainThreadVM.h> #include <LibWeb/Cookie/ParsedCookie.h> #include <LibWeb/DOM/Document.h> -#include <LibWeb/DOM/Window.h> #include <LibWeb/Dump.h> #include <LibWeb/HTML/BrowsingContext.h> #include <LibWeb/HTML/Scripting/ClassicScript.h> #include <LibWeb/HTML/Storage.h> +#include <LibWeb/HTML/Window.h> #include <LibWeb/Layout/InitialContainingBlock.h> #include <LibWeb/Loader/ContentFilter.h> #include <LibWeb/Loader/ResourceLoader.h> diff --git a/Userland/Services/WebContent/ConsoleGlobalObject.cpp b/Userland/Services/WebContent/ConsoleGlobalObject.cpp index 89bab1984e..f371a780fc 100644 --- a/Userland/Services/WebContent/ConsoleGlobalObject.cpp +++ b/Userland/Services/WebContent/ConsoleGlobalObject.cpp @@ -10,7 +10,7 @@ #include <LibWeb/Bindings/NodeWrapperFactory.h> #include <LibWeb/Bindings/WindowObject.h> #include <LibWeb/DOM/Document.h> -#include <LibWeb/DOM/Window.h> +#include <LibWeb/HTML/Window.h> namespace WebContent { |