diff --git a/components/style/animation.rs b/components/style/animation.rs index 0e82b986f94..d6604b40db5 100644 --- a/components/style/animation.rs +++ b/components/style/animation.rs @@ -235,7 +235,7 @@ pub fn maybe_start_animations(context: &SharedStyleContex } // TODO: This should be factored out, too much indentation. - if let Some(ref animation) = context.stylist.animations().get(&**name) { + if let Some(ref animation) = context.stylist.animations().get(&name) { debug!("maybe_start_animations: found animation {}", name); had_animations = true; let mut last_keyframe_style = compute_style_for_animation_step(context, diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index bdd1d3d3aa5..4be64fd50aa 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -589,9 +589,10 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", need_clone= pub mod computed_value { use cssparser::ToCss; use std::fmt; + use string_cache::Atom; #[derive(Debug, Clone, PartialEq, HeapSizeOf)] - pub struct T(pub Vec); + pub struct T(pub Vec); impl ToCss for T { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { @@ -603,7 +604,8 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", need_clone= if i != 0 { try!(dest.write_str(", ")); } - try!(dest.write_str(&name)); + // NB: to_string() needed due to geckolib backend. + try!(dest.write_str(&*name.to_string())); } Ok(()) } @@ -620,7 +622,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", need_clone= pub fn parse(_: &ParserContext, input: &mut Parser) -> Result { use std::borrow::Cow; Ok(SpecifiedValue(try!(input.parse_comma_separated(|input| { - input.expect_ident().map(Cow::into_owned) + input.expect_ident().map(Atom::from) })))) } diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs index 676b78de08e..a4895e91ecb 100644 --- a/components/style/selector_matching.rs +++ b/components/style/selector_matching.rs @@ -24,6 +24,7 @@ use std::collections::HashMap; use std::hash::BuildHasherDefault; use std::process; use std::sync::Arc; +use string_cache::Atom; use style_traits::viewport::ViewportConstraints; use stylesheets::{CSSRule, CSSRuleIteratorExt, Origin, Stylesheet}; use url::Url; @@ -129,7 +130,7 @@ pub struct Stylist { BuildHasherDefault<::fnv::FnvHasher>>, /// A map with all the animations indexed by name. - animations: HashMap, + animations: HashMap, /// Applicable declarations for a given non-eagerly cascaded pseudo-element. /// These are eagerly computed once, and then used to resolve the new @@ -461,7 +462,7 @@ impl Stylist { } #[inline] - pub fn animations(&self) -> &HashMap { + pub fn animations(&self) -> &HashMap { &self.animations } } diff --git a/components/style/stylesheets.rs b/components/style/stylesheets.rs index c4a2ca24c3b..726db0251cf 100644 --- a/components/style/stylesheets.rs +++ b/components/style/stylesheets.rs @@ -69,7 +69,7 @@ pub enum CSSRule { #[derive(Debug, HeapSizeOf, PartialEq)] pub struct KeyframesRule { - pub name: String, + pub name: Atom, pub keyframes: Vec, } @@ -405,7 +405,7 @@ enum AtRulePrelude { /// A @viewport rule prelude. Viewport, /// A @keyframes rule, with its animation name. - Keyframes(String), + Keyframes(Atom), } @@ -507,7 +507,7 @@ impl<'a, 'b, Impl: SelectorImpl> AtRuleParser for NestedRuleParser<'a, 'b, Impl> }, "keyframes" => { let name = try!(input.expect_ident()); - Ok(AtRuleType::WithBlock(AtRulePrelude::Keyframes(name.into_owned()))) + Ok(AtRuleType::WithBlock(AtRulePrelude::Keyframes(Atom::from(name)))) }, _ => Err(()) }