/* * Copyright (c) 2024, Aliaksandr Kalenik * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include namespace Web::ResizeObserver { // https://drafts.csswg.org/resize-observer-1/#resize-observer-entry-interface class ResizeObserverEntry : public Bindings::PlatformObject { WEB_PLATFORM_OBJECT(ResizeObserverEntry, Bindings::PlatformObject); GC_DECLARE_ALLOCATOR(ResizeObserverEntry); public: static WebIDL::ExceptionOr> create_and_populate(JS::Realm&, DOM::Element& target); GC::Ref content_rect() const { return *m_content_rect; } GC::Ref target() const { return m_target; } Vector> const& border_box_size() const { return m_border_box_size; } Vector> const& content_box_size() const { return m_content_box_size; } Vector> const& device_pixel_content_box_size() const { return m_device_pixel_content_box_size; } GC::Ref border_box_size_js_array() const; GC::Ref content_box_size_js_array() const; GC::Ref device_pixel_content_box_size_js_array() const; private: explicit ResizeObserverEntry(JS::Realm& realm, DOM::Element& target) : PlatformObject(realm) , m_target(target) { } virtual void initialize(JS::Realm&) override; virtual void visit_edges(JS::Cell::Visitor&) override; GC::Ref m_target; Vector> m_content_box_size; Vector> m_border_box_size; Vector> m_device_pixel_content_box_size; GC::Ptr m_content_rect; }; }