2022-02-12 16:38:54 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, DerpyCrabs <derpycrabs@gmail.com>
|
2023-02-28 00:05:39 +00:00
|
|
|
* Copyright (c) 2023, Luke Wilde <lukew@serenityos.org>
|
2022-02-12 16:38:54 +03:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Vector.h>
|
2024-01-09 16:05:03 -07:00
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
2022-02-12 16:38:54 +03:00
|
|
|
#include <LibWeb/Geometry/DOMRect.h>
|
|
|
|
|
|
|
|
namespace Web::Geometry {
|
|
|
|
|
|
|
|
// https://drafts.fxtf.org/geometry-1/#DOMRectList
|
2024-01-09 16:05:03 -07:00
|
|
|
class DOMRectList final : public Bindings::PlatformObject {
|
|
|
|
WEB_PLATFORM_OBJECT(DOMRectList, Bindings::PlatformObject);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(DOMRectList);
|
2022-02-12 16:38:54 +03:00
|
|
|
|
|
|
|
public:
|
2024-11-15 04:01:23 +13:00
|
|
|
[[nodiscard]] static GC::Ref<DOMRectList> create(JS::Realm&, Vector<GC::Root<DOMRect>>);
|
2022-02-12 16:38:54 +03:00
|
|
|
|
2022-09-04 01:59:58 +02:00
|
|
|
virtual ~DOMRectList() override;
|
2022-02-12 16:38:54 +03:00
|
|
|
|
|
|
|
u32 length() const;
|
|
|
|
DOMRect const* item(u32 index) const;
|
|
|
|
|
2024-07-25 18:15:51 +12:00
|
|
|
virtual Optional<JS::Value> item_value(size_t index) const override;
|
2022-02-12 16:38:54 +03:00
|
|
|
|
|
|
|
private:
|
2024-11-15 04:01:23 +13:00
|
|
|
DOMRectList(JS::Realm&, Vector<GC::Ref<DOMRect>>);
|
2022-02-12 16:38:54 +03:00
|
|
|
|
2023-08-07 08:41:28 +02:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2024-01-01 16:31:00 +00:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
2023-01-10 06:56:59 -05:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
Vector<GC::Ref<DOMRect>> m_rects;
|
2022-02-12 16:38:54 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|