Move to to_owned rather than into_string.

into_string has been removed from Rust.
This commit is contained in:
Ms2ger 2015-01-20 14:45:36 +01:00
parent 2d5b0e0855
commit 01ed338746
67 changed files with 473 additions and 383 deletions

View file

@ -38,6 +38,7 @@ use servo_util::str::DOMString;
use string_cache::Atom;
use std::ascii::OwnedAsciiExt;
use std::borrow::ToOwned;
use std::cell::Cell;
use std::default::Default;
@ -116,7 +117,7 @@ impl HTMLInputElement {
checked_changed: Cell::new(false),
value_changed: Cell::new(false),
size: Cell::new(DEFAULT_INPUT_SIZE),
textinput: DOMRefCell::new(TextInput::new(Single, "".into_string())),
textinput: DOMRefCell::new(TextInput::new(Single, "".to_owned())),
activation_state: DOMRefCell::new(InputActivationState::new())
}
}
@ -149,15 +150,15 @@ impl LayoutHTMLInputElementHelpers for JS<HTMLInputElement> {
unsafe fn get_raw_attr_value(input: JS<HTMLInputElement>) -> Option<String> {
let elem: JS<Element> = input.transmute_copy();
(*elem.unsafe_get()).get_attr_val_for_layout(&ns!(""), &atom!("value"))
.map(|s| s.into_string())
.map(|s| s.to_owned())
}
match (*self.unsafe_get()).input_type.get() {
InputType::InputCheckbox | InputType::InputRadio => "".into_string(),
InputType::InputFile | InputType::InputImage => "".into_string(),
InputType::InputButton => get_raw_attr_value(self).unwrap_or_else(|| "".into_string()),
InputType::InputSubmit => get_raw_attr_value(self).unwrap_or_else(|| DEFAULT_SUBMIT_VALUE.into_string()),
InputType::InputReset => get_raw_attr_value(self).unwrap_or_else(|| DEFAULT_RESET_VALUE.into_string()),
InputType::InputCheckbox | InputType::InputRadio => "".to_owned(),
InputType::InputFile | InputType::InputImage => "".to_owned(),
InputType::InputButton => get_raw_attr_value(self).unwrap_or_else(|| "".to_owned()),
InputType::InputSubmit => get_raw_attr_value(self).unwrap_or_else(|| DEFAULT_SUBMIT_VALUE.to_owned()),
InputType::InputReset => get_raw_attr_value(self).unwrap_or_else(|| DEFAULT_RESET_VALUE.to_owned()),
InputType::InputPassword => {
let raw = get_raw_textinput_value(self);
String::from_char(raw.char_len(), '●')
@ -313,7 +314,7 @@ fn broadcast_radio_checked(broadcaster: JSRef<HTMLInputElement>, group: Option<&
// There is no DOM tree manipulation here, so this is safe
let mut iter = unsafe {
doc_node.query_selector_iter("input[type=radio]".into_string()).unwrap()
doc_node.query_selector_iter("input[type=radio]".to_owned()).unwrap()
.filter_map(|t| HTMLInputElementCast::to_ref(t))
.filter(|&r| in_same_group(r, owner.r(), group) && broadcaster != r)
};
@ -439,7 +440,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLInputElement> {
}
&atom!("value") => {
if !self.value_changed.get() {
self.textinput.borrow_mut().set_content(attr.value().as_slice().into_string());
self.textinput.borrow_mut().set_content(attr.value().as_slice().to_owned());
self.force_relayout();
}
}
@ -488,7 +489,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLInputElement> {
}
&atom!("value") => {
if !self.value_changed.get() {
self.textinput.borrow_mut().set_content("".into_string());
self.textinput.borrow_mut().set_content("".to_owned());
self.force_relayout();
}
}
@ -639,7 +640,7 @@ impl<'a> Activatable for JSRef<'a, HTMLInputElement> {
// Safe since we only manipulate the DOM tree after finding an element
let checked_member = unsafe {
doc_node.query_selector_iter("input[type=radio]".into_string()).unwrap()
doc_node.query_selector_iter("input[type=radio]".to_owned()).unwrap()
.filter_map(|t| HTMLInputElementCast::to_ref(t))
.filter(|&r| in_same_group(r, owner.r(),
group.as_ref().map(|gr| gr.as_slice())))
@ -739,7 +740,7 @@ impl<'a> Activatable for JSRef<'a, HTMLInputElement> {
if self.mutable() {
let win = window_from_node(*self).root();
let event = Event::new(GlobalRef::Window(win.r()),
"input".into_string(),
"input".to_owned(),
EventBubbles::Bubbles,
EventCancelable::NotCancelable).root();
event.r().set_trusted(true);
@ -747,7 +748,7 @@ impl<'a> Activatable for JSRef<'a, HTMLInputElement> {
target.DispatchEvent(event.r()).ok();
let event = Event::new(GlobalRef::Window(win.r()),
"change".into_string(),
"change".to_owned(),
EventBubbles::Bubbles,
EventCancelable::NotCancelable).root();
event.r().set_trusted(true);
@ -771,7 +772,7 @@ impl<'a> Activatable for JSRef<'a, HTMLInputElement> {
// This is safe because we are stopping after finding the first element
// and only then performing actions which may modify the DOM tree
unsafe {
node.query_selector_iter("input[type=submit]".into_string()).unwrap()
node.query_selector_iter("input[type=submit]".to_owned()).unwrap()
.filter_map(|t| HTMLInputElementCast::to_ref(t))
.find(|r| r.form_owner() == owner)
.map(|s| s.synthetic_click_activation(ctrlKey, shiftKey, altKey, metaKey));