From c70fb42cea88659098cb9947f7670e0cf9901fce Mon Sep 17 00:00:00 2001 From: Ravi Shankar Date: Mon, 20 Feb 2017 14:27:21 +0530 Subject: [PATCH] Add docs for grid types --- components/style/values/computed/mod.rs | 4 ++-- components/style/values/specified/grid.rs | 26 +++++++++++++++++++++-- components/style/values/specified/mod.rs | 4 ++-- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index 68e54f24420..bacb11be012 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -327,10 +327,10 @@ impl ToCss for ClipRect { /// rect(...) | auto pub type ClipRectOrAuto = Either; -#[allow(missing_docs)] +/// The computed value of a grid `` pub type TrackBreadth = GenericTrackBreadth; -#[allow(missing_docs)] +/// The computed value of a grid `` pub type TrackSize = GenericTrackSize; impl ClipRectOrAuto { diff --git a/components/style/values/specified/grid.rs b/components/style/values/specified/grid.rs index 97d4f9ed5f0..5ceb16dd889 100644 --- a/components/style/values/specified/grid.rs +++ b/components/style/values/specified/grid.rs @@ -14,11 +14,18 @@ use values::specified::LengthOrPercentage; #[derive(PartialEq, Clone, Debug)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] +/// A `` type. +/// /// https://drafts.csswg.org/css-grid/#typedef-grid-row-start-grid-line #[allow(missing_docs)] pub struct GridLine { + /// Flag to check whether it's a `span` keyword. pub is_span: bool, + /// A custom identifier for named lines. + /// + /// https://drafts.csswg.org/css-grid/#grid-placement-slot pub ident: Option, + /// Denotes the nth grid line from grid item's placement. pub integer: Option, } @@ -105,13 +112,18 @@ define_css_keyword_enum!{ TrackKeyword: "min-content" => MinContent } -#[allow(missing_docs)] #[derive(Clone, PartialEq, Debug)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] +/// A track breadth for explicit grid track sizing. It's generic solely to +/// avoid re-implementing it for the computed type. +/// /// https://drafts.csswg.org/css-grid/#typedef-track-breadth pub enum TrackBreadth { + /// The generic type is almost always a non-negative `` Breadth(L), + /// A flex fraction specified in `fr` units. Flex(CSSFloat), + /// One of the track-sizing keywords (`auto`, `min-content`, `max-content`) Keyword(TrackKeyword), } @@ -182,13 +194,23 @@ impl ToComputedValue for TrackBreadth { } } -#[allow(missing_docs)] #[derive(Clone, PartialEq, Debug)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] +/// A `` type for explicit grid track sizing. Like ``, this is +/// generic only to avoid code bloat. It only takes `` +/// /// https://drafts.csswg.org/css-grid/#typedef-track-size pub enum TrackSize { + /// A flexible `` Breadth(TrackBreadth), + /// A `minmax` function for a range over an inflexible `` + /// and a flexible `` + /// + /// https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-minmax MinMax(TrackBreadth, TrackBreadth), + /// A `fit-content` function. + /// + /// https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-fit-content FitContent(L), } diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index ab5440a2b8f..1d58af7cf06 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -555,10 +555,10 @@ impl ToCss for Opacity { #[allow(missing_docs)] pub type UrlOrNone = Either; -#[allow(missing_docs)] +/// The specified value of a grid `` pub type TrackBreadth = GenericTrackBreadth; -#[allow(missing_docs)] +/// The specified value of a grid `` pub type TrackSize = GenericTrackSize; #[derive(Debug, Clone, PartialEq)]