mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
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("...").
This commit is contained in:
parent
736323a779
commit
84bde75b42
64 changed files with 256 additions and 254 deletions
|
@ -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)
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue