aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/attr.rs
diff options
context:
space:
mode:
authorBobby Holley <bobbyholley@gmail.com>2016-05-11 11:43:54 -0700
committerBobby Holley <bobbyholley@gmail.com>2016-05-18 11:33:38 -0700
commitb521c293dca98dd7efae274fe205c46ae203c67e (patch)
treea528e2a93b360b716f3f8900d248936773faa664 /components/style/attr.rs
parent825f610dec23d3aae30bdb83f46a111563ad0291 (diff)
downloadservo-b521c293dca98dd7efae274fe205c46ae203c67e.tar.gz
servo-b521c293dca98dd7efae274fe205c46ae203c67e.zip
Add string_cache override for geckolib based on gecko atoms.
The work in these patches is based on Ms2ger's gecko-atom crate.
Diffstat (limited to 'components/style/attr.rs')
-rw-r--r--components/style/attr.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/components/style/attr.rs b/components/style/attr.rs
index 9678c519d5a..8c797dbcba0 100644
--- a/components/style/attr.rs
+++ b/components/style/attr.rs
@@ -7,12 +7,11 @@ use cssparser::{self, Color, RGBA};
use euclid::num::Zero;
use num_traits::ToPrimitive;
use std::ascii::AsciiExt;
-use std::ops::Deref;
use std::str::FromStr;
use string_cache::{Atom, Namespace};
use url::Url;
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};
// Duplicated from script::dom::values.
@@ -125,7 +124,9 @@ impl AttrValue {
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 {
+ use util::str::str_join;
// TODO(ajeffrey): effecient conversion of Vec<Atom> to DOMString
let tokens = DOMString::from(str_join(&atoms, "\x20"));
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;
fn deref(&self) -> &str {