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>
|
2022-09-04 01:59:58 +02:00
|
|
|
#include <LibWeb/Bindings/LegacyPlatformObject.h>
|
2022-02-12 16:38:54 +03:00
|
|
|
#include <LibWeb/Geometry/DOMRect.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::Geometry {
|
|
|
|
|
|
|
|
|
|
// https://drafts.fxtf.org/geometry-1/#DOMRectList
|
2022-09-04 01:59:58 +02:00
|
|
|
class DOMRectList final : public Bindings::LegacyPlatformObject {
|
|
|
|
|
WEB_PLATFORM_OBJECT(DOMRectList, Bindings::LegacyPlatformObject);
|
2023-11-19 19:47:52 +01:00
|
|
|
JS_DECLARE_ALLOCATOR(DOMRectList);
|
2022-02-12 16:38:54 +03:00
|
|
|
|
|
|
|
|
public:
|
2023-08-13 13:05:26 +02:00
|
|
|
[[nodiscard]] static JS::NonnullGCPtr<DOMRectList> create(JS::Realm&, Vector<JS::Handle<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;
|
|
|
|
|
|
2022-09-04 01:59:58 +02:00
|
|
|
virtual bool is_supported_property_index(u32) const override;
|
2023-02-28 00:05:39 +00:00
|
|
|
virtual WebIDL::ExceptionOr<JS::Value> item_value(size_t index) const override;
|
2022-02-12 16:38:54 +03:00
|
|
|
|
|
|
|
|
private:
|
2022-09-25 18:03:02 -06:00
|
|
|
DOMRectList(JS::Realm&, Vector<JS::NonnullGCPtr<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
|
|
|
|
2023-02-28 00:05:39 +00:00
|
|
|
// ^Bindings::LegacyPlatformObject
|
|
|
|
|
virtual bool supports_indexed_properties() const override { return true; }
|
|
|
|
|
virtual bool supports_named_properties() const override { return false; }
|
|
|
|
|
virtual bool has_indexed_property_setter() const override { return false; }
|
|
|
|
|
virtual bool has_named_property_setter() const override { return false; }
|
|
|
|
|
virtual bool has_named_property_deleter() const override { return false; }
|
|
|
|
|
virtual bool has_legacy_override_built_ins_interface_extended_attribute() const override { return false; }
|
|
|
|
|
virtual bool has_legacy_unenumerable_named_properties_interface_extended_attribute() const override { return false; }
|
|
|
|
|
virtual bool has_global_interface_extended_attribute() const override { return false; }
|
|
|
|
|
virtual bool indexed_property_setter_has_identifier() const override { return false; }
|
|
|
|
|
virtual bool named_property_setter_has_identifier() const override { return false; }
|
|
|
|
|
virtual bool named_property_deleter_has_identifier() const override { return false; }
|
|
|
|
|
|
2022-09-04 01:59:58 +02:00
|
|
|
Vector<JS::NonnullGCPtr<DOMRect>> m_rects;
|
2022-02-12 16:38:54 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|