add CanGc as argument to methods in HTMLCollection, HTMLDataListElement, HTMLDialogElement, HTMLElement, HTMLFieldSetElement, HTMLFormControlsCollection, HTMLFormElement, HTMLIFrameElement (#36495)

add CanGc as argument to methods in HTMLCollection, HTMLDataListElement,
HTMLDialogElement, HTMLElement, HTMLFieldSetElement,
HTMLFormControlsCollection, HTMLFormElement, HTMLIFrameElement

Testing: These changes do not require tests because they are a refactor.
Addresses part of https://github.com/servo/servo/issues/34573.

Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
This commit is contained in:
Yerkebulan Tulibergenov 2025-04-13 00:10:00 -07:00 committed by GitHub
parent 06f86f88a2
commit 3babf74986
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 69 additions and 60 deletions

View file

@ -1746,7 +1746,7 @@ impl VirtualMethods for HTMLImageElement {
fn adopting_steps(&self, old_doc: &Document, can_gc: CanGc) {
self.super_type().unwrap().adopting_steps(old_doc, can_gc);
self.update_the_image_data(CanGc::note());
self.update_the_image_data(can_gc);
}
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation, can_gc: CanGc) {
@ -1759,7 +1759,7 @@ impl VirtualMethods for HTMLImageElement {
&local_name!("width") |
&local_name!("crossorigin") |
&local_name!("sizes") |
&local_name!("referrerpolicy") => self.update_the_image_data(CanGc::note()),
&local_name!("referrerpolicy") => self.update_the_image_data(can_gc),
_ => {},
}
}
@ -1777,7 +1777,7 @@ impl VirtualMethods for HTMLImageElement {
}
}
fn handle_event(&self, event: &Event, _can_gc: CanGc) {
fn handle_event(&self, event: &Event, can_gc: CanGc) {
if event.type_() != atom!("click") {
return;
}
@ -1798,9 +1798,7 @@ impl VirtualMethods for HTMLImageElement {
mouse_event.ClientX().to_f32().unwrap(),
mouse_event.ClientY().to_f32().unwrap(),
);
let bcr = self
.upcast::<Element>()
.GetBoundingClientRect(CanGc::note());
let bcr = self.upcast::<Element>().GetBoundingClientRect(can_gc);
let bcr_p = Point2D::new(bcr.X() as f32, bcr.Y() as f32);
// Walk HTMLAreaElements
@ -1811,7 +1809,7 @@ impl VirtualMethods for HTMLImageElement {
None => return,
};
if shp.hit_test(&point) {
element.activation_behavior(event, self.upcast(), CanGc::note());
element.activation_behavior(event, self.upcast(), can_gc);
return;
}
}
@ -1830,7 +1828,7 @@ impl VirtualMethods for HTMLImageElement {
// https://html.spec.whatwg.org/multipage/#relevant-mutations
if let Some(parent) = self.upcast::<Node>().GetParentElement() {
if parent.is::<HTMLPictureElement>() {
self.update_the_image_data(CanGc::note());
self.update_the_image_data(can_gc);
}
}
}
@ -1843,7 +1841,7 @@ impl VirtualMethods for HTMLImageElement {
// The element is removed from a picture parent element
// https://html.spec.whatwg.org/multipage/#relevant-mutations
if context.parent.is::<HTMLPictureElement>() {
self.update_the_image_data(CanGc::note());
self.update_the_image_data(can_gc);
}
}
}