Serenity Operating System
at master 58 lines 1.7 kB view raw
1/* 2 * Copyright (c) 2021, Tim Flynn <trflynn89@serenityos.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <LibWeb/Bindings/Intrinsics.h> 8#include <LibWeb/DOM/Element.h> 9#include <LibWeb/IntersectionObserver/IntersectionObserver.h> 10 11namespace Web::IntersectionObserver { 12 13// https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-intersectionobserver 14WebIDL::ExceptionOr<JS::NonnullGCPtr<IntersectionObserver>> IntersectionObserver::construct_impl(JS::Realm& realm, WebIDL::CallbackType* callback, IntersectionObserverInit const& options) 15{ 16 // FIXME: Implement 17 (void)callback; 18 (void)options; 19 20 return MUST_OR_THROW_OOM(realm.heap().allocate<IntersectionObserver>(realm, realm)); 21} 22 23IntersectionObserver::IntersectionObserver(JS::Realm& realm) 24 : PlatformObject(realm) 25{ 26} 27 28IntersectionObserver::~IntersectionObserver() = default; 29 30JS::ThrowCompletionOr<void> IntersectionObserver::initialize(JS::Realm& realm) 31{ 32 MUST_OR_THROW_OOM(Base::initialize(realm)); 33 set_prototype(&Bindings::ensure_web_prototype<Bindings::IntersectionObserverPrototype>(realm, "IntersectionObserver")); 34 35 return {}; 36} 37 38// https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-observe 39void IntersectionObserver::observe(DOM::Element& target) 40{ 41 // FIXME: Implement 42 (void)target; 43} 44 45// https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-unobserve 46void IntersectionObserver::unobserve(DOM::Element& target) 47{ 48 // FIXME: Implement 49 (void)target; 50} 51 52// https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-disconnect 53void IntersectionObserver::disconnect() 54{ 55 // FIXME: Implement 56} 57 58}