diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2016-10-30 19:27:43 +0100 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2016-11-03 16:23:05 +0100 |
commit | 53b638c0e29ba78448d07695343b7ddfa36c5141 (patch) | |
tree | 52647391f6184df815a1d9ce85ad4a84e51f0ffe /components/script/dom/bindings | |
parent | 9fcc9d9d3f59428bf19f950bd79ab257d59e3d16 (diff) | |
download | servo-53b638c0e29ba78448d07695343b7ddfa36c5141.tar.gz servo-53b638c0e29ba78448d07695343b7ddfa36c5141.zip |
Update to string-cache 0.3
Diffstat (limited to 'components/script/dom/bindings')
-rw-r--r-- | components/script/dom/bindings/str.rs | 15 | ||||
-rw-r--r-- | components/script/dom/bindings/trace.rs | 5 | ||||
-rw-r--r-- | components/script/dom/bindings/xmlname.rs | 8 |
3 files changed, 21 insertions, 7 deletions
diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs index 2e28a1b314e..d7984939e28 100644 --- a/components/script/dom/bindings/str.rs +++ b/components/script/dom/bindings/str.rs @@ -4,6 +4,8 @@ //! The `ByteString` struct. +use html5ever_atoms::{LocalName, Namespace}; +use servo_atoms::Atom; use std::ascii::AsciiExt; use std::borrow::{Borrow, Cow, ToOwned}; use std::fmt; @@ -12,7 +14,6 @@ use std::ops; use std::ops::{Deref, DerefMut}; use std::str; use std::str::{Bytes, FromStr}; -use string_cache::Atom; /// Encapsulates the IDL `ByteString` type. #[derive(JSTraceable, Clone, Eq, PartialEq, HeapSizeOf, Debug)] @@ -255,6 +256,18 @@ impl<'a> From<Cow<'a, str>> for DOMString { } } +impl From<DOMString> for LocalName { + fn from(contents: DOMString) -> LocalName { + LocalName::from(contents.0) + } +} + +impl From<DOMString> for Namespace { + fn from(contents: DOMString) -> Namespace { + Namespace::from(contents.0) + } +} + impl From<DOMString> for Atom { fn from(contents: DOMString) -> Atom { Atom::from(contents.0) diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index e0f65d9f6e1..03a1d964808 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -47,6 +47,7 @@ use euclid::length::Length as EuclidLength; use euclid::rect::Rect; use euclid::size::Size2D; use html5ever::tree_builder::QuirksMode; +use html5ever_atoms::{Prefix, LocalName, Namespace, QualName}; use hyper::header::Headers; use hyper::method::Method; use hyper::mime::Mime; @@ -76,6 +77,7 @@ use script_runtime::ScriptChan; use script_traits::{TimerEventId, TimerSource, TouchpadPressurePhase}; use script_traits::{UntrustedNodeAddress, WindowSizeData, WindowSizeType}; use serde::{Deserialize, Serialize}; +use servo_atoms::Atom; use smallvec::SmallVec; use std::boxed::FnBox; use std::cell::{Cell, UnsafeCell}; @@ -88,7 +90,6 @@ use std::sync::Arc; use std::sync::atomic::{AtomicBool, AtomicUsize}; use std::sync::mpsc::{Receiver, Sender}; use std::time::{SystemTime, Instant}; -use string_cache::{Atom, Namespace, QualName}; use style::attr::{AttrIdentifier, AttrValue, LengthOrPercentageOrAuto}; use style::element_state::*; use style::media_queries::MediaQueryList; @@ -311,7 +312,7 @@ no_jsmanaged_fields!(Arc<T>); no_jsmanaged_fields!(Image, ImageMetadata, ImageCacheChan, ImageCacheThread); no_jsmanaged_fields!(Metadata); no_jsmanaged_fields!(NetworkError); -no_jsmanaged_fields!(Atom, Namespace, QualName); +no_jsmanaged_fields!(Atom, Prefix, LocalName, Namespace, QualName); no_jsmanaged_fields!(Trusted<T: Reflectable>); no_jsmanaged_fields!(TrustedPromise); no_jsmanaged_fields!(PropertyDeclarationBlock); diff --git a/components/script/dom/bindings/xmlname.rs b/components/script/dom/bindings/xmlname.rs index 11b83be7b99..4522c9c4ac0 100644 --- a/components/script/dom/bindings/xmlname.rs +++ b/components/script/dom/bindings/xmlname.rs @@ -6,7 +6,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::str::DOMString; -use string_cache::{Atom, Namespace}; +use html5ever_atoms::{Prefix, LocalName, Namespace}; /// Validate a qualified name. See https://dom.spec.whatwg.org/#validate for details. pub fn validate_qualified_name(qualified_name: &str) -> ErrorResult { @@ -27,7 +27,7 @@ pub fn validate_qualified_name(qualified_name: &str) -> ErrorResult { /// See https://dom.spec.whatwg.org/#validate-and-extract for details. pub fn validate_and_extract(namespace: Option<DOMString>, qualified_name: &str) - -> Fallible<(Namespace, Option<Atom>, Atom)> { + -> Fallible<(Namespace, Option<Prefix>, LocalName)> { // Step 1. let namespace = namespace_from_domstring(namespace); @@ -75,7 +75,7 @@ pub fn validate_and_extract(namespace: Option<DOMString>, }, (ns, p) => { // Step 10. - Ok((ns, p.map(Atom::from), Atom::from(local_name))) + Ok((ns, p.map(Prefix::from), LocalName::from(local_name))) } } } @@ -174,6 +174,6 @@ pub fn xml_name_type(name: &str) -> XMLName { pub fn namespace_from_domstring(url: Option<DOMString>) -> Namespace { match url { None => ns!(), - Some(s) => Namespace(Atom::from(s)), + Some(s) => Namespace::from(s), } } |