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::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) {

View file

@ -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",

View file

@ -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};

View file

@ -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;