DOMRectList interface implementation (#34025)

* rechecking all file changes and additions

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* added comments with specification links

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* added space before the links

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* modified the doc link format

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* suggested changes + updated interfaces.https.html + updated passing test expectations

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* needed to do an update-manifest

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* updated the idlharness.any.html expectations

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

---------

Signed-off-by: L Ashwin B <lashwinib@gmail.com>
This commit is contained in:
chickenleaf 2024-11-01 21:28:30 +05:30 committed by GitHub
parent d2c4448ac8
commit 257f4b84db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 86 additions and 42 deletions

View file

@ -103,6 +103,7 @@ use crate::dom::document::{
};
use crate::dom::documentfragment::DocumentFragment;
use crate::dom::domrect::DOMRect;
use crate::dom::domrectlist::DOMRectList;
use crate::dom::domtokenlist::DOMTokenList;
use crate::dom::elementinternals::ElementInternals;
use crate::dom::eventtarget::EventTarget;
@ -2431,10 +2432,10 @@ impl ElementMethods for Element {
}
// https://drafts.csswg.org/cssom-view/#dom-element-getclientrects
fn GetClientRects(&self, can_gc: CanGc) -> Vec<DomRoot<DOMRect>> {
fn GetClientRects(&self, can_gc: CanGc) -> DomRoot<DOMRectList> {
let win = window_from_node(self);
let raw_rects = self.upcast::<Node>().content_boxes(can_gc);
raw_rects
let rects: Vec<DomRoot<DOMRect>> = raw_rects
.iter()
.map(|rect| {
DOMRect::new(
@ -2446,7 +2447,8 @@ impl ElementMethods for Element {
can_gc,
)
})
.collect()
.collect();
DOMRectList::new(&win, rects, can_gc)
}
// https://drafts.csswg.org/cssom-view/#dom-element-getboundingclientrect