From e6bd75070270803443d1395a4261fd4907788566 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Thu, 15 Jun 2017 10:21:08 +0900 Subject: [PATCH] Make 'display' animatable But not by CSS animations or Web Animations. --- components/style/properties/longhand/box.mako.rs | 2 +- components/style/stylesheets/keyframes_rule.rs | 5 ++++- ports/geckolib/glue.rs | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index b3ada208939..551b10f96ae 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -12,7 +12,7 @@ // TODO(SimonSapin): don't parse `inline-table`, since we don't support it <%helpers:longhand name="display" need_clone="True" - animation_value_type="none" + animation_value_type="discrete" custom_cascade="${product == 'servo'}" spec="https://drafts.csswg.org/css-display/#propdef-display"> <% diff --git a/components/style/stylesheets/keyframes_rule.rs b/components/style/stylesheets/keyframes_rule.rs index dcb8902ae2a..da5311f3da7 100644 --- a/components/style/stylesheets/keyframes_rule.rs +++ b/components/style/stylesheets/keyframes_rule.rs @@ -356,7 +356,10 @@ fn get_animated_properties(keyframes: &[Arc>], guard: &SharedRw assert!(!importance.important()); if let Some(property) = AnimatableLonghand::from_declaration(declaration) { - if !seen.has_animatable_longhand_bit(&property) { + // Skip the 'display' property because although it is animatable from SMIL, + // it should not be animatable from CSS Animations or Web Animations. + if property != AnimatableLonghand::Display && + !seen.has_animatable_longhand_bit(&property) { seen.set_animatable_longhand_bit(&property); ret.push(property); } diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 50cb50f81ed..19950db47cf 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -2938,7 +2938,10 @@ pub extern "C" fn Servo_StyleSet_GetKeyframesForName(raw_data: RawServoStyleSetB let mut index = unsafe { (*keyframe).mPropertyValues.len() }; for &(ref declaration, _) in animatable { let property = AnimatableLonghand::from_declaration(declaration).unwrap(); - if !properties_set_at_current_offset.has_animatable_longhand_bit(&property) { + // Skip the 'display' property because although it is animatable from SMIL, + // it should not be animatable from CSS Animations. + if property != AnimatableLonghand::Display && + !properties_set_at_current_offset.has_animatable_longhand_bit(&property) { properties_set_at_current_offset.set_animatable_longhand_bit(&property); if current_offset == 0.0 { properties_set_at_start.set_animatable_longhand_bit(&property);