Script: Use &mut JSContext in CheckValidity and ReportValidity Methods (#42820)

This is part of replacing can_gc with the new &JSContext/&mut JSContext
method.
We modify CheckValidity and ReportValidity in various HTML Elements to
use the context instead of CanGc.

Testing: Compilation is the test as this is mostly mechanical.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
Narfinger
2026-02-25 19:34:21 +09:00
committed by GitHub
parent 0b94f0a7ce
commit a122bde4b1
11 changed files with 78 additions and 56 deletions

View File

@@ -9,6 +9,7 @@ use dom_struct::dom_struct;
use embedder_traits::EmbedderControlRequest;
use embedder_traits::{SelectElementOption, SelectElementOptionOrOptgroup};
use html5ever::{LocalName, Prefix, QualName, local_name, ns};
use js::context::JSContext;
use js::rust::HandleObject;
use style::attr::AttrValue;
use stylo_dom::ElementState;
@@ -656,13 +657,13 @@ impl HTMLSelectElementMethods<crate::DomTypeHolder> for HTMLSelectElement {
}
/// <https://html.spec.whatwg.org/multipage/#dom-cva-checkvalidity>
fn CheckValidity(&self, can_gc: CanGc) -> bool {
self.check_validity(can_gc)
fn CheckValidity(&self, cx: &mut JSContext) -> bool {
self.check_validity(cx)
}
/// <https://html.spec.whatwg.org/multipage/#dom-cva-reportvalidity>
fn ReportValidity(&self, can_gc: CanGc) -> bool {
self.report_validity(can_gc)
fn ReportValidity(&self, cx: &mut JSContext) -> bool {
self.report_validity(cx)
}
/// <https://html.spec.whatwg.org/multipage/#dom-cva-validationmessage>