aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/textinput.rs
diff options
context:
space:
mode:
authorAlan Jeffrey <ajeffrey@mozilla.com>2015-11-11 16:26:53 -0600
committerAlan Jeffrey <ajeffrey@mozilla.com>2015-11-12 17:52:59 -0600
commit84bde75b420e7035cee891781a3805d5c8c4cdeb (patch)
tree061040f39149d530b059a998be832c7f9b0a8134 /components/script/textinput.rs
parent736323a7796594a5b966ab6ae690e5cc51225a14 (diff)
downloadservo-84bde75b420e7035cee891781a3805d5c8c4cdeb.tar.gz
servo-84bde75b420e7035cee891781a3805d5c8c4cdeb.zip
Replaced DOMString constructor by conversion functions.
Replaced DOMString(...) by DOMString::from(...). Replaced ....0 by String::from(...). Removed any uses of .to_owner() in DOMString::from("...").
Diffstat (limited to 'components/script/textinput.rs')
-rw-r--r--components/script/textinput.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/components/script/textinput.rs b/components/script/textinput.rs
index 98b080fd1b8..643b514c21a 100644
--- a/components/script/textinput.rs
+++ b/components/script/textinput.rs
@@ -137,7 +137,7 @@ impl<T: ClipboardProvider> TextInput<T> {
if self.selection_begin.is_none() {
self.selection_begin = Some(self.edit_point);
}
- self.replace_selection(DOMString(s.into()));
+ self.replace_selection(DOMString::from(s.into()));
}
pub fn get_sorted_selection(&self) -> Option<(TextPoint, TextPoint)> {
@@ -181,14 +181,14 @@ impl<T: ClipboardProvider> TextInput<T> {
let lines_suffix = &self.lines[end.line + 1..];
let mut insert_lines = if self.multiline {
- insert.split('\n').map(|s| DOMString(s.to_owned())).collect()
+ insert.split('\n').map(DOMString::from).collect()
} else {
vec!(insert)
};
let mut new_line = prefix.to_owned();
new_line.push_str(&insert_lines[0]);
- insert_lines[0] = DOMString(new_line);
+ insert_lines[0] = DOMString::from(new_line);
let last_insert_lines_index = insert_lines.len() - 1;
self.edit_point.index = insert_lines[last_insert_lines_index].len();
@@ -441,14 +441,14 @@ impl<T: ClipboardProvider> TextInput<T> {
content.push('\n');
}
}
- DOMString(content)
+ DOMString::from(content)
}
/// Set the current contents of the text input. If this is control supports multiple lines,
/// any \n encountered will be stripped and force a new logical line.
pub fn set_content(&mut self, content: DOMString) {
self.lines = if self.multiline {
- content.split('\n').map(|s| DOMString(s.to_owned())).collect()
+ content.split('\n').map(DOMString::from).collect()
} else {
vec!(content)
};