aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmltextareaelement.rs
diff options
context:
space:
mode:
authorYoav Alon <yoava333@gmail.com>2016-04-25 18:55:31 +0300
committerYoav Alon <yoava333@gmail.com>2016-04-27 01:38:58 +0300
commit9bf909ac2ffb0951f2b1477f68565e7e9a51012d (patch)
treeea49c0b583d9261cdf8fa3ef59ca42247ae54c35 /components/script/dom/htmltextareaelement.rs
parentf773dc182badef4a4afac240d0d6fcbf57b76452 (diff)
downloadservo-9bf909ac2ffb0951f2b1477f68565e7e9a51012d.tar.gz
servo-9bf909ac2ffb0951f2b1477f68565e7e9a51012d.zip
added support for :read-only and :read-write pseudo-classes
partial fix for https://github.com/servo/servo/issues/10732
Diffstat (limited to 'components/script/dom/htmltextareaelement.rs')
-rw-r--r--components/script/dom/htmltextareaelement.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs
index d3eb7827031..82d33c873c7 100644
--- a/components/script/dom/htmltextareaelement.rs
+++ b/components/script/dom/htmltextareaelement.rs
@@ -104,7 +104,7 @@ impl HTMLTextAreaElement {
let chan = document.window().constellation_chan();
HTMLTextAreaElement {
htmlelement:
- HTMLElement::new_inherited_with_state(IN_ENABLED_STATE,
+ HTMLElement::new_inherited_with_state(IN_ENABLED_STATE | IN_READ_WRITE_STATE,
localName, prefix, document),
textinput: DOMRefCell::new(TextInput::new(
Lines::Multiple, DOMString::new(), chan, None, SelectionDirection::None)),
@@ -290,14 +290,31 @@ impl VirtualMethods for HTMLTextAreaElement {
AttributeMutation::Set(_) => {
el.set_disabled_state(true);
el.set_enabled_state(false);
+
+ el.set_read_write_state(false);
},
AttributeMutation::Removed => {
el.set_disabled_state(false);
el.set_enabled_state(true);
el.check_ancestors_disabled_state_for_form_control();
+
+ if !el.disabled_state() && !el.read_write_state() {
+ el.set_read_write_state(true);
+ }
}
}
},
+ atom!("readonly") => {
+ let el = self.upcast::<Element>();
+ match mutation {
+ AttributeMutation::Set(_) => {
+ el.set_read_write_state(false);
+ },
+ AttributeMutation::Removed => {
+ el.set_read_write_state(!el.disabled_state());
+ }
+ }
+ }
_ => {},
}
}