diff options
author | Andrew Kaster <akaster@serenityos.org> | 2022-09-25 18:11:21 -0600 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-10-01 21:05:32 +0100 |
commit | 4bb6345b2ff348bd604b17c7dd4e81e61d52b658 (patch) | |
tree | 0f6c0a111e022358921f6c8912972aae3975e32f /Userland/Libraries/LibWeb/IntersectionObserver | |
parent | 4878a18ee7ebe0c9d50880f804bd2dc22b1c751c (diff) | |
download | serenity-4bb6345b2ff348bd604b17c7dd4e81e61d52b658.zip |
LibWeb: Remove unecessary dependence on Window from assorted classes
These classes only needed Window to get at its realm. Pass a realm
directly to construct Crypto, Encoding, HRT, IntersectionObserver,
NavigationTiming, Page, RequestIdleCallback, Selection, Streams, URL,
and XML classes.
Diffstat (limited to 'Userland/Libraries/LibWeb/IntersectionObserver')
-rw-r--r-- | Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp index 9b6917880e..19b58562b2 100644 --- a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp +++ b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp @@ -4,26 +4,26 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include <LibWeb/Bindings/Intrinsics.h> #include <LibWeb/DOM/Element.h> -#include <LibWeb/HTML/Window.h> #include <LibWeb/IntersectionObserver/IntersectionObserver.h> namespace Web::IntersectionObserver { // https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-intersectionobserver -JS::NonnullGCPtr<IntersectionObserver> IntersectionObserver::create_with_global_object(HTML::Window& window, WebIDL::CallbackType* callback, IntersectionObserverInit const& options) +JS::NonnullGCPtr<IntersectionObserver> IntersectionObserver::construct_impl(JS::Realm& realm, WebIDL::CallbackType* callback, IntersectionObserverInit const& options) { // FIXME: Implement (void)callback; (void)options; - return *window.heap().allocate<IntersectionObserver>(window.realm(), window); + return *realm.heap().allocate<IntersectionObserver>(realm, realm); } -IntersectionObserver::IntersectionObserver(HTML::Window& window) - : PlatformObject(window.realm()) +IntersectionObserver::IntersectionObserver(JS::Realm& realm) + : PlatformObject(realm) { - set_prototype(&window.cached_web_prototype("IntersectionObserver")); + set_prototype(&Bindings::cached_web_prototype(realm, "IntersectionObserver")); } IntersectionObserver::~IntersectionObserver() = default; diff --git a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h index 266e885887..418cce0cc8 100644 --- a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h +++ b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h @@ -22,7 +22,7 @@ class IntersectionObserver : public Bindings::PlatformObject { WEB_PLATFORM_OBJECT(IntersectionObserver, Bindings::PlatformObject); public: - static JS::NonnullGCPtr<IntersectionObserver> create_with_global_object(HTML::Window&, WebIDL::CallbackType* callback, IntersectionObserverInit const& options = {}); + static JS::NonnullGCPtr<IntersectionObserver> construct_impl(JS::Realm&, WebIDL::CallbackType* callback, IntersectionObserverInit const& options = {}); virtual ~IntersectionObserver() override; @@ -31,7 +31,7 @@ public: void disconnect(); private: - explicit IntersectionObserver(HTML::Window&); + explicit IntersectionObserver(JS::Realm&); }; } |