cangc fixes in node.rs (#33984)

Signed-off-by: L Ashwin B <lashwinib@gmail.com>
This commit is contained in:
chickenleaf 2024-10-24 04:14:50 +05:30 committed by GitHub
parent 3ed778150f
commit bb4932026c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
97 changed files with 1038 additions and 534 deletions

View file

@ -53,6 +53,7 @@ impl HTMLOutputElement {
prefix: Option<Prefix>,
document: &Document,
proto: Option<HandleObject>,
can_gc: CanGc,
) -> DomRoot<HTMLOutputElement> {
Node::reflect_node_with_proto(
Box::new(HTMLOutputElement::new_inherited(
@ -60,11 +61,12 @@ impl HTMLOutputElement {
)),
document,
proto,
can_gc,
)
}
pub fn reset(&self) {
Node::string_replace_all(self.DefaultValue(), self.upcast::<Node>());
pub fn reset(&self, can_gc: CanGc) {
Node::string_replace_all(self.DefaultValue(), self.upcast::<Node>(), can_gc);
*self.default_value_override.borrow_mut() = None;
}
}
@ -89,10 +91,10 @@ impl HTMLOutputElementMethods for HTMLOutputElement {
}
// https://html.spec.whatwg.org/multipage/#dom-output-defaultvalue
fn SetDefaultValue(&self, value: DOMString) {
fn SetDefaultValue(&self, value: DOMString, can_gc: CanGc) {
if self.default_value_override.borrow().is_none() {
// Step 1 ("and return")
Node::string_replace_all(value.clone(), self.upcast::<Node>());
Node::string_replace_all(value.clone(), self.upcast::<Node>(), can_gc);
} else {
// Step 2, if not returned from step 1
*self.default_value_override.borrow_mut() = Some(value);
@ -105,9 +107,9 @@ impl HTMLOutputElementMethods for HTMLOutputElement {
}
// https://html.spec.whatwg.org/multipage/#dom-output-value
fn SetValue(&self, value: DOMString) {
fn SetValue(&self, value: DOMString, can_gc: CanGc) {
*self.default_value_override.borrow_mut() = Some(self.DefaultValue());
Node::string_replace_all(value, self.upcast::<Node>());
Node::string_replace_all(value, self.upcast::<Node>(), can_gc);
}
// https://html.spec.whatwg.org/multipage/#dom-output-type