diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index fc6f32f160..2a6264b103 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -657,12 +657,12 @@ JS::NonnullGCPtr Element::get_bounding_client_rect() const // FIXME: Support inline layout nodes as well. auto* paint_box = this->paint_box(); if (!paint_box) - return Geometry::DOMRect::construct_impl(realm(), 0, 0, 0, 0); + return Geometry::DOMRect::construct_impl(realm(), 0, 0, 0, 0).release_value_but_fixme_should_propagate_errors(); VERIFY(document().browsing_context()); auto viewport_offset = document().browsing_context()->viewport_scroll_offset(); - return Geometry::DOMRect::create(realm(), paint_box->absolute_rect().translated(-viewport_offset.x(), -viewport_offset.y()).to_type()); + return Geometry::DOMRect::create(realm(), paint_box->absolute_rect().translated(-viewport_offset.x(), -viewport_offset.y()).to_type()).release_value_but_fixme_should_propagate_errors(); } // https://drafts.csswg.org/cssom-view/#dom-element-getclientrects diff --git a/Userland/Libraries/LibWeb/DOM/Range.cpp b/Userland/Libraries/LibWeb/DOM/Range.cpp index 4f2a6e35ac..f46f31e153 100644 --- a/Userland/Libraries/LibWeb/DOM/Range.cpp +++ b/Userland/Libraries/LibWeb/DOM/Range.cpp @@ -1139,7 +1139,7 @@ WebIDL::ExceptionOr Range::delete_contents() JS::NonnullGCPtr Range::get_bounding_client_rect() const { dbgln("(STUBBED) Range::get_bounding_client_rect()"); - return Geometry::DOMRect::construct_impl(realm(), 0, 0, 0, 0); + return Geometry::DOMRect::construct_impl(realm(), 0, 0, 0, 0).release_value_but_fixme_should_propagate_errors(); } } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp b/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp index a85a2beab3..db39cda450 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp @@ -6,15 +6,16 @@ #include #include +#include namespace Web::Geometry { -JS::NonnullGCPtr DOMRect::construct_impl(JS::Realm& realm, double x, double y, double width, double height) +WebIDL::ExceptionOr> DOMRect::construct_impl(JS::Realm& realm, double x, double y, double width, double height) { - return realm.heap().allocate(realm, realm, x, y, width, height).release_allocated_value_but_fixme_should_propagate_errors(); + return MUST_OR_THROW_OOM(realm.heap().allocate(realm, realm, x, y, width, height)); } -JS::NonnullGCPtr DOMRect::create(JS::Realm& realm, Gfx::FloatRect const& rect) +WebIDL::ExceptionOr> DOMRect::create(JS::Realm& realm, Gfx::FloatRect const& rect) { return construct_impl(realm, rect.x(), rect.y(), rect.width(), rect.height()); } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRect.h b/Userland/Libraries/LibWeb/Geometry/DOMRect.h index 0eb93c1d54..407b21b940 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMRect.h +++ b/Userland/Libraries/LibWeb/Geometry/DOMRect.h @@ -15,8 +15,8 @@ class DOMRect final : public DOMRectReadOnly { WEB_PLATFORM_OBJECT(DOMRect, DOMRectReadOnly); public: - static JS::NonnullGCPtr construct_impl(JS::Realm&, double x = 0, double y = 0, double width = 0, double height = 0); - static JS::NonnullGCPtr create(JS::Realm&, Gfx::FloatRect const&); + static WebIDL::ExceptionOr> construct_impl(JS::Realm&, double x = 0, double y = 0, double width = 0, double height = 0); + static WebIDL::ExceptionOr> create(JS::Realm&, Gfx::FloatRect const&); virtual ~DOMRect() override;