1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 21:37:36 +00:00

LibWeb: Use WebIDL typedefs in Range/AbstractRange

In the public APIs which have their types exposed through IDL.
This commit is contained in:
Shannon Booth 2024-01-04 09:14:41 +13:00 committed by Andreas Kling
parent b6123df492
commit ee431e6911
4 changed files with 24 additions and 21 deletions

View file

@ -9,9 +9,11 @@
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/Forward.h>
#include <LibWeb/WebIDL/Types.h>
namespace Web::DOM {
// https://dom.spec.whatwg.org/#abstractrange
class AbstractRange : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(AbstractRange, Bindings::PlatformObject);
@ -20,11 +22,11 @@ public:
Node* start_container() { return m_start_container.ptr(); }
Node const* start_container() const { return m_start_container.ptr(); }
unsigned start_offset() const { return m_start_offset; }
WebIDL::UnsignedLong start_offset() const { return m_start_offset; }
Node* end_container() { return m_end_container.ptr(); }
Node const* end_container() const { return m_end_container.ptr(); }
unsigned end_offset() const { return m_end_offset; }
WebIDL::UnsignedLong end_offset() const { return m_end_offset; }
// https://dom.spec.whatwg.org/#range-collapsed
bool collapsed() const
@ -34,16 +36,16 @@ public:
}
protected:
AbstractRange(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset);
AbstractRange(Node& start_container, WebIDL::UnsignedLong start_offset, Node& end_container, WebIDL::UnsignedLong end_offset);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
JS::NonnullGCPtr<Node> m_start_container;
u32 m_start_offset;
WebIDL::UnsignedLong m_start_offset;
JS::NonnullGCPtr<Node> m_end_container;
u32 m_end_offset;
WebIDL::UnsignedLong m_end_offset;
};
}