diff --git a/components/style/values/mod.rs b/components/style/values/mod.rs index 4c36e84d287..e221619c843 100644 --- a/components/style/values/mod.rs +++ b/components/style/values/mod.rs @@ -555,13 +555,17 @@ impl TimelineOrKeyframesName { return dest.write_str("none") } - self.0.with_str(|s| { + let mut serialize = |s: &_| { if CustomIdent::is_valid(s, invalid) { serialize_identifier(s, dest) } else { s.to_css(dest) } - }) + }; + #[cfg(feature = "gecko")] + return self.0.with_str(|s| serialize(s)); + #[cfg(feature = "servo")] + return serialize(self.0.as_ref()); } } @@ -616,6 +620,11 @@ impl KeyframesName { Self(TimelineOrKeyframesName::from_atom(atom)) } + /// + pub fn from_ident(value: &str) -> Self { + Self(TimelineOrKeyframesName::from_ident(value)) + } + /// Returns the `none` value. pub fn none() -> Self { Self(TimelineOrKeyframesName::none())