aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlinputelement.rs
diff options
context:
space:
mode:
authorMukilan Thiyagarajan <mukilanthiagarajan@gmail.com>2017-01-28 17:20:01 +0300
committerAnthony Ramine <n.oxyde@gmail.com>2017-03-15 16:39:55 +0100
commit38a61712e41ddeebb52cace6a9787735947964a4 (patch)
treef9949282e968e9a8fd57a8c8aa1fd63a59d0a89c /components/script/dom/htmlinputelement.rs
parentf90e19f7055387a14cabdf11f77335c7763e3fb7 (diff)
downloadservo-38a61712e41ddeebb52cace6a9787735947964a4.tar.gz
servo-38a61712e41ddeebb52cace6a9787735947964a4.zip
Implement the form owner concept
Diffstat (limited to 'components/script/dom/htmlinputelement.rs')
-rwxr-xr-xcomponents/script/dom/htmlinputelement.rs21
1 files changed, 19 insertions, 2 deletions
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index f2e9f983300..db26905b3b4 100755
--- a/components/script/dom/htmlinputelement.rs
+++ b/components/script/dom/htmlinputelement.rs
@@ -100,6 +100,7 @@ pub struct HTMLInputElement {
value_dirty: Cell<bool>,
filelist: MutNullableJS<FileList>,
+ form_owner: MutNullableJS<HTMLFormElement>,
}
#[derive(JSTraceable)]
@@ -156,6 +157,7 @@ impl HTMLInputElement {
activation_state: DOMRefCell::new(InputActivationState::new()),
value_dirty: Cell::new(false),
filelist: MutNullableJS::new(None),
+ form_owner: Default::default(),
}
}
@@ -1044,7 +1046,10 @@ impl VirtualMethods for HTMLInputElement {
el.set_read_write_state(!el.disabled_state());
}
}
- }
+ },
+ &local_name!("form") => {
+ self.form_attribute_mutated(mutation);
+ },
_ => {},
}
}
@@ -1163,7 +1168,19 @@ impl VirtualMethods for HTMLInputElement {
}
}
-impl FormControl for HTMLInputElement {}
+impl FormControl for HTMLInputElement {
+ 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 HTMLInputElement {
fn is_instance_validatable(&self) -> bool {