Bug 1371518 - Make 'display' animatable; r?hiro draft
authorBrian Birtles <birtles@gmail.com>
Wed, 14 Jun 2017 15:23:51 +0900
changeset 593861 db9ff3d6ccb2b2dde73c8c9c1c6ef346551962ef
parent 593860 c88ed4ba75aaaafad6dc4305419cfc7cffdf1d48
child 593862 aaf123aebbb861477157a702a7dab20a70ec5b19
push id63840
push userbbirtles@mozilla.com
push dateWed, 14 Jun 2017 07:29:38 +0000
reviewershiro
bugs1371518
milestone56.0a1
Bug 1371518 - Make 'display' animatable; r?hiro But not be CSS animations or Web Animations. MozReview-Commit-ID: 28BY071L6M2
servo/components/style/properties/longhand/box.mako.rs
servo/components/style/stylesheets/keyframes_rule.rs
servo/ports/geckolib/glue.rs
--- a/servo/components/style/properties/longhand/box.mako.rs
+++ b/servo/components/style/properties/longhand/box.mako.rs
@@ -7,17 +7,17 @@
 
 <% data.new_style_struct("Box",
                          inherited=False,
                          gecko_name="Display") %>
 
 // 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">
     <%
         values = """inline block inline-block
             table inline-table table-row-group table-header-group table-footer-group
             table-row table-column-group table-column table-cell table-caption
             list-item flex inline-flex
             none
--- a/servo/components/style/stylesheets/keyframes_rule.rs
+++ b/servo/components/style/stylesheets/keyframes_rule.rs
@@ -351,17 +351,20 @@ fn get_animated_properties(keyframes: &[
     // it here.
     for keyframe in keyframes {
         let keyframe = keyframe.read_with(&guard);
         let block = keyframe.block.read_with(guard);
         for &(ref declaration, importance) in block.declarations().iter() {
             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);
                 }
             }
         }
     }
 
     ret
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -2932,17 +2932,20 @@ pub extern "C" fn Servo_StyleSet_GetKeyf
                          .iter()
                          .filter(|&&(ref declaration, _)| {
                              declaration.is_animatable()
                          });
 
                 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);
                         } else if current_offset == 1.0 {
                             properties_set_at_end.set_animatable_longhand_bit(&property);
                         }
 
                         unsafe {