From 02d5ed44cb8e834acfb4d80386f10eb441fd7d8a Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Fri, 19 Jan 2024 13:55:37 +0100 Subject: [PATCH] LibWeb: Stub Range::get_client_rects() Fixes "Application error: a client-side exception has occurred (see the browser console for more information)." on https://kotlinlang.org/ --- Userland/Libraries/LibWeb/DOM/Range.cpp | 8 ++++++++ Userland/Libraries/LibWeb/DOM/Range.h | 1 + Userland/Libraries/LibWeb/DOM/Range.idl | 1 + 3 files changed, 10 insertions(+) diff --git a/Userland/Libraries/LibWeb/DOM/Range.cpp b/Userland/Libraries/LibWeb/DOM/Range.cpp index 365dab2f0e..2bdce1eaa0 100644 --- a/Userland/Libraries/LibWeb/DOM/Range.cpp +++ b/Userland/Libraries/LibWeb/DOM/Range.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -1146,6 +1147,13 @@ WebIDL::ExceptionOr Range::delete_contents() return {}; } +// https://drafts.csswg.org/cssom-view/#dom-element-getclientrects +JS::NonnullGCPtr Range::get_client_rects() const +{ + dbgln("(STUBBED) Range::get_client_rects()"); + return Geometry::DOMRectList::create(realm(), {}); +} + // https://w3c.github.io/csswg-drafts/cssom-view/#dom-range-getboundingclientrect JS::NonnullGCPtr Range::get_bounding_client_rect() const { diff --git a/Userland/Libraries/LibWeb/DOM/Range.h b/Userland/Libraries/LibWeb/DOM/Range.h index 57f7a2cd83..239bfc246d 100644 --- a/Userland/Libraries/LibWeb/DOM/Range.h +++ b/Userland/Libraries/LibWeb/DOM/Range.h @@ -85,6 +85,7 @@ public: static HashTable& live_ranges(); + JS::NonnullGCPtr get_client_rects() const; JS::NonnullGCPtr get_bounding_client_rect() const; bool contains_node(Node const&) const; diff --git a/Userland/Libraries/LibWeb/DOM/Range.idl b/Userland/Libraries/LibWeb/DOM/Range.idl index 51f8eef3a5..3fef4da2e3 100644 --- a/Userland/Libraries/LibWeb/DOM/Range.idl +++ b/Userland/Libraries/LibWeb/DOM/Range.idl @@ -40,6 +40,7 @@ interface Range : AbstractRange { boolean intersectsNode(Node node); + DOMRectList getClientRects(); DOMRect getBoundingClientRect(); stringifier;