aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-12-26 23:32:26 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-12-27 00:18:06 +0530
commit6a0ec85d430e9330c70d19923cc9cc0c6eaab5ff (patch)
tree81e2c6b24c65e0c2ad9ec48239b677c147787178 /components/script/dom
parent9412e71460990f40ea7f9706fd79fbcd4eb0670a (diff)
downloadservo-6a0ec85d430e9330c70d19923cc9cc0c6eaab5ff.tar.gz
servo-6a0ec85d430e9330c70d19923cc9cc0c6eaab5ff.zip
Fix placeholders for password inputs
currently they show dots
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/htmlinputelement.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index a7143133b05..bc90edae19e 100644
--- a/components/script/dom/htmlinputelement.rs
+++ b/components/script/dom/htmlinputelement.rs
@@ -156,7 +156,12 @@ pub trait LayoutHTMLInputElementHelpers {
unsafe fn get_raw_textinput_value(input: LayoutJS<HTMLInputElement>) -> DOMString {
let textinput = (*input.unsafe_get()).textinput.borrow_for_layout().get_content();
if !textinput.is_empty() {
- textinput
+ if let InputType::InputPassword = (*input.unsafe_get()).input_type.get() {
+ // The implementation of get_insertion_point_index_for_layout expects a 1:1 mapping of chars.
+ DOMString::from(textinput.chars().map(|_| '●').collect::<String>())
+ } else {
+ textinput
+ }
} else {
(*input.unsafe_get()).placeholder.borrow_for_layout().clone()
}
@@ -180,11 +185,6 @@ impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> {
InputType::InputButton => get_raw_attr_value(self, ""),
InputType::InputSubmit => get_raw_attr_value(self, DEFAULT_SUBMIT_VALUE),
InputType::InputReset => get_raw_attr_value(self, DEFAULT_RESET_VALUE),
- InputType::InputPassword => {
- let raw = get_raw_textinput_value(self);
- // The implementation of get_insertion_point_index_for_layout expects a 1:1 mapping of chars.
- raw.chars().map(|_| '●').collect()
- }
_ => String::from(get_raw_textinput_value(self)),
}
}