aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmltextareaelement.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/htmltextareaelement.rs')
-rw-r--r--components/script/dom/htmltextareaelement.rs30
1 files changed, 18 insertions, 12 deletions
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs
index 7196b4ff891..ed7fb71a954 100644
--- a/components/script/dom/htmltextareaelement.rs
+++ b/components/script/dom/htmltextareaelement.rs
@@ -187,6 +187,24 @@ impl<'a> HTMLTextAreaElementMethods for JSRef<'a, HTMLTextAreaElement> {
}
}
+pub trait HTMLTextAreaElementHelpers {
+ fn mutable(self) -> bool;
+ fn reset(self);
+}
+
+impl<'a> HTMLTextAreaElementHelpers for JSRef<'a, HTMLTextAreaElement> {
+ // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-mutable
+ fn mutable(self) -> bool {
+ // https://html.spec.whatwg.org/multipage/forms.html#the-textarea-element:concept-fe-mutable
+ !(self.Disabled() || self.ReadOnly())
+ }
+ fn reset(self) {
+ // https://html.spec.whatwg.org/multipage/forms.html#the-textarea-element:concept-form-reset-control
+ self.SetValue(self.DefaultValue());
+ self.value_changed.set(false);
+ }
+}
+
trait PrivateHTMLTextAreaElementHelpers {
fn force_relayout(self);
}
@@ -335,16 +353,4 @@ impl<'a> FormControl<'a> for JSRef<'a, HTMLTextAreaElement> {
fn to_element(self) -> JSRef<'a, Element> {
ElementCast::from_ref(self)
}
-
- // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-mutable
- fn mutable(self) -> bool {
- // https://html.spec.whatwg.org/multipage/forms.html#the-textarea-element:concept-fe-mutable
- !(self.Disabled() || self.ReadOnly())
- }
-
- fn reset(self) {
- // https://html.spec.whatwg.org/multipage/forms.html#the-textarea-element:concept-form-reset-control
- self.SetValue(self.DefaultValue());
- self.value_changed.set(false);
- }
}