From 4a2ede9b3a096ad25e0d40bf12d21cd5dd9e4b50 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 4 Jul 2017 15:26:17 +0200 Subject: [PATCH] Kill delegate_animate from vector_longhand The impl is now always generated if animation_value_type is ComputedValue. --- components/style/properties/helpers.mako.rs | 7 +++---- .../helpers/animated_properties.mako.rs | 18 ------------------ .../properties/longhand/background.mako.rs | 14 +++++++++----- .../style/properties/longhand/box.mako.rs | 3 +-- .../properties/longhand/inherited_svg.mako.rs | 1 - .../style/properties/longhand/svg.mako.rs | 17 +++++++++++------ 6 files changed, 24 insertions(+), 36 deletions(-) diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index 109085d7896..f7fd7f608f1 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -76,9 +76,8 @@ We assume that the default/initial value is an empty vector for these. `initial_value` need not be defined for these. -<%def name="vector_longhand(name, allow_empty=False, - delegate_animate=False, separator='Comma', **kwargs)"> - <%call expr="longhand(name, vector=True, **kwargs)"> +<%def name="vector_longhand(name, animation_value_type=None, allow_empty=False, separator='Comma', **kwargs)"> + <%call expr="longhand(name, animation_value_type=animation_value_type, vector=True, **kwargs)"> #[allow(unused_imports)] use smallvec::SmallVec; use std::fmt; @@ -128,7 +127,7 @@ % endif ); - % if delegate_animate: + % if animation_value_type == "ComputedValue": use properties::animated_properties::Animatable; impl Animatable for T { fn add_weighted(&self, other: &Self, self_portion: f64, other_portion: f64) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 03a51eb0a39..3f5d91ba467 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -16,7 +16,6 @@ use euclid::{Point2D, Size2D}; #[cfg(feature = "gecko")] use gecko_string_cache::Atom; use properties::{CSSWideKeyword, PropertyDeclaration}; use properties::longhands; -use properties::longhands::background_size::computed_value::T as BackgroundSizeList; use properties::longhands::font_weight::computed_value::T as FontWeight; use properties::longhands::font_stretch::computed_value::T as FontStretch; use properties::longhands::transform::computed_value::ComputedMatrix; @@ -1083,23 +1082,6 @@ impl Animatable for VerticalAlign { } } -impl Animatable for BackgroundSizeList { - #[inline] - fn add_weighted(&self, other: &Self, self_portion: f64, other_portion: f64) -> Result { - self.0.add_weighted(&other.0, self_portion, other_portion).map(BackgroundSizeList) - } - - #[inline] - fn compute_distance(&self, other: &Self) -> Result { - self.0.compute_distance(&other.0) - } - - #[inline] - fn compute_squared_distance(&self, other: &Self) -> Result { - self.0.compute_squared_distance(&other.0) - } -} - /// https://drafts.csswg.org/css-transitions/#animtype-lpcalc impl Animatable for CalcLengthOrPercentage { #[inline] diff --git a/components/style/properties/longhand/background.mako.rs b/components/style/properties/longhand/background.mako.rs index 96d05bed6c4..9e4a7c82856 100644 --- a/components/style/properties/longhand/background.mako.rs +++ b/components/style/properties/longhand/background.mako.rs @@ -24,11 +24,15 @@ ${helpers.predefined_type("background-image", "ImageLayer", ignored_when_colors_disabled="True")} % for (axis, direction, initial) in [("x", "Horizontal", "left"), ("y", "Vertical", "top")]: - ${helpers.predefined_type("background-position-" + axis, "position::" + direction + "Position", - initial_value="computed::LengthOrPercentage::zero()", - initial_specified_value="SpecifiedValue::initial_specified_value()", - spec="https://drafts.csswg.org/css-backgrounds-4/#propdef-background-position-" + axis, - animation_value_type="ComputedValue", vector=True, delegate_animate=True)} + ${helpers.predefined_type( + "background-position-" + axis, + "position::" + direction + "Position", + initial_value="computed::LengthOrPercentage::zero()", + initial_specified_value="SpecifiedValue::initial_specified_value()", + spec="https://drafts.csswg.org/css-backgrounds-4/#propdef-background-position-" + axis, + animation_value_type="ComputedValue", + vector=True, + )} % endfor <%helpers:vector_longhand name="background-repeat" animation_value_type="discrete" diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index b970745461d..591c6f43f21 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -679,8 +679,7 @@ ${helpers.predefined_type( products="gecko", spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-destination)", animation_value_type="ComputedValue", - allow_empty="NotInitial", - delegate_animate=True, + allow_empty="NotInitial" )} <%helpers:longhand name="transform" extra_prefixes="webkit" diff --git a/components/style/properties/longhand/inherited_svg.mako.rs b/components/style/properties/longhand/inherited_svg.mako.rs index 13ce7492b3c..0ead8db90ef 100644 --- a/components/style/properties/longhand/inherited_svg.mako.rs +++ b/components/style/properties/longhand/inherited_svg.mako.rs @@ -94,7 +94,6 @@ ${helpers.predefined_type( None, "parse_non_negative", vector=True, - delegate_animate=True, products="gecko", animation_value_type="ComputedValue", separator="CommaWithSpace", diff --git a/components/style/properties/longhand/svg.mako.rs b/components/style/properties/longhand/svg.mako.rs index 887cf057bb2..eaeba146ec5 100644 --- a/components/style/properties/longhand/svg.mako.rs +++ b/components/style/properties/longhand/svg.mako.rs @@ -89,12 +89,17 @@ ${helpers.single_keyword("mask-mode", % for (axis, direction) in [("x", "Horizontal"), ("y", "Vertical")]: - ${helpers.predefined_type("mask-position-" + axis, "position::" + direction + "Position", - products="gecko", extra_prefixes="webkit", - initial_value="computed::LengthOrPercentage::zero()", - initial_specified_value="specified::PositionComponent::Center", - spec="https://drafts.fxtf.org/css-masking/#propdef-mask-position", - animation_value_type="ComputedValue", vector=True, delegate_animate=True)} + ${helpers.predefined_type( + "mask-position-" + axis, + "position::" + direction + "Position", + products="gecko", + extra_prefixes="webkit", + initial_value="computed::LengthOrPercentage::zero()", + initial_specified_value="specified::PositionComponent::Center", + spec="https://drafts.fxtf.org/css-masking/#propdef-mask-position", + animation_value_type="ComputedValue", + vector=True, + )} % endfor ${helpers.single_keyword("mask-clip",