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

@@ -10,6 +10,7 @@ use dom_struct::dom_struct;
use embedder_traits::{EmbedderControlRequest, InputMethodRequest, InputMethodType};
use fonts::{ByteIndex, TextByteRange};
use html5ever::{LocalName, Prefix, local_name, ns};
use js::context::JSContext;
use js::rust::HandleObject;
use layout_api::wrapper_traits::{ScriptSelection, SharedSelection};
use script_bindings::codegen::GenericBindings::CharacterDataBinding::CharacterDataMethods;
@@ -558,13 +559,13 @@ impl HTMLTextAreaElementMethods<crate::DomTypeHolder> for HTMLTextAreaElement {
}
/// <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>