Add string_cache override for geckolib based on gecko atoms.

The work in these patches is based on Ms2ger's gecko-atom crate.
This commit is contained in:
Bobby Holley 2016-05-11 11:43:54 -07:00
parent 825f610dec
commit b521c293dc
25 changed files with 5153 additions and 185 deletions

View file

@ -133,11 +133,11 @@ struct FontCache {
fn populate_generic_fonts() -> HashMap<FontFamily, LowercaseString> { fn populate_generic_fonts() -> HashMap<FontFamily, LowercaseString> {
let mut generic_fonts = HashMap::with_capacity(5); let mut generic_fonts = HashMap::with_capacity(5);
append_map(&mut generic_fonts, FontFamily::Serif, "Times New Roman"); append_map(&mut generic_fonts, FontFamily::Generic(atom!("serif")), "Times New Roman");
append_map(&mut generic_fonts, FontFamily::SansSerif, SANS_SERIF_FONT_FAMILY); append_map(&mut generic_fonts, FontFamily::Generic(atom!("sans-serif")), SANS_SERIF_FONT_FAMILY);
append_map(&mut generic_fonts, FontFamily::Cursive, "Apple Chancery"); append_map(&mut generic_fonts, FontFamily::Generic(atom!("cursive")), "Apple Chancery");
append_map(&mut generic_fonts, FontFamily::Fantasy, "Papyrus"); append_map(&mut generic_fonts, FontFamily::Generic(atom!("fantasy")), "Papyrus");
append_map(&mut generic_fonts, FontFamily::Monospace, "Menlo"); append_map(&mut generic_fonts, FontFamily::Generic(atom!("monospace")), "Menlo");
fn append_map(generic_fonts: &mut HashMap<FontFamily, LowercaseString>, fn append_map(generic_fonts: &mut HashMap<FontFamily, LowercaseString>,
font_family: FontFamily, font_family: FontFamily,

View file

@ -72,6 +72,7 @@ extern crate simd;
extern crate skia; extern crate skia;
extern crate smallvec; extern crate smallvec;
#[macro_use]
extern crate string_cache; extern crate string_cache;
extern crate style; extern crate style;
extern crate style_traits; extern crate style_traits;

View file

@ -32,7 +32,7 @@ range = {path = "../range"}
rustc-serialize = "0.3" rustc-serialize = "0.3"
script = {path = "../script"} script = {path = "../script"}
script_traits = {path = "../script_traits"} script_traits = {path = "../script_traits"}
selectors = {version = "0.5.1", features = ["heap_size"]} selectors = {version = "0.6", features = ["heap_size"]}
serde_json = "0.7" serde_json = "0.7"
serde_macros = "0.7" serde_macros = "0.7"
smallvec = "0.1" smallvec = "0.1"

View file

@ -62,7 +62,7 @@ use std::cell::{Ref, RefCell, RefMut};
use std::marker::PhantomData; use std::marker::PhantomData;
use std::mem::{transmute, transmute_copy}; use std::mem::{transmute, transmute_copy};
use std::sync::Arc; use std::sync::Arc;
use string_cache::{Atom, Namespace}; use string_cache::{Atom, BorrowedAtom, BorrowedNamespace, Namespace};
use style::computed_values::content::ContentItem; use style::computed_values::content::ContentItem;
use style::computed_values::{content, display}; use style::computed_values::{content, display};
use style::dom::{PresentationalHintsSynthetizer, TDocument, TElement, TNode, UnsafeNode}; use style::dom::{PresentationalHintsSynthetizer, TDocument, TElement, TNode, UnsafeNode};
@ -519,13 +519,13 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
} }
#[inline] #[inline]
fn get_local_name(&self) -> &Atom { fn get_local_name<'a>(&'a self) -> BorrowedAtom<'a> {
self.element.local_name() BorrowedAtom(self.element.local_name())
} }
#[inline] #[inline]
fn get_namespace(&self) -> &Namespace { fn get_namespace<'a>(&'a self) -> BorrowedNamespace<'a> {
self.element.namespace() BorrowedNamespace(self.element.namespace())
} }
fn match_non_ts_pseudo_class(&self, pseudo_class: NonTSPseudoClass) -> bool { fn match_non_ts_pseudo_class(&self, pseudo_class: NonTSPseudoClass) -> bool {
@ -737,8 +737,8 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Sized + PartialEq {
#[inline] #[inline]
fn get_details_summary_pseudo(&self) -> Option<Self> { fn get_details_summary_pseudo(&self) -> Option<Self> {
if self.is_element() && if self.is_element() &&
self.as_element().get_local_name() == &atom!("details") && self.as_element().get_local_name() == atom!("details") &&
self.as_element().get_namespace() == &ns!(html) { self.as_element().get_namespace() == ns!(html) {
Some(self.with_pseudo(PseudoElementType::DetailsSummary(None))) Some(self.with_pseudo(PseudoElementType::DetailsSummary(None)))
} else { } else {
None None
@ -748,8 +748,8 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Sized + PartialEq {
#[inline] #[inline]
fn get_details_content_pseudo(&self) -> Option<Self> { fn get_details_content_pseudo(&self) -> Option<Self> {
if self.is_element() && if self.is_element() &&
self.as_element().get_local_name() == &atom!("details") && self.as_element().get_local_name() == atom!("details") &&
self.as_element().get_namespace() == &ns!(html) { self.as_element().get_namespace() == ns!(html) {
let display = if self.as_element().get_attr(&ns!(), &atom!("open")).is_some() { let display = if self.as_element().get_attr(&ns!(), &atom!("open")).is_some() {
None // Specified by the stylesheet None // Specified by the stylesheet
} else { } else {
@ -958,10 +958,10 @@ pub trait ThreadSafeLayoutElement: Clone + Copy + Sized +
fn get_attr(&self, namespace: &Namespace, name: &Atom) -> Option<&str>; fn get_attr(&self, namespace: &Namespace, name: &Atom) -> Option<&str>;
#[inline] #[inline]
fn get_local_name(&self) -> &Atom; fn get_local_name<'a>(&'a self) -> BorrowedAtom<'a>;
#[inline] #[inline]
fn get_namespace(&self) -> &Namespace; fn get_namespace<'a>(&'a self) -> BorrowedNamespace<'a>;
} }
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
@ -1222,8 +1222,8 @@ impl<ConcreteNode> Iterator for ThreadSafeLayoutNodeChildrenIterator<ConcreteNod
loop { loop {
let next_node = if let Some(ref node) = current_node { let next_node = if let Some(ref node) = current_node {
if node.is_element() && if node.is_element() &&
node.as_element().get_local_name() == &atom!("summary") && node.as_element().get_local_name() == atom!("summary") &&
node.as_element().get_namespace() == &ns!(html) { node.as_element().get_namespace() == ns!(html) {
self.current_node = None; self.current_node = None;
return Some(node.clone()); return Some(node.clone());
} }
@ -1240,8 +1240,8 @@ impl<ConcreteNode> Iterator for ThreadSafeLayoutNodeChildrenIterator<ConcreteNod
let node = self.current_node.clone(); let node = self.current_node.clone();
let node = node.and_then(|node| { let node = node.and_then(|node| {
if node.is_element() && if node.is_element() &&
node.as_element().get_local_name() == &atom!("summary") && node.as_element().get_local_name() == atom!("summary") &&
node.as_element().get_namespace() == &ns!(html) { node.as_element().get_namespace() == ns!(html) {
unsafe { node.dangerous_next_sibling() } unsafe { node.dangerous_next_sibling() }
} else { } else {
Some(node) Some(node)
@ -1301,13 +1301,13 @@ impl<'le> ThreadSafeLayoutElement for ServoThreadSafeLayoutElement<'le> {
} }
#[inline] #[inline]
fn get_local_name(&self) -> &Atom { fn get_local_name<'a>(&'a self) -> BorrowedAtom<'a> {
self.element.local_name() BorrowedAtom(self.element.local_name())
} }
#[inline] #[inline]
fn get_namespace(&self) -> &Namespace { fn get_namespace<'a>(&'a self) -> BorrowedNamespace<'a> {
self.element.namespace() BorrowedNamespace(self.element.namespace())
} }
} }
@ -1374,12 +1374,12 @@ impl <'le> ::selectors::Element for ServoThreadSafeLayoutElement<'le> {
} }
#[inline] #[inline]
fn get_local_name(&self) -> &Atom { fn get_local_name<'a>(&'a self) -> BorrowedAtom<'a> {
ThreadSafeLayoutElement::get_local_name(self) ThreadSafeLayoutElement::get_local_name(self)
} }
#[inline] #[inline]
fn get_namespace(&self) -> &Namespace { fn get_namespace<'a>(&'a self) -> BorrowedNamespace<'a> {
ThreadSafeLayoutElement::get_namespace(self) ThreadSafeLayoutElement::get_namespace(self)
} }

View file

@ -53,7 +53,7 @@ ref_slice = "1.0"
regex = "0.1.43" regex = "0.1.43"
rustc-serialize = "0.3" rustc-serialize = "0.3"
script_traits = {path = "../script_traits"} script_traits = {path = "../script_traits"}
selectors = {version = "0.5", features = ["heap_size"]} selectors = {version = "0.6", features = ["heap_size"]}
serde = "0.7" serde = "0.7"
smallvec = "0.1" smallvec = "0.1"
string_cache = {version = "0.2.12", features = ["heap_size", "unstable"]} string_cache = {version = "0.2.12", features = ["heap_size", "unstable"]}

View file

@ -83,7 +83,7 @@ use std::default::Default;
use std::mem; use std::mem;
use std::sync::Arc; use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::atomic::{AtomicUsize, Ordering};
use string_cache::{Atom, Namespace, QualName}; use string_cache::{Atom, BorrowedAtom, BorrowedNamespace, Namespace, QualName};
use style::element_state::*; use style::element_state::*;
use style::properties::DeclaredValue; use style::properties::DeclaredValue;
use style::properties::longhands::{self, background_image, border_spacing, font_family, overflow_x, font_size}; use style::properties::longhands::{self, background_image, border_spacing, font_family, overflow_x, font_size};
@ -2131,12 +2131,12 @@ impl<'a> ::selectors::Element for Root<Element> {
}) })
} }
fn get_local_name(&self) -> &Atom { fn get_local_name(&self) -> BorrowedAtom {
self.local_name() BorrowedAtom(self.local_name())
} }
fn get_namespace(&self) -> &Namespace { fn get_namespace(&self) -> BorrowedNamespace {
self.namespace() BorrowedNamespace(self.namespace())
} }
fn match_non_ts_pseudo_class(&self, pseudo_class: NonTSPseudoClass) -> bool { fn match_non_ts_pseudo_class(&self, pseudo_class: NonTSPseudoClass) -> bool {

View file

@ -745,7 +745,7 @@ dependencies = [
"servo-skia 0.20130412.9 (registry+https://github.com/rust-lang/crates.io-index)", "servo-skia 0.20130412.9 (registry+https://github.com/rust-lang/crates.io-index)",
"simd 0.1.0 (git+https://github.com/huonw/simd)", "simd 0.1.0 (git+https://github.com/huonw/simd)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -920,7 +920,7 @@ dependencies = [
"phf 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1114,11 +1114,11 @@ dependencies = [
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"script 0.0.1", "script 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1852,10 +1852,10 @@ dependencies = [
"regex 0.1.69 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.1.69 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"tinyfiledialogs 0.1.0 (git+https://github.com/jdm/tinyfiledialogs)", "tinyfiledialogs 0.1.0 (git+https://github.com/jdm/tinyfiledialogs)",
@ -1907,7 +1907,7 @@ dependencies = [
[[package]] [[package]]
name = "selectors" name = "selectors"
version = "0.5.9" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1918,7 +1918,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "quickersort 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -2080,7 +2080,7 @@ dependencies = [
[[package]] [[package]]
name = "string_cache" name = "string_cache"
version = "0.2.15" version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2110,11 +2110,11 @@ dependencies = [
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1", "style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2130,8 +2130,8 @@ dependencies = [
"cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2346,7 +2346,7 @@ dependencies = [
"serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2577,7 +2577,7 @@ dependencies = [
"phf 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
] ]

View file

@ -28,7 +28,7 @@ matches = "0.1"
num-traits = "0.1.32" num-traits = "0.1.32"
plugins = {path = "../plugins"} plugins = {path = "../plugins"}
rustc-serialize = "0.3" rustc-serialize = "0.3"
selectors = {version = "0.5", features = ["heap_size", "unstable"]} selectors = {version = "0.6", features = ["heap_size", "unstable"]}
serde = {version = "0.7", features = ["nightly"]} serde = {version = "0.7", features = ["nightly"]}
serde_macros = "0.7" serde_macros = "0.7"
smallvec = "0.1" smallvec = "0.1"

View file

@ -7,12 +7,11 @@ use cssparser::{self, Color, RGBA};
use euclid::num::Zero; use euclid::num::Zero;
use num_traits::ToPrimitive; use num_traits::ToPrimitive;
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use std::ops::Deref;
use std::str::FromStr; use std::str::FromStr;
use string_cache::{Atom, Namespace}; use string_cache::{Atom, Namespace};
use url::Url; use url::Url;
use util::str::{DOMString, LengthOrPercentageOrAuto, HTML_SPACE_CHARACTERS}; use util::str::{DOMString, LengthOrPercentageOrAuto, HTML_SPACE_CHARACTERS};
use util::str::{read_exponent, read_fraction, read_numbers, split_html_space_chars, str_join}; use util::str::{read_exponent, read_fraction, read_numbers, split_html_space_chars};
use values::specified::{Length}; use values::specified::{Length};
// Duplicated from script::dom::values. // Duplicated from script::dom::values.
@ -125,7 +124,9 @@ impl AttrValue {
AttrValue::TokenList(tokens, atoms) AttrValue::TokenList(tokens, atoms)
} }
#[cfg(not(feature = "gecko"))] // Gecko can't borrow atoms as UTF-8.
pub fn from_atomic_tokens(atoms: Vec<Atom>) -> AttrValue { pub fn from_atomic_tokens(atoms: Vec<Atom>) -> AttrValue {
use util::str::str_join;
// TODO(ajeffrey): effecient conversion of Vec<Atom> to DOMString // TODO(ajeffrey): effecient conversion of Vec<Atom> to DOMString
let tokens = DOMString::from(str_join(&atoms, "\x20")); let tokens = DOMString::from(str_join(&atoms, "\x20"));
AttrValue::TokenList(tokens, atoms) AttrValue::TokenList(tokens, atoms)
@ -293,7 +294,8 @@ impl AttrValue {
} }
} }
impl Deref for AttrValue { #[cfg(not(feature = "gecko"))] // Gecko can't borrow atoms as UTF-8.
impl ::std::ops::Deref for AttrValue {
type Target = str; type Target = str;
fn deref(&self) -> &str { fn deref(&self) -> &str {

View file

@ -616,8 +616,8 @@ pub trait MatchMethods : TNode {
fn insert_into_bloom_filter(&self, bf: &mut BloomFilter) { fn insert_into_bloom_filter(&self, bf: &mut BloomFilter) {
// Only elements are interesting. // Only elements are interesting.
if let Some(element) = self.as_element() { if let Some(element) = self.as_element() {
bf.insert(element.get_local_name()); bf.insert(&*element.get_local_name());
bf.insert(element.get_namespace()); bf.insert(&*element.get_namespace());
element.get_id().map(|id| bf.insert(&id)); element.get_id().map(|id| bf.insert(&id));
// TODO: case-sensitivity depends on the document type and quirks mode // TODO: case-sensitivity depends on the document type and quirks mode
@ -630,8 +630,8 @@ pub trait MatchMethods : TNode {
fn remove_from_bloom_filter(&self, bf: &mut BloomFilter) { fn remove_from_bloom_filter(&self, bf: &mut BloomFilter) {
// Only elements are interesting. // Only elements are interesting.
if let Some(element) = self.as_element() { if let Some(element) = self.as_element() {
bf.remove(element.get_local_name()); bf.remove(&*element.get_local_name());
bf.remove(element.get_namespace()); bf.remove(&*element.get_namespace());
element.get_id().map(|id| bf.remove(&id)); element.get_id().map(|id| bf.remove(&id));
// TODO: case-sensitivity depends on the document type and quirks mode // TODO: case-sensitivity depends on the document type and quirks mode

View file

@ -13,12 +13,6 @@
use values::computed::ComputedValueAsSpecified; use values::computed::ComputedValueAsSpecified;
pub use self::computed_value::T as SpecifiedValue; pub use self::computed_value::T as SpecifiedValue;
const SERIF: &'static str = "serif";
const SANS_SERIF: &'static str = "sans-serif";
const CURSIVE: &'static str = "cursive";
const FANTASY: &'static str = "fantasy";
const MONOSPACE: &'static str = "monospace";
impl ComputedValueAsSpecified for SpecifiedValue {} impl ComputedValueAsSpecified for SpecifiedValue {}
pub mod computed_value { pub mod computed_value {
use cssparser::ToCss; use cssparser::ToCss;
@ -28,45 +22,44 @@
#[derive(Debug, PartialEq, Eq, Clone, Hash, HeapSizeOf, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Hash, HeapSizeOf, Deserialize, Serialize)]
pub enum FontFamily { pub enum FontFamily {
FamilyName(Atom), FamilyName(Atom),
// Generic, Generic(Atom),
Serif,
SansSerif,
Cursive,
Fantasy,
Monospace,
} }
impl FontFamily { impl FontFamily {
#[inline] #[inline]
pub fn name(&self) -> &str { pub fn atom(&self) -> &Atom {
match *self { match *self {
FontFamily::FamilyName(ref name) => &*name, FontFamily::FamilyName(ref name) => name,
FontFamily::Serif => super::SERIF, FontFamily::Generic(ref name) => name,
FontFamily::SansSerif => super::SANS_SERIF,
FontFamily::Cursive => super::CURSIVE,
FontFamily::Fantasy => super::FANTASY,
FontFamily::Monospace => super::MONOSPACE
} }
} }
#[inline]
#[cfg(not(feature = "gecko"))] // Gecko can't borrow atoms as UTF-8.
pub fn name(&self) -> &str {
self.atom()
}
#[cfg(not(feature = "gecko"))] // Gecko can't borrow atoms as UTF-8.
pub fn from_atom(input: Atom) -> FontFamily { pub fn from_atom(input: Atom) -> FontFamily {
let option = match_ignore_ascii_case! { &input, let option = match_ignore_ascii_case! { &input,
super::SERIF => Some(FontFamily::Serif), &atom!("serif") => Some(atom!("serif")),
super::SANS_SERIF => Some(FontFamily::SansSerif), &atom!("sans-serif") => Some(atom!("sans-serif")),
super::CURSIVE => Some(FontFamily::Cursive), &atom!("cursive") => Some(atom!("cursive")),
super::FANTASY => Some(FontFamily::Fantasy), &atom!("fantasy") => Some(atom!("fantasy")),
super::MONOSPACE => Some(FontFamily::Monospace), &atom!("monospace") => Some(atom!("monospace")),
_ => None _ => None
}; };
match option { match option {
Some(family) => family, Some(family) => FontFamily::Generic(family),
None => FontFamily::FamilyName(input) None => FontFamily::FamilyName(input)
} }
} }
} }
impl ToCss for FontFamily { impl ToCss for FontFamily {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
dest.write_str(self.name()) self.atom().with_str(|s| dest.write_str(s))
} }
} }
impl ToCss for T { impl ToCss for T {
@ -86,7 +79,7 @@
#[inline] #[inline]
pub fn get_initial_value() -> computed_value::T { pub fn get_initial_value() -> computed_value::T {
computed_value::T(vec![FontFamily::Serif]) computed_value::T(vec![FontFamily::Generic(atom!("serif"))])
} }
/// <family-name># /// <family-name>#
/// <family-name> = <string> | [ <ident>+ ] /// <family-name> = <string> | [ <ident>+ ]
@ -100,14 +93,18 @@
} }
let first_ident = try!(input.expect_ident()); let first_ident = try!(input.expect_ident());
match_ignore_ascii_case! { first_ident, // FIXME(bholley): The fast thing to do here would be to look up the
SERIF => return Ok(FontFamily::Serif), // string (as lowercase) in the static atoms table. We don't have an
SANS_SERIF => return Ok(FontFamily::SansSerif), // API to do that yet though, so we do the simple thing for now.
CURSIVE => return Ok(FontFamily::Cursive), match &first_ident[..] {
FANTASY => return Ok(FontFamily::Fantasy), s if atom!("serif").eq_str_ignore_ascii_case(s) => return Ok(FontFamily::Generic(atom!("serif"))),
MONOSPACE => return Ok(FontFamily::Monospace), s if atom!("sans-serif").eq_str_ignore_ascii_case(s) => return Ok(FontFamily::Generic(atom!("sans-serif"))),
s if atom!("cursive").eq_str_ignore_ascii_case(s) => return Ok(FontFamily::Generic(atom!("cursive"))),
s if atom!("fantasy").eq_str_ignore_ascii_case(s) => return Ok(FontFamily::Generic(atom!("fantasy"))),
s if atom!("monospace").eq_str_ignore_ascii_case(s) => return Ok(FontFamily::Generic(atom!("monospace"))),
_ => {} _ => {}
} }
let mut value = first_ident.into_owned(); let mut value = first_ident.into_owned();
while let Ok(ident) = input.try(|input| input.expect_ident()) { while let Ok(ident) = input.try(|input| input.expect_ident()) {
value.push_str(" "); value.push_str(" ");

View file

@ -478,7 +478,7 @@ impl PartialEq<str> for PropertyDeclarationName {
match *self { match *self {
PropertyDeclarationName::Longhand(n) => n == other, PropertyDeclarationName::Longhand(n) => n == other,
PropertyDeclarationName::Custom(ref n) => { PropertyDeclarationName::Custom(ref n) => {
::custom_properties::parse_name(other) == Ok(&**n) n.with_str(|s| ::custom_properties::parse_name(other) == Ok(s))
} }
PropertyDeclarationName::Internal => false, PropertyDeclarationName::Internal => false,
} }
@ -491,7 +491,7 @@ impl fmt::Display for PropertyDeclarationName {
PropertyDeclarationName::Longhand(n) => f.write_str(n), PropertyDeclarationName::Longhand(n) => f.write_str(n),
PropertyDeclarationName::Custom(ref n) => { PropertyDeclarationName::Custom(ref n) => {
try!(f.write_str("--")); try!(f.write_str("--"));
f.write_str(n) n.with_str(|s| f.write_str(s))
} }
PropertyDeclarationName::Internal => Ok(()), PropertyDeclarationName::Internal => Ok(()),
} }
@ -575,7 +575,7 @@ impl PropertyDeclaration {
% endif % endif
% endfor % endfor
PropertyDeclaration::Custom(ref declaration_name, _) => { PropertyDeclaration::Custom(ref declaration_name, _) => {
::custom_properties::parse_name(name) == Ok(&**declaration_name) declaration_name.with_str(|s| ::custom_properties::parse_name(name) == Ok(s))
} }
} }
} }

View file

@ -7,10 +7,10 @@ use element_state::*;
use selector_impl::SelectorImplExt; use selector_impl::SelectorImplExt;
use selectors::Element; use selectors::Element;
use selectors::matching::matches_compound_selector; use selectors::matching::matches_compound_selector;
use selectors::parser::{AttrSelector, Combinator, CompoundSelector, NamespaceConstraint, SelectorImpl, SimpleSelector}; use selectors::parser::{AttrSelector, Combinator, CompoundSelector, SelectorImpl, SimpleSelector};
use std::clone::Clone; use std::clone::Clone;
use std::sync::Arc; use std::sync::Arc;
use string_cache::{Atom, Namespace}; use string_cache::{Atom, BorrowedAtom, BorrowedNamespace, Namespace};
/// When the ElementState of an element (like IN_HOVER_STATE) changes, certain /// When the ElementState of an element (like IN_HOVER_STATE) changes, certain
/// pseudo-classes (like :hover) may require us to restyle that element, its /// pseudo-classes (like :hover) may require us to restyle that element, its
@ -133,10 +133,10 @@ impl<'a, E> Element for ElementWrapper<'a, E>
fn is_html_element_in_html_document(&self) -> bool { fn is_html_element_in_html_document(&self) -> bool {
self.element.is_html_element_in_html_document() self.element.is_html_element_in_html_document()
} }
fn get_local_name(&self) -> &Atom { fn get_local_name(&self) -> BorrowedAtom {
self.element.get_local_name() self.element.get_local_name()
} }
fn get_namespace(&self) -> &Namespace { fn get_namespace(&self) -> BorrowedNamespace {
self.element.get_namespace() self.element.get_namespace()
} }
fn get_id(&self) -> Option<Atom> { fn get_id(&self) -> Option<Atom> {
@ -152,8 +152,15 @@ impl<'a, E> Element for ElementWrapper<'a, E>
None => self.element.has_class(name), None => self.element.has_class(name),
} }
} }
#[cfg(feature = "gecko")]
fn match_attr<F>(&self, _: &AttrSelector, _: F) -> bool
where F: Fn(&str) -> bool {
panic!("Gecko can't borrow atoms as UTF-8.");
}
#[cfg(not(feature = "gecko"))]
fn match_attr<F>(&self, attr: &AttrSelector, test: F) -> bool fn match_attr<F>(&self, attr: &AttrSelector, test: F) -> bool
where F: Fn(&str) -> bool { where F: Fn(&str) -> bool {
use selectors::parser::NamespaceConstraint;
match self.snapshot.attrs { match self.snapshot.attrs {
Some(_) => { Some(_) => {
let html = self.is_html_element_in_html_document(); let html = self.is_html_element_in_html_document();

26
ports/cef/Cargo.lock generated
View file

@ -667,7 +667,7 @@ dependencies = [
"servo-skia 0.20130412.9 (registry+https://github.com/rust-lang/crates.io-index)", "servo-skia 0.20130412.9 (registry+https://github.com/rust-lang/crates.io-index)",
"simd 0.1.0 (git+https://github.com/huonw/simd)", "simd 0.1.0 (git+https://github.com/huonw/simd)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -833,7 +833,7 @@ dependencies = [
"phf 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1027,11 +1027,11 @@ dependencies = [
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"script 0.0.1", "script 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1712,10 +1712,10 @@ dependencies = [
"regex 0.1.69 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.1.69 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"tinyfiledialogs 0.1.0 (git+https://github.com/jdm/tinyfiledialogs)", "tinyfiledialogs 0.1.0 (git+https://github.com/jdm/tinyfiledialogs)",
@ -1756,7 +1756,7 @@ dependencies = [
[[package]] [[package]]
name = "selectors" name = "selectors"
version = "0.5.9" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1767,7 +1767,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "quickersort 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1965,7 +1965,7 @@ dependencies = [
[[package]] [[package]]
name = "string_cache" name = "string_cache"
version = "0.2.15" version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1995,11 +1995,11 @@ dependencies = [
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1", "style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2215,7 +2215,7 @@ dependencies = [
"serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2439,7 +2439,7 @@ dependencies = [
"phf 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
] ]

View file

@ -14,9 +14,9 @@ dependencies = [
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"selectors 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1", "util 0.0.1",
@ -118,14 +118,6 @@ dependencies = [
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "debug_unreachable"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "deque" name = "deque"
version = "0.3.1" version = "0.3.1"
@ -324,20 +316,6 @@ dependencies = [
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "phf_generator"
version = "0.7.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"phf_shared 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "phf_shared"
version = "0.7.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "plugins" name = "plugins"
version = "0.0.1" version = "0.0.1"
@ -407,7 +385,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "selectors" name = "selectors"
version = "0.5.9" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -418,7 +396,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "quickersort 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -451,18 +429,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "string_cache" name = "string_cache"
version = "0.2.15" version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "gecko_bindings 0.0.1",
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_generator 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "string_cache"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
replace = "string_cache 0.2.16"
[[package]] [[package]]
name = "style" name = "style"
version = "0.0.1" version = "0.0.1"
@ -481,11 +461,11 @@ dependencies = [
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1", "style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -603,7 +583,7 @@ dependencies = [
"serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]

View file

@ -20,12 +20,15 @@ heapsize_plugin = "0.1.2"
lazy_static = "0.2" lazy_static = "0.2"
libc = "0.2" libc = "0.2"
num_cpus = "0.2.2" num_cpus = "0.2.2"
selectors = "0.5" selectors = "0.6"
smallvec = "0.1" smallvec = "0.1"
string_cache = "0.2.12" string_cache = "0.2.16"
url = "1.0.0" url = "1.0.0"
log = {version = "0.3.5", features = ["release_max_level_info"]} log = {version = "0.3.5", features = ["release_max_level_info"]}
plugins = {path = "../../components/plugins"} plugins = {path = "../../components/plugins"}
util = {path = "../../components/util"} util = {path = "../../components/util"}
style = {path = "../../components/style", features = ["gecko"]} style = {path = "../../components/style", features = ["gecko"]}
env_logger = "0.3" env_logger = "0.3"
[replace]
"string_cache:0.2.16" = {path = "string_cache"}

View file

@ -198,14 +198,12 @@ extern "C" {
pub fn Servo_Initialize(); pub fn Servo_Initialize();
pub fn Servo_RestyleDocument(doc: *mut RawGeckoDocument, pub fn Servo_RestyleDocument(doc: *mut RawGeckoDocument,
set: *mut RawServoStyleSet); set: *mut RawServoStyleSet);
pub fn Gecko_GetAttrAsUTF8(element: *mut RawGeckoElement, ns: *const u8, pub fn Gecko_GetAttrAsUTF8(element: *mut RawGeckoElement,
nslen: u32, name: *const u8, namelen: u32, ns: *mut nsIAtom, name: *mut nsIAtom,
length: *mut u32) length: *mut u32)
-> *const ::std::os::raw::c_char; -> *const ::std::os::raw::c_char;
pub fn Gecko_LocalName(element: *mut RawGeckoElement, length: *mut u32) pub fn Gecko_LocalName(element: *mut RawGeckoElement) -> *mut nsIAtom;
-> *const u16; pub fn Gecko_Namespace(element: *mut RawGeckoElement) -> *mut nsIAtom;
pub fn Gecko_Namespace(element: *mut RawGeckoElement, length: *mut u32)
-> *const u16;
pub fn Gecko_Construct_nsStyleFont(ptr: *mut nsStyleFont); pub fn Gecko_Construct_nsStyleFont(ptr: *mut nsStyleFont);
pub fn Gecko_CopyConstruct_nsStyleFont(ptr: *mut nsStyleFont, pub fn Gecko_CopyConstruct_nsStyleFont(ptr: *mut nsStyleFont,
other: *const nsStyleFont); other: *const nsStyleFont);

View file

@ -0,0 +1,21 @@
[package]
name = "string_cache"
description = "A crate to allow using Gecko's nsIAtom as a replacement for string_cache."
version = "0.2.16"
authors = ["The Servo Project Developers"]
publish = false
[lib]
name = "string_cache"
path = "lib.rs"
[features]
log-events = []
unstable = []
heap_size = []
[dependencies]
heapsize = "0.3.5"
libc = "0.2"
gecko_bindings = {version = "0.0.1", path = "../gecko_bindings"}
serde = "0.7"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,228 @@
/* 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/. */
extern crate gecko_bindings;
extern crate heapsize;
extern crate serde;
use gecko_bindings::bindings::Gecko_AddRefAtom;
use gecko_bindings::bindings::Gecko_AtomEqualsUTF8IgnoreCase;
use gecko_bindings::bindings::Gecko_Atomize;
use gecko_bindings::bindings::Gecko_GetAtomAsUTF16;
use gecko_bindings::bindings::Gecko_HashAtom;
use gecko_bindings::bindings::Gecko_ReleaseAtom;
use gecko_bindings::bindings::nsIAtom;
use heapsize::HeapSizeOf;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::borrow::Cow;
use std::fmt;
use std::hash::{Hash, Hasher};
use std::marker::PhantomData;
use std::mem::transmute;
use std::ops::Deref;
use std::slice;
#[macro_use]
pub mod atom_macro;
#[macro_export]
macro_rules! ns {
() => { $crate::Namespace(atom!("")) };
}
#[derive(PartialEq, Eq)]
pub struct Atom(*mut nsIAtom);
#[derive(PartialEq, Eq, Debug, Hash, Clone)]
pub struct Namespace(pub Atom);
pub struct BorrowedAtom<'a> {
weak_ptr: *mut nsIAtom,
chain: PhantomData<&'a ()>,
}
impl<'a> BorrowedAtom<'a> {
pub unsafe fn new(atom: *mut nsIAtom) -> Self {
BorrowedAtom {
weak_ptr: atom,
chain: PhantomData,
}
}
}
impl<'a> Deref for BorrowedAtom<'a> {
type Target = Atom;
fn deref(&self) -> &Atom {
unsafe {
transmute(self)
}
}
}
impl<'a> PartialEq<Atom> for BorrowedAtom<'a> {
fn eq(&self, other: &Atom) -> bool {
self.weak_ptr == other.as_ptr()
}
}
pub struct BorrowedNamespace<'a> {
weak_ptr: *mut nsIAtom,
chain: PhantomData<&'a ()>,
}
impl<'a> BorrowedNamespace<'a> {
pub unsafe fn new(atom: *mut nsIAtom) -> Self {
BorrowedNamespace {
weak_ptr: atom,
chain: PhantomData,
}
}
}
impl<'a> Deref for BorrowedNamespace<'a> {
type Target = Namespace;
fn deref(&self) -> &Namespace {
unsafe {
transmute(self)
}
}
}
impl<'a> PartialEq<Namespace> for BorrowedNamespace<'a> {
fn eq(&self, other: &Namespace) -> bool {
self.weak_ptr == other.0.as_ptr()
}
}
unsafe impl Send for Atom {}
unsafe impl Sync for Atom {}
impl Atom {
pub fn get_hash(&self) -> u32 {
unsafe {
Gecko_HashAtom(self.0)
}
}
pub fn as_slice(&self) -> &[u16] {
unsafe {
let mut len = 0;
let ptr = Gecko_GetAtomAsUTF16(self.0, &mut len);
slice::from_raw_parts(ptr, len as usize)
}
}
pub fn with_str<F, Output>(&self, cb: F) -> Output
where F: FnOnce(&str) -> Output {
// FIXME(bholley): We should measure whether it makes more sense to
// cache the UTF-8 version in the Gecko atom table somehow.
let owned = String::from_utf16(self.as_slice()).unwrap();
cb(&owned)
}
pub fn eq_str_ignore_ascii_case(&self, s: &str) -> bool {
unsafe {
Gecko_AtomEqualsUTF8IgnoreCase(self.0, s.as_ptr() as *const _, s.len() as u32)
}
}
pub fn to_string(&self) -> String {
String::from_utf16(self.as_slice()).unwrap()
}
pub fn as_ptr(&self) -> *mut nsIAtom {
self.0
}
// Static atoms have a dummy AddRef/Release, so we don't bother calling
// AddRef() here. This would cause memory corruption with non-static atoms
// both because (a) we wouldn't hold the atom alive, and (b) we can't avoid
// calling Release() when the Atom is dropped, since we can't tell the
// difference between static and non-static atoms without bloating the
// size of Atom beyond word-size.
pub unsafe fn from_static(ptr: *mut nsIAtom) -> Atom {
Atom(ptr)
}
}
impl Hash for Atom {
fn hash<H>(&self, state: &mut H)
where H: Hasher
{
state.write_u32(self.get_hash());
}
}
impl Clone for Atom {
#[inline(always)]
fn clone(&self) -> Atom {
unsafe {
Gecko_AddRefAtom(self.0);
}
Atom(self.0)
}
}
impl Drop for Atom {
#[inline]
fn drop(&mut self) {
unsafe {
Gecko_ReleaseAtom(self.0);
}
}
}
impl HeapSizeOf for Atom {
fn heap_size_of_children(&self) -> usize {
0
}
}
impl HeapSizeOf for Namespace {
fn heap_size_of_children(&self) -> usize {
0
}
}
impl Serialize for Atom {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer {
self.with_str(|s| s.serialize(serializer))
}
}
impl Deserialize for Atom {
fn deserialize<D>(deserializer: &mut D) -> Result<Atom, D::Error> where D: Deserializer {
let string: String = try!(Deserialize::deserialize(deserializer));
Ok(Atom::from(&*string))
}
}
impl fmt::Debug for Atom {
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
write!(w, "Gecko Atom {:p}", self.0)
}
}
impl<'a> From<&'a str> for Atom {
#[inline]
fn from(string: &str) -> Atom {
assert!(string.len() <= u32::max_value() as usize);
Atom(unsafe {
Gecko_Atomize(string.as_ptr() as *const _, string.len() as u32)
})
}
}
impl<'a> From<Cow<'a, str>> for Atom {
#[inline]
fn from(string: Cow<'a, str>) -> Atom {
Atom::from(&*string)
}
}
impl From<String> for Atom {
#[inline]
fn from(string: String) -> Atom {
Atom::from(&*string)
}
}

View file

@ -0,0 +1,36 @@
# 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/.
import re
import sys
if len(sys.argv) != 2:
print "usage: ./%s PATH/TO/OBJDIR" % sys.argv[0]
objdir_path = sys.argv[1]
def line_to_atom(line):
result = re.match('^GK_ATOM\((.+),\s*"(.*)"\)', line)
return (result.group(1), result.group(2))
def symbolify(ident):
return "_ZN9nsGkAtoms" + str(len(ident)) + ident + "E"
with open(objdir_path + "/dist/include/nsGkAtomList.h") as f:
lines = [line for line in f.readlines() if line.startswith("GK_ATOM")]
atoms = [line_to_atom(line) for line in lines]
with open("atom_macro.rs", "w") as f:
f.write("use gecko_bindings::bindings::nsIAtom;\n\n")
f.write("use Atom;\n\n")
f.write("pub fn unsafe_atom_from_static(ptr: *mut nsIAtom) -> Atom { unsafe { Atom::from_static(ptr) } }\n\n")
for atom in atoms:
f.write('extern { pub static %s: *mut nsIAtom; }\n' % symbolify(atom[0]))
f.write("#[macro_export]\n")
f.write("macro_rules! atom {\n")
f.writelines(['("%s") => { $crate::atom_macro::unsafe_atom_from_static($crate::atom_macro::%s) };\n'
% (atom[1], symbolify(atom[0])) for atom in atoms])
f.write("}\n")

View file

@ -31,7 +31,7 @@ use std::ops::BitOr;
use std::slice; use std::slice;
use std::str::from_utf8_unchecked; use std::str::from_utf8_unchecked;
use std::sync::Arc; use std::sync::Arc;
use string_cache::{Atom, Namespace}; use string_cache::{Atom, BorrowedAtom, BorrowedNamespace, Namespace};
use style::dom::{OpaqueNode, PresentationalHintsSynthetizer}; use style::dom::{OpaqueNode, PresentationalHintsSynthetizer};
use style::dom::{TDocument, TElement, TNode, TRestyleDamage, UnsafeNode}; use style::dom::{TDocument, TElement, TNode, TRestyleDamage, UnsafeNode};
use style::element_state::ElementState; use style::element_state::ElementState;
@ -344,9 +344,8 @@ impl<'le> TElement for GeckoElement<'le> {
fn get_attr<'a>(&'a self, namespace: &Namespace, name: &Atom) -> Option<&'a str> { fn get_attr<'a>(&'a self, namespace: &Namespace, name: &Atom) -> Option<&'a str> {
unsafe { unsafe {
let mut length: u32 = 0; let mut length: u32 = 0;
let ptr = Gecko_GetAttrAsUTF8(self.element, let ptr = Gecko_GetAttrAsUTF8(self.element, namespace.0.as_ptr(), name.as_ptr(),
namespace.0.as_ptr(), namespace.0.len() as u32, &mut length);
name.as_ptr(), name.len() as u32, &mut length);
reinterpret_string(ptr, length) reinterpret_string(ptr, length)
} }
} }
@ -408,26 +407,16 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
unimplemented!() unimplemented!()
} }
fn get_local_name(&self) -> &Atom { fn get_local_name<'a>(&'a self) -> BorrowedAtom<'a> {
panic!("Requires signature modification - only implemented in stylo branch");
/*
unsafe { unsafe {
let mut length: u32 = 0; BorrowedAtom::new(Gecko_LocalName(self.element))
let p = Gecko_LocalName(self.element, &mut length);
Atom::from(String::from_utf16(slice::from_raw_parts(p, length as usize)).unwrap())
} }
*/
} }
fn get_namespace(&self) -> &Namespace { fn get_namespace<'a>(&'a self) -> BorrowedNamespace<'a> {
panic!("Requires signature modification - only implemented in stylo branch");
/*
unsafe { unsafe {
let mut length: u32 = 0; BorrowedNamespace::new(Gecko_Namespace(self.element))
let p = Gecko_Namespace(self.element, &mut length);
Namespace(Atom::from(String::from_utf16(slice::from_raw_parts(p, length as usize)).unwrap()))
} }
*/
} }
fn match_non_ts_pseudo_class(&self, pseudo_class: NonTSPseudoClass) -> bool { fn match_non_ts_pseudo_class(&self, pseudo_class: NonTSPseudoClass) -> bool {

26
ports/gonk/Cargo.lock generated
View file

@ -679,7 +679,7 @@ dependencies = [
"servo-skia 0.20130412.9 (registry+https://github.com/rust-lang/crates.io-index)", "servo-skia 0.20130412.9 (registry+https://github.com/rust-lang/crates.io-index)",
"simd 0.1.0 (git+https://github.com/huonw/simd)", "simd 0.1.0 (git+https://github.com/huonw/simd)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -825,7 +825,7 @@ dependencies = [
"phf 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1019,11 +1019,11 @@ dependencies = [
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"script 0.0.1", "script 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1704,10 +1704,10 @@ dependencies = [
"regex 0.1.69 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.1.69 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"tinyfiledialogs 0.1.0 (git+https://github.com/jdm/tinyfiledialogs)", "tinyfiledialogs 0.1.0 (git+https://github.com/jdm/tinyfiledialogs)",
@ -1748,7 +1748,7 @@ dependencies = [
[[package]] [[package]]
name = "selectors" name = "selectors"
version = "0.5.9" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1759,7 +1759,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "quickersort 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1955,7 +1955,7 @@ dependencies = [
[[package]] [[package]]
name = "string_cache" name = "string_cache"
version = "0.2.15" version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "debug_unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1985,11 +1985,11 @@ dependencies = [
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1", "style_traits 0.0.1",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2205,7 +2205,7 @@ dependencies = [
"serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2399,7 +2399,7 @@ dependencies = [
"phf 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
] ]

View file

@ -36,6 +36,7 @@ ignored_files = [
os.path.join(".", "ports", "gonk", "src", "native_window_glue.cpp"), os.path.join(".", "ports", "gonk", "src", "native_window_glue.cpp"),
os.path.join(".", "ports", "geckolib", "gecko_bindings", "bindings.rs"), os.path.join(".", "ports", "geckolib", "gecko_bindings", "bindings.rs"),
os.path.join(".", "ports", "geckolib", "gecko_bindings", "structs.rs"), os.path.join(".", "ports", "geckolib", "gecko_bindings", "structs.rs"),
os.path.join(".", "ports", "geckolib", "string_cache", "atom_macro.rs"),
os.path.join(".", "resources", "hsts_preload.json"), os.path.join(".", "resources", "hsts_preload.json"),
os.path.join(".", "tests", "wpt", "metadata", "MANIFEST.json"), os.path.join(".", "tests", "wpt", "metadata", "MANIFEST.json"),
os.path.join(".", "tests", "wpt", "metadata-css", "MANIFEST.json"), os.path.join(".", "tests", "wpt", "metadata-css", "MANIFEST.json"),

View file

@ -15,7 +15,7 @@ util = {path = "../../../components/util"}
app_units = {version = "0.2.3", features = ["plugins"]} app_units = {version = "0.2.3", features = ["plugins"]}
cssparser = {version = "0.5.4", features = ["heap_size"]} cssparser = {version = "0.5.4", features = ["heap_size"]}
euclid = {version = "0.6.4", features = ["plugins"]} euclid = {version = "0.6.4", features = ["plugins"]}
selectors = {version = "0.5", features = ["heap_size"]} selectors = {version = "0.6", features = ["heap_size"]}
string_cache = {version = "0.2", features = ["heap_size"]} string_cache = {version = "0.2", features = ["heap_size"]}
url = {version = "1.0.0", features = ["heap_size"]} url = {version = "1.0.0", features = ["heap_size"]}
rustc-serialize = "0.3" rustc-serialize = "0.3"