summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.h
blob: 409fe9be9db51ad220c30ec53880cb1aae28050f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * 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(JS::GlobalObject&, Bindings::CallbackType const& callback);

    void observe(DOM::Element& target, ResizeObserverOptions);
    void unobserve(DOM::Element& target);
    void disconnect();
};

}