From f6b587051d21ab09161f5f59a9a98dbce932ea36 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Tue, 8 Oct 2019 01:27:29 +0000 Subject: [PATCH] style: Don't make visibility additive. As per discussion here: https://github.com/web-platform-tests/wpt/pull/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 --- .../helpers/animated_properties.mako.rs | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 8bccd5a0bfb..c81e186a129 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -768,17 +768,22 @@ animated_list_impl!( for crate::OwnedSlice); animated_list_impl!( for SmallVec<[T; 1]>); animated_list_impl!( for Vec); -/// +/// impl Animate for Visibility { #[inline] fn animate(&self, other: &Self, procedure: Procedure) -> Result { - 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(()), }