IntersectionObserver.cpp 1.6 KB

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