diff options
39 files changed, 77 insertions, 74 deletions
diff --git a/Cargo.lock b/Cargo.lock index 2e8f0abb8fe..39c2a21b1ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -287,6 +287,8 @@ dependencies = [ "plugins 0.0.1", "script 0.0.1", "script_traits 0.0.1", + "string_cache 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)", + "string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)", "style 0.0.1", "url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)", "util 0.0.1", @@ -397,6 +399,8 @@ dependencies = [ "net 0.0.1", "plugins 0.0.1", "script_traits 0.0.1", + "string_cache 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)", + "string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)", "style 0.0.1", "url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)", "util 0.0.1", @@ -462,6 +466,8 @@ dependencies = [ "plugins 0.0.1", "url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)", "util 0.0.1", + "string_cache 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)", + "string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)", ] [[package]] @@ -483,6 +489,7 @@ dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure#b357751c04a89a87e6ef1f0cebe5f20957dd112d)", "geom 0.1.0 (git+https://github.com/servo/rust-geom#90add8d65273c8a46aa16d73959e29a51d0c282d)", "string_cache 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)", + "string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)", "task_info 0.0.1", "url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)", ] diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml index b6e7da758c5..edd6ed0ad1b 100644 --- a/components/layout/Cargo.toml +++ b/components/layout/Cargo.toml @@ -39,3 +39,9 @@ git = "https://github.com/servo/rust-geom" [dependencies.url] git = "https://github.com/servo/rust-url" + +[dependencies.string_cache] +git = "https://github.com/servo/string-cache" + +[dependencies.string_cache_macros] +git = "https://github.com/servo/string-cache" diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs index 564e5f6569f..2a4e462b40f 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -11,7 +11,6 @@ use util::{LayoutDataAccess, LayoutDataWrapper}; use wrapper::{LayoutElement, LayoutNode, PostorderNodeMutTraversal, ThreadSafeLayoutNode, TLayoutNode}; use script::dom::node::{TextNodeTypeId}; -use servo_util::atom::Atom; use servo_util::bloom::BloomFilter; use servo_util::cache::{Cache, LRUCache, SimpleHashCache}; use servo_util::namespace::Null; @@ -24,6 +23,7 @@ use style; use style::{After, Before, ComputedValues, DeclarationBlock, Stylist, TElement, TNode}; use style::cascade; use sync::Arc; +use string_cache::Atom; pub struct ApplicableDeclarations { pub normal: SmallVec16<DeclarationBlock>, diff --git a/components/layout/lib.rs b/components/layout/lib.rs index 5ef17f65359..c15b2658ab4 100644 --- a/components/layout/lib.rs +++ b/components/layout/lib.rs @@ -28,6 +28,9 @@ extern crate "net" as servo_net; extern crate "msg" as servo_msg; #[phase(plugin, link)] extern crate "util" as servo_util; +extern crate string_cache; +#[phase(plugin)] +extern crate string_cache_macros; extern crate collections; extern crate encoding; diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 4b4f3eef939..f2408d6a721 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -48,7 +48,6 @@ use script::dom::node::{LayoutNodeHelpers, RawLayoutNodeHelpers, SharedLayoutDat use script::dom::text::Text; use script::layout_interface::LayoutChan; use servo_msg::constellation_msg::{PipelineId, SubpageId}; -use servo_util::atom::Atom; use servo_util::namespace::Namespace; use servo_util::namespace; use servo_util::str::is_whitespace; @@ -59,6 +58,7 @@ use style::computed_values::{content, display, white_space}; use style::{AnyNamespace, AttrSelector, PropertyDeclarationBlock, SpecificNamespace, TElement}; use style::{TNode}; use url::Url; +use string_cache::Atom; /// Allows some convenience methods on generic layout nodes. pub trait TLayoutNode { diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index b5587cc8ee3..152cb48fab2 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -60,3 +60,9 @@ git = "https://github.com/servo/rust-url" [dependencies.uuid] git = "https://github.com/rust-lang/uuid" + +[dependencies.string_cache] +git = "https://github.com/servo/string-cache" + +[dependencies.string_cache_macros] +git = "https://github.com/servo/string-cache" diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index cc5ebbe96a5..bd2d90e2ec6 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -15,13 +15,13 @@ use dom::window::Window; use dom::virtualmethods::vtable_for; use devtools_traits::AttrInfo; -use servo_util::atom::Atom; use servo_util::namespace; use servo_util::namespace::Namespace; use servo_util::str::{DOMString, split_html_space_chars}; use std::cell::{Ref, RefCell}; use std::mem; use std::slice::Items; +use string_cache::Atom; pub enum AttrSettingType { FirstSetAttr, diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 0d87892aecf..af3083d456d 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -35,7 +35,6 @@ use std::rc::Rc; use std::cell::{Cell, RefCell}; use url::Url; -use servo_util::atom::Atom; use servo_util::namespace::Namespace; use msg::constellation_msg::{PipelineId, SubpageId, WindowSizeData}; use net::image_cache_task::ImageCacheTask; @@ -43,6 +42,7 @@ use script_traits::ScriptControlChan; use std::collections::hashmap::HashMap; use collections::hash::Hash; use style::PropertyDeclarationBlock; +use string_cache::Atom; impl<T: Reflectable> JSTraceable for JS<T> { fn trace(&self, trc: *mut JSTracer) { diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 63f205206fa..a66ec400e34 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -55,10 +55,10 @@ use dom::window::{Window, WindowHelpers}; use html::hubbub_html_parser::build_element_from_tag; use hubbub::hubbub::{QuirksMode, NoQuirks, LimitedQuirks, FullQuirks}; use layout_interface::{DocumentDamageLevel, ContentChangedDocumentDamage}; -use servo_util::atom::Atom; use servo_util::namespace; use servo_util::namespace::{Namespace, Null}; use servo_util::str::{DOMString, split_html_space_chars}; +use string_cache::Atom; use std::collections::hashmap::HashMap; use std::ascii::StrAsciiExt; diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs index 3d99d9df7eb..d66fc059582 100644 --- a/components/script/dom/domtokenlist.rs +++ b/components/script/dom/domtokenlist.rs @@ -12,9 +12,9 @@ use dom::bindings::utils::{Reflector, Reflectable, reflect_dom_object}; use dom::element::{Element, AttributeHandlers}; use dom::node::window_from_node; -use servo_util::atom::Atom; use servo_util::namespace::Null; use servo_util::str::{DOMString, HTML_SPACE_CHARACTERS}; +use string_cache::Atom; #[jstraceable] #[must_root] diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index a4ae4734ffc..a789ecb41a7 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -34,7 +34,6 @@ use layout_interface::MatchSelectorsDocumentDamage; use devtools_traits::AttrInfo; use style::{matches, parse_selector_list_from_str}; use style; -use servo_util::atom::Atom; use servo_util::namespace; use servo_util::namespace::{Namespace, Null}; use servo_util::str::DOMString; @@ -42,6 +41,7 @@ use servo_util::str::DOMString; use std::ascii::StrAsciiExt; use std::cell::{Cell, RefCell}; use std::mem; +use string_cache::Atom; #[jstraceable] #[must_root] diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs index 4835bb64371..764be50c83f 100644 --- a/components/script/dom/htmlbodyelement.rs +++ b/components/script/dom/htmlbodyelement.rs @@ -17,8 +17,8 @@ use dom::htmlelement::HTMLElement; use dom::node::{Node, ElementNodeTypeId, window_from_node}; use dom::virtualmethods::VirtualMethods; -use servo_util::atom::Atom; use servo_util::str::DOMString; +use string_cache::Atom; #[jstraceable] #[must_root] diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs index 0a61eaab5f9..01a1e513748 100644 --- a/components/script/dom/htmlbuttonelement.rs +++ b/components/script/dom/htmlbuttonelement.rs @@ -16,8 +16,8 @@ use dom::node::{DisabledStateHelpers, Node, NodeHelpers, ElementNodeTypeId, wind use dom::validitystate::ValidityState; use dom::virtualmethods::VirtualMethods; -use servo_util::atom::Atom; use servo_util::str::DOMString; +use string_cache::Atom; #[jstraceable] #[must_root] diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index f50794d91a8..d0f0e37ff55 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -18,8 +18,8 @@ use dom::htmlelement::HTMLElement; use dom::node::{Node, ElementNodeTypeId, window_from_node}; use dom::virtualmethods::VirtualMethods; -use servo_util::atom::Atom; use servo_util::str::{DOMString, parse_unsigned_integer}; +use string_cache::Atom; use geom::size::Size2D; diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs index 1d9613c6259..049cb5de60e 100644 --- a/components/script/dom/htmlcollection.rs +++ b/components/script/dom/htmlcollection.rs @@ -12,11 +12,11 @@ use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::element::{Element, AttributeHandlers, ElementHelpers}; use dom::node::{Node, NodeHelpers}; use dom::window::Window; -use servo_util::atom::Atom; use servo_util::namespace::Namespace; use servo_util::str::{DOMString, split_html_space_chars}; use std::ascii::StrAsciiExt; +use string_cache::Atom; pub trait CollectionFilter : JSTraceable { fn filter(&self, elem: JSRef<Element>, root: JSRef<Node>) -> bool; diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index e0d0d213d83..44ed7910320 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -17,9 +17,9 @@ use dom::eventtarget::{EventTarget, EventTargetHelpers, NodeTargetTypeId}; use dom::node::{Node, ElementNodeTypeId, window_from_node}; use dom::virtualmethods::VirtualMethods; -use servo_util::atom::Atom; use servo_util::namespace; use servo_util::str::DOMString; +use string_cache::Atom; #[jstraceable] #[must_root] diff --git a/components/script/dom/htmlfieldsetelement.rs b/components/script/dom/htmlfieldsetelement.rs index 167fbbe084e..2d5188b644e 100644 --- a/components/script/dom/htmlfieldsetelement.rs +++ b/components/script/dom/htmlfieldsetelement.rs @@ -18,8 +18,8 @@ use dom::node::{DisabledStateHelpers, Node, NodeHelpers, ElementNodeTypeId, wind use dom::validitystate::ValidityState; use dom::virtualmethods::VirtualMethods; -use servo_util::atom::Atom; use servo_util::str::{DOMString, StaticStringVec}; +use string_cache::Atom; #[jstraceable] #[must_root] diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 828ba978427..49323fea7a9 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -23,9 +23,9 @@ use page::IterablePage; use servo_msg::constellation_msg::{PipelineId, SubpageId}; use servo_msg::constellation_msg::{IFrameSandboxed, IFrameUnsandboxed}; use servo_msg::constellation_msg::{ConstellationChan, LoadIframeUrlMsg}; -use servo_util::atom::Atom; use servo_util::namespace::Null; use servo_util::str::DOMString; +use string_cache::Atom; use std::ascii::StrAsciiExt; use std::cell::Cell; diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 7ffe03eff81..544959bf397 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -17,9 +17,9 @@ use dom::htmlelement::HTMLElement; use dom::node::{Node, ElementNodeTypeId, NodeHelpers, window_from_node}; use dom::virtualmethods::VirtualMethods; use servo_net::image_cache_task; -use servo_util::atom::Atom; use servo_util::geometry::to_px; use servo_util::str::DOMString; +use string_cache::Atom; use url::{Url, UrlParser}; diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 9fafe3c2f63..cc4c85a0791 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -15,8 +15,8 @@ use dom::htmlelement::HTMLElement; use dom::node::{DisabledStateHelpers, Node, NodeHelpers, ElementNodeTypeId}; use dom::virtualmethods::VirtualMethods; -use servo_util::atom::Atom; use servo_util::str::DOMString; +use string_cache::Atom; #[jstraceable] #[must_root] diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index e59c337dcf8..fe78cfe47c4 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -15,12 +15,12 @@ use dom::htmlelement::HTMLElement; use dom::node::{Node, NodeHelpers, ElementNodeTypeId, window_from_node}; use dom::virtualmethods::VirtualMethods; use layout_interface::{LayoutChan, LoadStylesheetMsg}; -use servo_util::atom::Atom; use servo_util::str::{DOMString, HTML_SPACE_CHARACTERS}; use servo_util::namespace::Null; use std::ascii::StrAsciiExt; use url::UrlParser; +use string_cache::Atom; #[jstraceable] #[must_root] diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs index 49ea7d1a716..759f3c37c59 100644 --- a/components/script/dom/htmlobjectelement.rs +++ b/components/script/dom/htmlobjectelement.rs @@ -20,9 +20,9 @@ use dom::virtualmethods::VirtualMethods; use servo_net::image_cache_task; use servo_net::image_cache_task::ImageCacheTask; -use servo_util::atom::Atom; use servo_util::namespace::Null; use servo_util::str::DOMString; +use string_cache::Atom; use url::Url; diff --git a/components/script/dom/htmloptgroupelement.rs b/components/script/dom/htmloptgroupelement.rs index 974dd047bf4..bf5782fb4e3 100644 --- a/components/script/dom/htmloptgroupelement.rs +++ b/components/script/dom/htmloptgroupelement.rs @@ -15,8 +15,8 @@ use dom::htmlelement::HTMLElement; use dom::node::{DisabledStateHelpers, Node, NodeHelpers, ElementNodeTypeId}; use dom::virtualmethods::VirtualMethods; -use servo_util::atom::Atom; use servo_util::str::DOMString; +use string_cache::Atom; #[jstraceable] #[must_root] diff --git a/components/script/dom/htmloptionelement.rs b/components/script/dom/htmloptionelement.rs index fc889bc855c..b87621f8e3b 100644 --- a/components/script/dom/htmloptionelement.rs +++ b/components/script/dom/htmloptionelement.rs @@ -19,9 +19,9 @@ use dom::htmlelement::HTMLElement; use dom::node::{DisabledStateHelpers, Node, NodeHelpers, ElementNodeTypeId}; use dom::virtualmethods::VirtualMethods; -use servo_util::atom::Atom; use servo_util::namespace; use servo_util::str::{DOMString, split_html_space_chars}; +use string_cache::Atom; #[jstraceable] #[must_root] diff --git a/components/script/dom/htmlselectelement.rs b/components/script/dom/htmlselectelement.rs index 891a9787624..787a7e32b09 100644 --- a/components/script/dom/htmlselectelement.rs +++ b/components/script/dom/htmlselectelement.rs @@ -18,8 +18,8 @@ use dom::node::{DisabledStateHelpers, Node, NodeHelpers, ElementNodeTypeId, wind use dom::validitystate::ValidityState; use dom::virtualmethods::VirtualMethods; -use servo_util::atom::Atom; use servo_util::str::DOMString; +use string_cache::Atom; #[jstraceable] #[must_root] diff --git a/components/script/dom/htmlserializer.rs b/components/script/dom/htmlserializer.rs index 19aa7e2f0dd..32606f94896 100644 --- a/components/script/dom/htmlserializer.rs +++ b/components/script/dom/htmlserializer.rs @@ -18,8 +18,8 @@ use dom::node::{TextNodeTypeId, NodeHelpers}; use dom::processinginstruction::ProcessingInstruction; use dom::text::Text; -use servo_util::atom::Atom; use servo_util::namespace; +use string_cache::Atom; #[allow(unrooted_must_root)] pub fn serialize(iterator: &mut NodeIterator) -> String { diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index 60a84a4d93f..763c636d5b6 100644 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -15,8 +15,8 @@ use dom::htmlelement::HTMLElement; use dom::node::{DisabledStateHelpers, Node, NodeHelpers, ElementNodeTypeId}; use dom::virtualmethods::VirtualMethods; -use servo_util::atom::Atom; use servo_util::str::DOMString; +use string_cache::Atom; #[jstraceable] #[must_root] diff --git a/components/script/dom/virtualmethods.rs b/components/script/dom/virtualmethods.rs index 8c37b788a26..faa3c91aaf2 100644 --- a/components/script/dom/virtualmethods.rs +++ b/components/script/dom/virtualmethods.rs @@ -57,8 +57,8 @@ use dom::htmlstyleelement::HTMLStyleElement; use dom::htmltextareaelement::HTMLTextAreaElement; use dom::node::{Node, NodeHelpers, ElementNodeTypeId}; -use servo_util::atom::Atom; use servo_util::str::DOMString; +use string_cache::Atom; /// Trait to allow DOM nodes to opt-in to overriding (or adding to) common /// behaviours. Replicates the effect of C++ virtual methods. diff --git a/components/script/html/hubbub_html_parser.rs b/components/script/html/hubbub_html_parser.rs index 097f8438cb5..3b3a914d611 100644 --- a/components/script/html/hubbub_html_parser.rs +++ b/components/script/html/hubbub_html_parser.rs @@ -25,7 +25,6 @@ use encoding::types::{Encoding, DecodeReplace}; use hubbub::hubbub; use hubbub::hubbub::{NullNs, HtmlNs, MathMlNs, SvgNs, XLinkNs, XmlNs, XmlNsNs}; use servo_net::resource_task::{Load, LoadData, Payload, Done, ResourceTask, load_whole_resource}; -use servo_util::atom::Atom; use servo_util::namespace; use servo_util::namespace::{Namespace, Null}; use servo_util::str::DOMString; @@ -37,6 +36,7 @@ use std::comm::{channel, Sender, Receiver}; use url::{Url, UrlParser}; use http::headers::HeaderEnum; use time; +use string_cache::Atom; macro_rules! handle_element( ($document: expr, diff --git a/components/script/lib.rs b/components/script/lib.rs index 695aef3c1b5..09bea1b73bd 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -42,6 +42,9 @@ extern crate sync; extern crate "msg" as servo_msg; extern crate url; extern crate uuid; +extern crate string_cache; +#[phase(plugin)] +extern crate string_cache_macros; pub mod cors; diff --git a/components/style/Cargo.toml b/components/style/Cargo.toml index 40391564a2e..cdd4e0ce48b 100644 --- a/components/style/Cargo.toml +++ b/components/style/Cargo.toml @@ -29,3 +29,9 @@ git = "https://github.com/lifthrasiir/rust-encoding" [dependencies.lazy_static] git = "https://github.com/Kimundi/lazy-static.rs" + +[dependencies.string_cache] +git = "https://github.com/servo/string-cache" + +[dependencies.string_cache_macros] +git = "https://github.com/servo/string-cache" diff --git a/components/style/lib.rs b/components/style/lib.rs index 05b358eec70..997794596e0 100644 --- a/components/style/lib.rs +++ b/components/style/lib.rs @@ -22,6 +22,11 @@ extern crate url; extern crate cssparser; extern crate encoding; +extern crate string_cache; + +#[phase(plugin)] +extern crate string_cache_macros; + #[phase(plugin)] extern crate lazy_static; diff --git a/components/style/node.rs b/components/style/node.rs index 8b05097f9c0..87cfa3b7ce6 100644 --- a/components/style/node.rs +++ b/components/style/node.rs @@ -6,8 +6,8 @@ //! style. use selectors::AttrSelector; -use servo_util::atom::Atom; use servo_util::namespace::Namespace; +use string_cache::Atom; pub trait TNode<'a, E: TElement<'a>> : Clone { diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs index 6c0ff778f94..99dc6767d04 100644 --- a/components/style/selector_matching.rs +++ b/components/style/selector_matching.rs @@ -9,11 +9,11 @@ use sync::Arc; use url::Url; -use servo_util::atom::Atom; use servo_util::bloom::BloomFilter; use servo_util::namespace; use servo_util::smallvec::VecLike; use servo_util::sort; +use string_cache::Atom; use media_queries::{Device, Screen}; use node::{TElement, TNode}; @@ -997,7 +997,6 @@ impl<K: Eq + Hash, V> FindPush<K, V> for HashMap<K, Vec<V>> { #[cfg(test)] mod tests { - use servo_util::atom::Atom; use sync::Arc; use super::{DeclarationBlock, Rule, SelectorMap}; use selectors::LocalName; diff --git a/components/style/selectors.rs b/components/style/selectors.rs index 24aad6398f4..2736ced5a1c 100644 --- a/components/style/selectors.rs +++ b/components/style/selectors.rs @@ -9,9 +9,9 @@ use sync::Arc; use cssparser::ast::*; use cssparser::{tokenize, parse_nth}; -use servo_util::atom::Atom; use servo_util::namespace::Namespace; use servo_util::namespace; +use string_cache::Atom; use namespaces::NamespaceMap; @@ -575,7 +575,6 @@ fn skip_whitespace<I: Iterator<ComponentValue>>(iter: &mut Iter<I>) -> bool { mod tests { use sync::Arc; use cssparser; - use servo_util::atom::Atom; use servo_util::namespace; use namespaces::NamespaceMap; use super::*; diff --git a/components/util/Cargo.toml b/components/util/Cargo.toml index 3e599630f0c..d0606c4ee8f 100644 --- a/components/util/Cargo.toml +++ b/components/util/Cargo.toml @@ -19,5 +19,8 @@ path = "../../support/rust-task_info" [dependencies.string_cache] git = "https://github.com/servo/string-cache" +[dependencies.string_cache_macros] +git = "https://github.com/servo/string-cache" + [dependencies.url] git = "https://github.com/servo/rust-url" diff --git a/components/util/atom.rs b/components/util/atom.rs deleted file mode 100644 index 49cb047768e..00000000000 --- a/components/util/atom.rs +++ /dev/null @@ -1,43 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//! Provides a wrapper around the Atom type in the string cache -//! crate. It's needed so that it can implement the Encodable -//! trait which is required by Servo. - -use serialize::{Encoder, Encodable}; -use std::fmt; -use std::hash::Hash; -use string_cache::atom; - -#[deriving(Clone, Eq, Hash, PartialEq)] -pub struct Atom { - atom: atom::Atom, -} - -impl Atom { - #[inline(always)] - pub fn from_slice(slice: &str) -> Atom { - Atom { - atom: atom::Atom::from_slice(slice) - } - } - - #[inline(always)] - pub fn as_slice<'t>(&'t self) -> &'t str { - self.atom.as_slice() - } -} - -impl fmt::Show for Atom { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{:s}", self.atom.as_slice()) - } -} - -impl<E, S: Encoder<E>> Encodable<S, E> for Atom { - fn encode(&self, _s: &mut S) -> Result<(), E> { - Ok(()) - } -} diff --git a/components/util/lib.rs b/components/util/lib.rs index 89fcec41d93..4de1cff459c 100644 --- a/components/util/lib.rs +++ b/components/util/lib.rs @@ -29,7 +29,9 @@ extern crate "time" as std_time; extern crate string_cache; extern crate url; -pub mod atom; +#[phase(plugin)] +extern crate string_cache_macros; + pub mod bloom; pub mod cache; pub mod debug_utils; diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index 05ea9503ff3..43b235e892a 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -299,6 +299,8 @@ dependencies = [ "plugins 0.0.1", "script 0.0.1", "script_traits 0.0.1", + "string_cache 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)", + "string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)", "style 0.0.1", "url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)", "util 0.0.1", @@ -409,6 +411,8 @@ dependencies = [ "net 0.0.1", "plugins 0.0.1", "script_traits 0.0.1", + "string_cache 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)", + "string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)", "style 0.0.1", "url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)", "util 0.0.1", @@ -486,6 +490,8 @@ dependencies = [ "geom 0.1.0 (git+https://github.com/servo/rust-geom#90add8d65273c8a46aa16d73959e29a51d0c282d)", "lazy_static 0.1.0 (git+https://github.com/Kimundi/lazy-static.rs#e62a65372f1dd9019e37eb9381d819edff80e360)", "plugins 0.0.1", + "string_cache 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)", + "string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)", "url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)", "util 0.0.1", ] @@ -509,6 +515,7 @@ dependencies = [ "azure 0.1.0 (git+https://github.com/servo/rust-azure#b357751c04a89a87e6ef1f0cebe5f20957dd112d)", "geom 0.1.0 (git+https://github.com/servo/rust-geom#90add8d65273c8a46aa16d73959e29a51d0c282d)", "string_cache 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)", + "string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)", "task_info 0.0.1", "url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)", ] |