Skip to content

Commit

Permalink
style: Don't make visibility additive.
Browse files Browse the repository at this point in the history
As per discussion here: web-platform-tests/wpt#19160

This property type does not have a procedure for addition defined so it should
not be additive.

Differential Revision: https://phabricator.services.mozilla.com/D48454
  • Loading branch information
birtles authored and emilio committed Oct 9, 2019
1 parent 38e5897 commit f6b5870
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions components/style/properties/helpers/animated_properties.mako.rs
Expand Up @@ -768,17 +768,22 @@ animated_list_impl!(<T> for crate::OwnedSlice<T>);
animated_list_impl!(<T> for SmallVec<[T; 1]>);
animated_list_impl!(<T> for Vec<T>);

/// <https://drafts.csswg.org/css-transitions/#animtype-visibility>
/// <https://drafts.csswg.org/web-animations-1/#animating-visibility>
impl Animate for Visibility {
#[inline]
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
let (this_weight, other_weight) = procedure.weights();
match (*self, *other) {
(Visibility::Visible, _) => {
Ok(if this_weight > 0.0 { *self } else { *other })
},
(_, Visibility::Visible) => {
Ok(if other_weight > 0.0 { *other } else { *self })
match procedure {
Procedure::Interpolate { .. } => {
let (this_weight, other_weight) = procedure.weights();
match (*self, *other) {
(Visibility::Visible, _) => {
Ok(if this_weight > 0.0 { *self } else { *other })
},
(_, Visibility::Visible) => {
Ok(if other_weight > 0.0 { *other } else { *self })
},
_ => Err(()),
}
},
_ => Err(()),
}
Expand Down

0 comments on commit f6b5870

Please sign in to comment.