From 048f1f3316aa78bf1595b58d12f40d04f3590a50 Mon Sep 17 00:00:00 2001 From: Ravi Shankar Date: Wed, 15 Feb 2017 15:12:47 +0530 Subject: [PATCH] Auto-generate parsing/serialization code for grid-auto-{rows,columns} --- components/style/properties/longhand/position.mako.rs | 10 ++++++++++ components/style/values/computed/mod.rs | 7 +++++++ components/style/values/specified/mod.rs | 9 ++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/components/style/properties/longhand/position.mako.rs b/components/style/properties/longhand/position.mako.rs index 002669b1f6f1..97b8d150365a 100644 --- a/components/style/properties/longhand/position.mako.rs +++ b/components/style/properties/longhand/position.mako.rs @@ -272,4 +272,14 @@ ${helpers.predefined_type("object-position", products="gecko", boxed=True)} % endfor + + // NOTE: According to the spec, this should handle multiple values of ``, + // but gecko supports only a single value + ${helpers.predefined_type("grid-auto-%ss" % kind, + "TrackSize", + "Default::default()", + animatable=False, + spec="https://drafts.csswg.org/css-grid/#propdef-grid-auto-%ss" % kind, + products="gecko", + boxed=True)} % endfor diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index ab479428f691..68e54f244201 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -11,6 +11,7 @@ use properties::ComputedValues; use std::fmt; use style_traits::ToCss; use super::{CSSFloat, RGBA, specified}; +use super::specified::grid::{TrackBreadth as GenericTrackBreadth, TrackSize as GenericTrackSize}; pub use cssparser::Color as CSSColor; pub use self::image::{AngleOrCorner, EndingShape as GradientShape, Gradient, GradientKind, Image}; @@ -326,6 +327,12 @@ impl ToCss for ClipRect { /// rect(...) | auto pub type ClipRectOrAuto = Either; +#[allow(missing_docs)] +pub type TrackBreadth = GenericTrackBreadth; + +#[allow(missing_docs)] +pub type TrackSize = GenericTrackSize; + impl ClipRectOrAuto { /// Return an auto (default for clip-rect and image-region) value pub fn auto() -> Self { diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index d6b4842e59c1..ab5440a2b8f5 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -10,6 +10,7 @@ use app_units::Au; use cssparser::{self, Parser, Token}; use euclid::size::Size2D; use parser::{ParserContext, Parse}; +use self::grid::{TrackBreadth as GenericTrackBreadth, TrackSize as GenericTrackSize}; use self::url::SpecifiedUrl; use std::ascii::AsciiExt; use std::f32::consts::PI; @@ -22,7 +23,7 @@ use super::computed::Shadow as ComputedShadow; #[cfg(feature = "gecko")] pub use self::align::{AlignItems, AlignJustifyContent, AlignJustifySelf, JustifyItems}; -pub use self::grid::{GridLine, TrackBreadth, TrackKeyword, TrackSize}; +pub use self::grid::{GridLine, TrackKeyword}; pub use self::image::{AngleOrCorner, ColorStop, EndingShape as GradientEndingShape, Gradient}; pub use self::image::{GradientKind, HorizontalDirection, Image, LengthOrKeyword, LengthOrPercentageOrKeyword}; pub use self::image::{SizeKeyword, VerticalDirection}; @@ -554,6 +555,12 @@ impl ToCss for Opacity { #[allow(missing_docs)] pub type UrlOrNone = Either; +#[allow(missing_docs)] +pub type TrackBreadth = GenericTrackBreadth; + +#[allow(missing_docs)] +pub type TrackSize = GenericTrackSize; + #[derive(Debug, Clone, PartialEq)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[allow(missing_docs)]