1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 17:08:12 +00:00
serenity/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.h
Andreas Kling 6f433c8656 LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocated
This is a monster patch that turns all EventTargets into GC-allocated
PlatformObjects. Their C++ wrapper classes are removed, and the LibJS
garbage collector is now responsible for their lifetimes.

There's a fair amount of hacks and band-aids in this patch, and we'll
have a lot of cleanup to do after this.
2022-09-06 00:27:09 +02:00

34 lines
848 B
C++

/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/NonnullRefPtr.h>
#include <AK/RefCounted.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/Forward.h>
namespace Web::ResizeObserver {
struct ResizeObserverOptions {
Bindings::ResizeObserverBoxOptions box;
};
// https://drafts.csswg.org/resize-observer/#resize-observer-interface
class ResizeObserver
: public RefCounted<ResizeObserver>
, public Bindings::Wrappable {
public:
using WrapperType = Bindings::ResizeObserverWrapper;
static NonnullRefPtr<ResizeObserver> create_with_global_object(HTML::Window&, Bindings::CallbackType* callback);
void observe(DOM::Element& target, ResizeObserverOptions);
void unobserve(DOM::Element& target);
void disconnect();
};
}