1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:57:45 +00:00

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.
This commit is contained in:
Andrew Kaster 2022-09-25 18:11:21 -06:00 committed by Linus Groh
parent 4878a18ee7
commit 4bb6345b2f
30 changed files with 125 additions and 126 deletions

View file

@ -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;