mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Move to to_owned rather than into_string.
into_string has been removed from Rust.
This commit is contained in:
parent
2d5b0e0855
commit
01ed338746
67 changed files with 473 additions and 383 deletions
|
@ -59,6 +59,7 @@ use html5ever::tree_builder::{NoQuirks, LimitedQuirks, Quirks};
|
|||
|
||||
use cssparser::RGBA;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::{Ref, RefMut};
|
||||
use std::default::Default;
|
||||
use std::mem;
|
||||
|
@ -761,7 +762,7 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
|
|||
fn get_url_attribute(self, name: &Atom) -> DOMString {
|
||||
assert!(name.as_slice() == name.as_slice().to_ascii_lower().as_slice());
|
||||
if !self.has_attribute(name) {
|
||||
return "".into_string();
|
||||
return "".to_owned();
|
||||
}
|
||||
let url = self.get_string_attribute(name);
|
||||
let doc = document_from_node(self).root();
|
||||
|
@ -770,7 +771,7 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
|
|||
// XXXManishearth this doesn't handle `javascript:` urls properly
|
||||
match UrlParser::new().base_url(base).parse(url.as_slice()) {
|
||||
Ok(parsed) => parsed.serialize(),
|
||||
Err(_) => "".into_string()
|
||||
Err(_) => "".to_owned()
|
||||
}
|
||||
}
|
||||
fn set_url_attribute(self, name: &Atom, value: DOMString) {
|
||||
|
@ -780,7 +781,7 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
|
|||
fn get_string_attribute(self, name: &Atom) -> DOMString {
|
||||
match self.get_attribute(ns!(""), name) {
|
||||
Some(x) => x.root().r().Value(),
|
||||
None => "".into_string()
|
||||
None => "".to_owned()
|
||||
}
|
||||
}
|
||||
fn set_string_attribute(self, name: &Atom, value: DOMString) {
|
||||
|
@ -835,12 +836,12 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
|||
fn GetNamespaceURI(self) -> Option<DOMString> {
|
||||
match self.namespace {
|
||||
ns!("") => None,
|
||||
Namespace(ref ns) => Some(ns.as_slice().into_string())
|
||||
Namespace(ref ns) => Some(ns.as_slice().to_owned())
|
||||
}
|
||||
}
|
||||
|
||||
fn LocalName(self) -> DOMString {
|
||||
self.local_name.as_slice().into_string()
|
||||
self.local_name.as_slice().to_owned()
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-element-prefix
|
||||
|
@ -996,7 +997,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
|||
// Step 9.
|
||||
let value = self.parse_attribute(&namespace, &local_name, value);
|
||||
self.do_set_attribute(local_name.clone(), value, name,
|
||||
namespace.clone(), prefix.map(|s| s.into_string()),
|
||||
namespace.clone(), prefix.map(|s| s.to_owned()),
|
||||
|attr| {
|
||||
*attr.local_name() == local_name &&
|
||||
*attr.namespace() == namespace
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue