1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

LibWeb: Stub Range.getBoundingClientRect

This seems to be used by Discord around the chat message box, but
didn't explore very far.
This commit is contained in:
Luke Wilde 2022-12-09 18:50:42 +00:00 committed by Linus Groh
parent 1e9cc2e211
commit 34c130b336
3 changed files with 13 additions and 0 deletions

View file

@ -15,6 +15,7 @@
#include <LibWeb/DOM/ProcessingInstruction.h>
#include <LibWeb/DOM/Range.h>
#include <LibWeb/DOM/Text.h>
#include <LibWeb/Geometry/DOMRect.h>
#include <LibWeb/HTML/Window.h>
namespace Web::DOM {
@ -1102,4 +1103,11 @@ WebIDL::ExceptionOr<void> Range::delete_contents()
return {};
}
// https://w3c.github.io/csswg-drafts/cssom-view/#dom-range-getboundingclientrect
JS::NonnullGCPtr<Geometry::DOMRect> Range::get_bounding_client_rect() const
{
dbgln("(STUBBED) Range::get_bounding_client_rect()");
return Geometry::DOMRect::construct_impl(realm(), 0, 0, 0, 0);
}
}

View file

@ -82,6 +82,8 @@ public:
static HashTable<Range*>& live_ranges();
JS::NonnullGCPtr<Geometry::DOMRect> get_bounding_client_rect() const;
private:
explicit Range(Document&);
Range(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset);

View file

@ -1,5 +1,6 @@
#import <DOM/Node.idl>
#import <DOM/AbstractRange.idl>
#import <Geometry/DOMRect.idl>
[Exposed=Window]
interface Range : AbstractRange {
@ -38,6 +39,8 @@ interface Range : AbstractRange {
boolean intersectsNode(Node node);
DOMRect getBoundingClientRect();
stringifier;
};