aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmltextareaelement.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/htmltextareaelement.rs')
-rwxr-xr-xcomponents/script/dom/htmltextareaelement.rs24
1 files changed, 21 insertions, 3 deletions
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs
index e7db7565adf..8a4e9f41cd3 100755
--- a/components/script/dom/htmltextareaelement.rs
+++ b/components/script/dom/htmltextareaelement.rs
@@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding;
use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::inheritance::Castable;
-use dom::bindings::js::{LayoutJS, Root};
+use dom::bindings::js::{LayoutJS, MutNullableJS, Root};
use dom::bindings::str::DOMString;
use dom::document::Document;
use dom::element::{AttributeMutation, Element};
@@ -30,6 +30,7 @@ use html5ever_atoms::LocalName;
use ipc_channel::ipc::IpcSender;
use script_traits::ScriptMsg as ConstellationMsg;
use std::cell::Cell;
+use std::default::Default;
use std::ops::Range;
use style::attr::AttrValue;
use style::element_state::*;
@@ -43,6 +44,7 @@ pub struct HTMLTextAreaElement {
placeholder: DOMRefCell<DOMString>,
// https://html.spec.whatwg.org/multipage/#concept-textarea-dirty
value_changed: Cell<bool>,
+ form_owner: MutNullableJS<HTMLFormElement>,
}
pub trait LayoutHTMLTextAreaElementHelpers {
@@ -116,6 +118,7 @@ impl HTMLTextAreaElement {
textinput: DOMRefCell::new(TextInput::new(
Lines::Multiple, DOMString::new(), chan, None, None, SelectionDirection::None)),
value_changed: Cell::new(false),
+ form_owner: Default::default(),
}
}
@@ -342,7 +345,10 @@ impl VirtualMethods for HTMLTextAreaElement {
el.set_read_write_state(!el.disabled_state());
}
}
- }
+ },
+ local_name!("form") => {
+ self.form_attribute_mutated(mutation);
+ },
_ => {},
}
}
@@ -435,7 +441,19 @@ impl VirtualMethods for HTMLTextAreaElement {
}
}
-impl FormControl for HTMLTextAreaElement {}
+impl FormControl for HTMLTextAreaElement {
+ fn form_owner(&self) -> Option<Root<HTMLFormElement>> {
+ self.form_owner.get()
+ }
+
+ fn set_form_owner(&self, form: Option<&HTMLFormElement>) {
+ self.form_owner.set(form);
+ }
+
+ fn to_element<'a>(&'a self) -> &'a Element {
+ self.upcast::<Element>()
+ }
+}
impl Validatable for HTMLTextAreaElement {}