Use predefined_type for transition-property

This commit is contained in:
Anthony Ramine 2017-06-06 00:30:31 +02:00
parent 2da8eb0342
commit 65356b13f8
4 changed files with 19 additions and 33 deletions

View file

@ -39,9 +39,8 @@ use values::CSSFloat;
use values::{Auto, Either}; use values::{Auto, Either};
use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
use values::computed::{BorderCornerRadius, ClipRect}; use values::computed::{BorderCornerRadius, ClipRect};
use values::computed::{CalcLengthOrPercentage, Context, LengthOrPercentage}; use values::computed::{CalcLengthOrPercentage, Context, ComputedValueAsSpecified};
use values::computed::{MaxLength, MozLength}; use values::computed::{LengthOrPercentage, MaxLength, MozLength, ToComputedValue};
use values::computed::ToComputedValue;
use values::generics::{SVGPaint, SVGPaintKind}; use values::generics::{SVGPaint, SVGPaintKind};
use values::generics::border::BorderCornerRadius as GenericBorderCornerRadius; use values::generics::border::BorderCornerRadius as GenericBorderCornerRadius;
use values::generics::position as generic_position; use values::generics::position as generic_position;
@ -73,6 +72,10 @@ pub enum TransitionProperty {
Unsupported(Atom) Unsupported(Atom)
} }
no_viewport_percentage!(TransitionProperty);
impl ComputedValueAsSpecified for TransitionProperty {}
impl TransitionProperty { impl TransitionProperty {
/// Iterates over each longhand property. /// Iterates over each longhand property.
pub fn each<F: FnMut(&TransitionProperty) -> ()>(mut cb: F) { pub fn each<F: FnMut(&TransitionProperty) -> ()>(mut cb: F) {

View file

@ -424,36 +424,17 @@ ${helpers.predefined_type("transition-timing-function",
extra_prefixes="moz webkit", extra_prefixes="moz webkit",
spec="https://drafts.csswg.org/css-transitions/#propdef-transition-timing-function")} spec="https://drafts.csswg.org/css-transitions/#propdef-transition-timing-function")}
<%helpers:vector_longhand name="transition-property" ${helpers.predefined_type("transition-property",
allow_empty="True" "TransitionProperty",
need_index="True" "computed::TransitionProperty::All",
animation_value_type="none" initial_specified_value="specified::TransitionProperty::All",
extra_prefixes="moz webkit" vector=True,
spec="https://drafts.csswg.org/css-transitions/#propdef-transition-property"> allow_empty=True,
need_index=True,
use values::computed::ComputedValueAsSpecified; needs_context=False,
animation_value_type="none",
pub use properties::animated_properties::TransitionProperty; extra_prefixes="moz webkit",
pub use properties::animated_properties::TransitionProperty as SpecifiedValue; spec="https://drafts.csswg.org/css-transitions/#propdef-transition-property")}
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-delay", ${helpers.predefined_type("transition-delay",
"Time", "Time",

View file

@ -23,6 +23,7 @@ use super::specified;
pub use app_units::Au; pub use app_units::Au;
pub use cssparser::Color as CSSColor; pub use cssparser::Color as CSSColor;
pub use properties::animated_properties::TransitionProperty;
pub use self::background::BackgroundSize; pub use self::background::BackgroundSize;
pub use self::border::{BorderImageSlice, BorderImageWidth, BorderImageSideWidth}; pub use self::border::{BorderImageSlice, BorderImageWidth, BorderImageSideWidth};
pub use self::border::{BorderRadius, BorderCornerRadius}; pub use self::border::{BorderRadius, BorderCornerRadius};

View file

@ -27,6 +27,7 @@ use super::generics::grid::TrackList as GenericTrackList;
use values::computed::ComputedValueAsSpecified; use values::computed::ComputedValueAsSpecified;
use values::specified::calc::CalcNode; use values::specified::calc::CalcNode;
pub use properties::animated_properties::TransitionProperty;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
pub use self::align::{AlignItems, AlignJustifyContent, AlignJustifySelf, JustifyItems}; pub use self::align::{AlignItems, AlignJustifyContent, AlignJustifySelf, JustifyItems};
pub use self::background::BackgroundSize; pub use self::background::BackgroundSize;