summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/DOM
diff options
context:
space:
mode:
authorAndrew Kaster <akaster@serenityos.org>2022-09-25 18:03:02 -0600
committerLinus Groh <mail@linusgroh.de>2022-10-01 21:05:32 +0100
commit62a8c26b73e874005c94969da9605fb9fd421b3c (patch)
treed50c0011291472bcbf849fef09f743e344a6b493 /Userland/Libraries/LibWeb/DOM
parentf0c5f77f99801441db1d8e99c14dae2ab1357b47 (diff)
downloadserenity-62a8c26b73e874005c94969da9605fb9fd421b3c.zip
LibWeb: Remove unecessary dependence on Window from Geometry classes
These classes only needed Window to get at its realm. Pass a realm directly to construct Geometry classes.
Diffstat (limited to 'Userland/Libraries/LibWeb/DOM')
-rw-r--r--Userland/Libraries/LibWeb/DOM/Element.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp
index df17923d9e..863d33d35d 100644
--- a/Userland/Libraries/LibWeb/DOM/Element.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Element.cpp
@@ -587,12 +587,12 @@ JS::NonnullGCPtr<Geometry::DOMRect> 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::create_with_global_object(window(), 0, 0, 0, 0);
+ return Geometry::DOMRect::construct_impl(realm(), 0, 0, 0, 0);
VERIFY(document().browsing_context());
auto viewport_offset = document().browsing_context()->viewport_scroll_offset();
- return Geometry::DOMRect::create(window(), paint_box->absolute_rect().translated(-viewport_offset.x(), -viewport_offset.y()));
+ return Geometry::DOMRect::create(realm(), paint_box->absolute_rect().translated(-viewport_offset.x(), -viewport_offset.y()));
}
// https://drafts.csswg.org/cssom-view/#dom-element-getclientrects
@@ -602,7 +602,7 @@ JS::NonnullGCPtr<Geometry::DOMRectList> Element::get_client_rects() const
// 1. If the element on which it was invoked does not have an associated layout box return an empty DOMRectList object and stop this algorithm.
if (!layout_node() || !layout_node()->is_box())
- return Geometry::DOMRectList::create(window(), move(rects));
+ return Geometry::DOMRectList::create(realm(), move(rects));
// FIXME: 2. If the element has an associated SVG layout box return a DOMRectList object containing a single DOMRect object that describes
// the bounding box of the element as defined by the SVG specification, applying the transforms that apply to the element and its ancestors.
@@ -616,7 +616,7 @@ JS::NonnullGCPtr<Geometry::DOMRectList> Element::get_client_rects() const
auto bounding_rect = get_bounding_client_rect();
rects.append(*bounding_rect);
- return Geometry::DOMRectList::create(window(), move(rects));
+ return Geometry::DOMRectList::create(realm(), move(rects));
}
int Element::client_top() const