Bug 1371518 - Make 'display' animatable; r?hiro
But not be CSS animations or Web Animations.
MozReview-Commit-ID: 28BY071L6M2
--- 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 {