mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:47:35 +00:00
LibWeb: Make IntersectionObserver GC-allocated
This commit is contained in:
parent
fe9c5395d4
commit
25daa14a05
4 changed files with 24 additions and 14 deletions
|
@ -6,10 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <LibJS/Heap/Handle.h>
|
||||
#include <LibWeb/Bindings/Wrappable.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
|
||||
namespace Web::IntersectionObserver {
|
||||
|
||||
|
@ -20,17 +17,22 @@ struct IntersectionObserverInit {
|
|||
};
|
||||
|
||||
// https://w3c.github.io/IntersectionObserver/#intersection-observer-interface
|
||||
class IntersectionObserver
|
||||
: public RefCounted<IntersectionObserver>
|
||||
, public Bindings::Wrappable {
|
||||
public:
|
||||
using WrapperType = Bindings::IntersectionObserverWrapper;
|
||||
class IntersectionObserver : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(IntersectionObserver, Bindings::PlatformObject);
|
||||
|
||||
static NonnullRefPtr<IntersectionObserver> create_with_global_object(HTML::Window&, Bindings::CallbackType* callback, IntersectionObserverInit const& options = {});
|
||||
public:
|
||||
static JS::NonnullGCPtr<IntersectionObserver> create_with_global_object(HTML::Window&, Bindings::CallbackType* callback, IntersectionObserverInit const& options = {});
|
||||
|
||||
virtual ~IntersectionObserver() override;
|
||||
|
||||
void observe(DOM::Element& target);
|
||||
void unobserve(DOM::Element& target);
|
||||
void disconnect();
|
||||
|
||||
private:
|
||||
explicit IntersectionObserver(HTML::Window&);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(IntersectionObserver, Web::IntersectionObserver)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue