aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/animation.rs
diff options
context:
space:
mode:
authorBoris Chiou <boris.chiou@gmail.com>2017-04-24 13:22:25 +0800
committerBoris Chiou <boris.chiou@gmail.com>2017-04-26 21:35:05 +0800
commit02fc1789e8561dc9e9740a46e13ef8c9a360ee9c (patch)
tree192db897a1a5d0383a53239c71a3ca3d30aeded0 /components/style/animation.rs
parente5762cb6953b5e202e8733e39e8267c4b67a9622 (diff)
downloadservo-02fc1789e8561dc9e9740a46e13ef8c9a360ee9c.tar.gz
servo-02fc1789e8561dc9e9740a46e13ef8c9a360ee9c.zip
Bug 1357357 - Make the parser of transition-property match the spec.
1. We add a new arm to TransitionProperty, TransitionProperty::Unsupported, which contains an Atom, so it's better to remove the Copy trait from TransitionProperty. 2. TransitionProperty::Unsupported(Atom) represents any non-animatable, custom, or unrecognized property, and we use Atom to store the ident string for serialization.
Diffstat (limited to 'components/style/animation.rs')
-rw-r--r--components/style/animation.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/components/style/animation.rs b/components/style/animation.rs
index 2229d485591..16c7dab364d 100644
--- a/components/style/animation.rs
+++ b/components/style/animation.rs
@@ -272,9 +272,13 @@ impl PropertyAnimation {
let timing_function = box_style.transition_timing_function_mod(transition_index);
let duration = box_style.transition_duration_mod(transition_index);
+ if let TransitionProperty::Unsupported(_) = transition_property {
+ return result
+ }
+
if transition_property.is_shorthand() {
return transition_property.longhands().iter().filter_map(|transition_property| {
- PropertyAnimation::from_transition_property(*transition_property,
+ PropertyAnimation::from_transition_property(transition_property,
timing_function,
duration,
old_style,
@@ -284,7 +288,7 @@ impl PropertyAnimation {
if transition_property != TransitionProperty::All {
if let Some(property_animation) =
- PropertyAnimation::from_transition_property(transition_property,
+ PropertyAnimation::from_transition_property(&transition_property,
timing_function,
duration,
old_style,
@@ -296,7 +300,7 @@ impl PropertyAnimation {
TransitionProperty::each(|transition_property| {
if let Some(property_animation) =
- PropertyAnimation::from_transition_property(transition_property,
+ PropertyAnimation::from_transition_property(&transition_property,
timing_function,
duration,
old_style,
@@ -308,15 +312,15 @@ impl PropertyAnimation {
result
}
- fn from_transition_property(transition_property: TransitionProperty,
+ fn from_transition_property(transition_property: &TransitionProperty,
timing_function: TransitionTimingFunction,
duration: Time,
old_style: &ComputedValues,
new_style: &ComputedValues)
-> Option<PropertyAnimation> {
debug_assert!(!transition_property.is_shorthand() &&
- transition_property != TransitionProperty::All);
- let animated_property = AnimatedProperty::from_transition_property(&transition_property,
+ transition_property != &TransitionProperty::All);
+ let animated_property = AnimatedProperty::from_transition_property(transition_property,
old_style,
new_style);
@@ -702,7 +706,7 @@ pub fn update_style_for_animation(context: &SharedStyleContext,
for transition_property in &animation.properties_changed {
debug!("update_style_for_animation: scanning prop {:?} for animation \"{}\"",
transition_property, name);
- match PropertyAnimation::from_transition_property(*transition_property,
+ match PropertyAnimation::from_transition_property(transition_property,
timing_function,
Time::from_seconds(relative_duration as f32),
&from_style,