mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:07:34 +00:00
LibWeb: Implement DOMRect(ReadOnly)#fromRect
This will also be used by IntersectionObserver.
This commit is contained in:
parent
1d426df262
commit
6f8afd8cd9
6 changed files with 35 additions and 0 deletions
|
@ -15,6 +15,13 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMRectReadOnly>> DOMRectReadOnly::construc
|
|||
return MUST_OR_THROW_OOM(realm.heap().allocate<DOMRectReadOnly>(realm, realm, x, y, width, height));
|
||||
}
|
||||
|
||||
// https://drafts.fxtf.org/geometry/#create-a-domrect-from-the-dictionary
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMRectReadOnly>> DOMRectReadOnly::from_rect(JS::VM& vm, Geometry::DOMRectInit const& other)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<DOMRectReadOnly>(realm, realm, other.x, other.y, other.width, other.height));
|
||||
}
|
||||
|
||||
DOMRectReadOnly::DOMRectReadOnly(JS::Realm& realm, double x, double y, double width, double height)
|
||||
: PlatformObject(realm)
|
||||
, m_rect(x, y, width, height)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue