2021-10-11 00:18:07 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-09-04 13:33:07 +02:00
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
2021-10-11 00:18:07 +02:00
|
|
|
|
|
|
|
namespace Web::ResizeObserver {
|
|
|
|
|
|
|
|
struct ResizeObserverOptions {
|
2022-04-01 23:32:18 +03:00
|
|
|
Bindings::ResizeObserverBoxOptions box;
|
2021-10-11 00:18:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// https://drafts.csswg.org/resize-observer/#resize-observer-interface
|
2022-09-04 13:33:07 +02:00
|
|
|
class ResizeObserver : public Bindings::PlatformObject {
|
|
|
|
WEB_PLATFORM_OBJECT(ResizeObserver, Bindings::PlatformObject);
|
2023-11-19 19:47:52 +01:00
|
|
|
JS_DECLARE_ALLOCATOR(ResizeObserver);
|
2022-09-04 13:33:07 +02:00
|
|
|
|
2021-10-11 00:18:07 +02:00
|
|
|
public:
|
2023-02-19 18:45:52 +01:00
|
|
|
static WebIDL::ExceptionOr<JS::NonnullGCPtr<ResizeObserver>> construct_impl(JS::Realm&, WebIDL::CallbackType* callback);
|
2021-10-11 00:18:07 +02:00
|
|
|
|
2022-09-04 13:33:07 +02:00
|
|
|
virtual ~ResizeObserver() override;
|
2021-10-11 00:18:07 +02:00
|
|
|
|
|
|
|
void observe(DOM::Element& target, ResizeObserverOptions);
|
|
|
|
void unobserve(DOM::Element& target);
|
|
|
|
void disconnect();
|
2022-09-04 13:33:07 +02:00
|
|
|
|
|
|
|
private:
|
LibWeb: Remove unecessary dependence on Window from assorted classes
These classes only needed Window to get at its realm. Pass a realm
directly to construct Crypto, Encoding, HRT, IntersectionObserver,
NavigationTiming, Page, RequestIdleCallback, Selection, Streams, URL,
and XML classes.
2022-09-25 18:11:21 -06:00
|
|
|
explicit ResizeObserver(JS::Realm&);
|
2023-01-10 06:28:20 -05:00
|
|
|
|
2023-08-07 08:41:28 +02:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2021-10-11 00:18:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|