script: Pass &mut JSContext to attribute_mutated (#43383)

It pushes the `temp_cx` 1 level up to `element.rs` where the calling
chain begins. Other than that this was purely a mechanical change where
I used regexes to replace all patterns with the new ones.

Part of #42812

Testing: It compiles

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
Tim van der Lippe
2026-03-18 12:03:54 +01:00
committed by GitHub
parent d3ca63c514
commit 479a9b6be3
38 changed files with 321 additions and 159 deletions

View File

@@ -726,15 +726,23 @@ impl VirtualMethods for HTMLSelectElement {
Some(self.upcast::<HTMLElement>() as &dyn VirtualMethods)
}
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation, can_gc: CanGc) {
fn attribute_mutated(
&self,
cx: &mut js::context::JSContext,
attr: &Attr,
mutation: AttributeMutation,
) {
let could_have_had_embedder_control = self.may_have_embedder_control();
self.super_type()
.unwrap()
.attribute_mutated(attr, mutation, can_gc);
.attribute_mutated(cx, attr, mutation);
match *attr.local_name() {
local_name!("required") => {
self.validity_state(can_gc)
.perform_validation_and_update(ValidationFlags::VALUE_MISSING, can_gc);
self.validity_state(CanGc::from_cx(cx))
.perform_validation_and_update(
ValidationFlags::VALUE_MISSING,
CanGc::from_cx(cx),
);
},
local_name!("disabled") => {
let el = self.upcast::<Element>();
@@ -750,11 +758,14 @@ impl VirtualMethods for HTMLSelectElement {
},
}
self.validity_state(can_gc)
.perform_validation_and_update(ValidationFlags::VALUE_MISSING, can_gc);
self.validity_state(CanGc::from_cx(cx))
.perform_validation_and_update(
ValidationFlags::VALUE_MISSING,
CanGc::from_cx(cx),
);
},
local_name!("form") => {
self.form_attribute_mutated(mutation, can_gc);
self.form_attribute_mutated(mutation, CanGc::from_cx(cx));
},
_ => {},
}