1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:47:34 +00:00

LibWeb: Implement DOMRect(ReadOnly)#fromRect

This will also be used by IntersectionObserver.
This commit is contained in:
Luke Wilde 2023-07-06 23:21:20 +01:00 committed by Andreas Kling
parent 1d426df262
commit 6f8afd8cd9
6 changed files with 35 additions and 0 deletions

View file

@ -12,12 +12,21 @@
namespace Web::Geometry {
// https://drafts.fxtf.org/geometry/#dictdef-domrectinit
struct DOMRectInit {
double x { 0.0 };
double y { 0.0 };
double width { 0.0 };
double height { 0.0 };
};
// https://drafts.fxtf.org/geometry/#domrectreadonly
class DOMRectReadOnly : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(DOMRectReadOnly, Bindings::PlatformObject);
public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMRectReadOnly>> construct_impl(JS::Realm&, double x = 0, double y = 0, double width = 0, double height = 0);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMRectReadOnly>> from_rect(JS::VM&, DOMRectInit const&);
virtual ~DOMRectReadOnly() override;