aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2017-06-06 00:30:31 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2017-06-06 14:35:58 +0200
commit65356b13f89fb08ab6aeef31fb2b9b43b9ca3c5e (patch)
tree0f9aae160cee2f3e9b2875e1d23acd09c887e9e7
parent2da8eb0342f6701b5365116b96113c83a1599b1f (diff)
downloadservo-65356b13f89fb08ab6aeef31fb2b9b43b9ca3c5e.tar.gz
servo-65356b13f89fb08ab6aeef31fb2b9b43b9ca3c5e.zip
Use predefined_type for transition-property
-rw-r--r--components/style/properties/helpers/animated_properties.mako.rs9
-rw-r--r--components/style/properties/longhand/box.mako.rs41
-rw-r--r--components/style/values/computed/mod.rs1
-rw-r--r--components/style/values/specified/mod.rs1
4 files changed, 19 insertions, 33 deletions
diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs
index f018967fb9a..d98b66b8e29 100644
--- a/components/style/properties/helpers/animated_properties.mako.rs
+++ b/components/style/properties/helpers/animated_properties.mako.rs
@@ -39,9 +39,8 @@ use values::CSSFloat;
use values::{Auto, Either};
use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
use values::computed::{BorderCornerRadius, ClipRect};
-use values::computed::{CalcLengthOrPercentage, Context, LengthOrPercentage};
-use values::computed::{MaxLength, MozLength};
-use values::computed::ToComputedValue;
+use values::computed::{CalcLengthOrPercentage, Context, ComputedValueAsSpecified};
+use values::computed::{LengthOrPercentage, MaxLength, MozLength, ToComputedValue};
use values::generics::{SVGPaint, SVGPaintKind};
use values::generics::border::BorderCornerRadius as GenericBorderCornerRadius;
use values::generics::position as generic_position;
@@ -73,6 +72,10 @@ pub enum TransitionProperty {
Unsupported(Atom)
}
+no_viewport_percentage!(TransitionProperty);
+
+impl ComputedValueAsSpecified for TransitionProperty {}
+
impl TransitionProperty {
/// Iterates over each longhand property.
pub fn each<F: FnMut(&TransitionProperty) -> ()>(mut cb: F) {
diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs
index 8ab5e298dbf..1d08c759853 100644
--- a/components/style/properties/longhand/box.mako.rs
+++ b/components/style/properties/longhand/box.mako.rs
@@ -424,36 +424,17 @@ ${helpers.predefined_type("transition-timing-function",
extra_prefixes="moz webkit",
spec="https://drafts.csswg.org/css-transitions/#propdef-transition-timing-function")}
-<%helpers:vector_longhand name="transition-property"
- allow_empty="True"
- need_index="True"
- animation_value_type="none"
- extra_prefixes="moz webkit"
- spec="https://drafts.csswg.org/css-transitions/#propdef-transition-property">
-
- use values::computed::ComputedValueAsSpecified;
-
- pub use properties::animated_properties::TransitionProperty;
- pub use properties::animated_properties::TransitionProperty as SpecifiedValue;
-
- pub mod computed_value {
- // NB: Can't generate the type here because it needs all the longhands
- // generated beforehand.
- pub use super::SpecifiedValue as T;
- }
-
- pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue,()> {
- SpecifiedValue::parse(input)
- }
-
- pub fn get_initial_specified_value() -> SpecifiedValue {
- TransitionProperty::All
- }
-
- no_viewport_percentage!(SpecifiedValue);
-
- impl ComputedValueAsSpecified for SpecifiedValue { }
-</%helpers:vector_longhand>
+${helpers.predefined_type("transition-property",
+ "TransitionProperty",
+ "computed::TransitionProperty::All",
+ initial_specified_value="specified::TransitionProperty::All",
+ vector=True,
+ allow_empty=True,
+ need_index=True,
+ needs_context=False,
+ animation_value_type="none",
+ extra_prefixes="moz webkit",
+ spec="https://drafts.csswg.org/css-transitions/#propdef-transition-property")}
${helpers.predefined_type("transition-delay",
"Time",
diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs
index 26165dc4e13..4f4bdd883cb 100644
--- a/components/style/values/computed/mod.rs
+++ b/components/style/values/computed/mod.rs
@@ -23,6 +23,7 @@ use super::specified;
pub use app_units::Au;
pub use cssparser::Color as CSSColor;
+pub use properties::animated_properties::TransitionProperty;
pub use self::background::BackgroundSize;
pub use self::border::{BorderImageSlice, BorderImageWidth, BorderImageSideWidth};
pub use self::border::{BorderRadius, BorderCornerRadius};
diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs
index 2299362f6de..6dff0cad04a 100644
--- a/components/style/values/specified/mod.rs
+++ b/components/style/values/specified/mod.rs
@@ -27,6 +27,7 @@ use super::generics::grid::TrackList as GenericTrackList;
use values::computed::ComputedValueAsSpecified;
use values::specified::calc::CalcNode;
+pub use properties::animated_properties::TransitionProperty;
#[cfg(feature = "gecko")]
pub use self::align::{AlignItems, AlignJustifyContent, AlignJustifySelf, JustifyItems};
pub use self::background::BackgroundSize;