Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Consider foo and "foo" equal as keyframes/animation names.
  • Loading branch information
SimonSapin committed Apr 26, 2017
1 parent 0ff64bd commit be38c9a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion components/style/values/mod.rs
Expand Up @@ -14,6 +14,7 @@ use parser::{Parse, ParserContext};
use std::ascii::AsciiExt;
use std::borrow::Cow;
use std::fmt::{self, Debug};
use std::hash;
use style_traits::ToCss;

macro_rules! define_numbered_css_keyword_enum {
Expand Down Expand Up @@ -241,7 +242,7 @@ impl ToCss for CustomIdent {
}

/// https://drafts.csswg.org/css-animations/#typedef-keyframes-name
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, Clone)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum KeyframesName {
/// <custom-ident>
Expand All @@ -268,6 +269,20 @@ impl KeyframesName {
}
}

impl Eq for KeyframesName {}

impl PartialEq for KeyframesName {
fn eq(&self, other: &Self) -> bool {
self.as_atom() == other.as_atom()
}
}

impl hash::Hash for KeyframesName {
fn hash<H>(&self, state: &mut H) where H: hash::Hasher {
self.as_atom().hash(state)
}
}

impl Parse for KeyframesName {
fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
match input.next() {
Expand Down

0 comments on commit be38c9a

Please sign in to comment.