Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use more generics and remove more code from mako files #17186

Merged
merged 4 commits into from Jun 6, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Use predefined_type for transition-property

  • Loading branch information
nox committed Jun 6, 2017
commit 65356b13f89fb08ab6aeef31fb2b9b43b9ca3c5e
@@ -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) {
@@ -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",
@@ -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};
@@ -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;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.