diff options
Diffstat (limited to 'servo/components/style/values/specified/easing.rs')
-rw-r--r-- | servo/components/style/values/specified/easing.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/servo/components/style/values/specified/easing.rs b/servo/components/style/values/specified/easing.rs index 5e4d8ae1ea..7697e6a5d7 100644 --- a/servo/components/style/values/specified/easing.rs +++ b/servo/components/style/values/specified/easing.rs @@ -9,7 +9,7 @@ use crate::values::computed::easing::TimingFunction as ComputedTimingFunction; use crate::values::computed::{Context, ToComputedValue}; use crate::values::generics::easing::TimingFunction as GenericTimingFunction; use crate::values::generics::easing::{StepPosition, TimingKeyword}; -use crate::values::specified::{Integer, Number, Percentage}; +use crate::values::specified::{AnimationName, Integer, Number, Percentage}; use cssparser::{Delimiter, Parser, Token}; use selectors::parser::SelectorParseErrorKind; use style_traits::{ParseError, StyleParseErrorKind}; @@ -140,6 +140,15 @@ impl TimingFunction { Ok(GenericTimingFunction::LinearFunction(builder.build())) } + + /// Returns true if the name matches any keyword. + #[inline] + pub fn match_keywords(name: &AnimationName) -> bool { + if let Some(name) = name.as_atom() { + return name.with_str(|n| TimingKeyword::from_ident(n).is_ok()); + } + false + } } // We need this for converting the specified TimingFunction into computed TimingFunction without |