2021-10-13 14:20:50 -04:00
|
|
|
/*
|
2022-01-31 13:07:22 -05:00
|
|
|
* Copyright (c) 2021, Tim Flynn <trflynn89@serenityos.org>
|
2021-10-13 14:20:50 -04:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
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.
2022-09-25 18:11:21 -06:00
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2021-10-13 14:20:50 -04:00
|
|
|
#include <LibWeb/DOM/Element.h>
|
|
|
|
#include <LibWeb/IntersectionObserver/IntersectionObserver.h>
|
|
|
|
|
|
|
|
namespace Web::IntersectionObserver {
|
|
|
|
|
|
|
|
// https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-intersectionobserver
|
2023-02-19 18:52:13 +01:00
|
|
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<IntersectionObserver>> IntersectionObserver::construct_impl(JS::Realm& realm, WebIDL::CallbackType* callback, IntersectionObserverInit const& options)
|
2021-10-13 14:20:50 -04:00
|
|
|
{
|
|
|
|
// FIXME: Implement
|
|
|
|
(void)callback;
|
|
|
|
(void)options;
|
|
|
|
|
2023-02-19 18:52:13 +01:00
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<IntersectionObserver>(realm, realm));
|
2021-10-13 14:20:50 -04: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.
2022-09-25 18:11:21 -06:00
|
|
|
IntersectionObserver::IntersectionObserver(JS::Realm& realm)
|
|
|
|
: PlatformObject(realm)
|
2022-09-04 14:14:22 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
IntersectionObserver::~IntersectionObserver() = default;
|
|
|
|
|
2023-01-28 12:33:35 -05:00
|
|
|
JS::ThrowCompletionOr<void> IntersectionObserver::initialize(JS::Realm& realm)
|
2023-01-10 06:28:20 -05:00
|
|
|
{
|
2023-01-28 12:33:35 -05:00
|
|
|
MUST_OR_THROW_OOM(Base::initialize(realm));
|
2023-01-10 06:28:20 -05:00
|
|
|
set_prototype(&Bindings::ensure_web_prototype<Bindings::IntersectionObserverPrototype>(realm, "IntersectionObserver"));
|
2023-01-28 12:33:35 -05:00
|
|
|
|
|
|
|
return {};
|
2023-01-10 06:28:20 -05:00
|
|
|
}
|
|
|
|
|
2021-10-13 14:20:50 -04:00
|
|
|
// https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-observe
|
|
|
|
void IntersectionObserver::observe(DOM::Element& target)
|
|
|
|
{
|
|
|
|
// FIXME: Implement
|
|
|
|
(void)target;
|
|
|
|
}
|
|
|
|
|
|
|
|
// https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-unobserve
|
|
|
|
void IntersectionObserver::unobserve(DOM::Element& target)
|
|
|
|
{
|
|
|
|
// FIXME: Implement
|
|
|
|
(void)target;
|
|
|
|
}
|
|
|
|
|
|
|
|
// https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-disconnect
|
|
|
|
void IntersectionObserver::disconnect()
|
|
|
|
{
|
|
|
|
// FIXME: Implement
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|