Add more checks to properly fail at invalid grid and grid-template serialization

We have checks for these in the shorthand parsing side actually.
But if we need to serialize a group of longhand sub-properties for the shorthand,
we should be able to fail for invalid grammar gracefully. This patch adds these checks.
This commit is contained in:
Nazım Can Altınova 2017-07-17 23:19:32 -07:00
parent fd184f6b4a
commit 744cf0ee44
2 changed files with 74 additions and 3 deletions

View file

@ -701,3 +701,13 @@ pub enum GridTemplateComponent<L> {
/// A `subgrid <line-name-list>?`
Subgrid(LineNameList),
}
impl<L> GridTemplateComponent<L> {
/// Returns length of the <track-list>s <track-size>
pub fn track_list_len(&self) -> usize {
match *self {
GridTemplateComponent::TrackList(ref tracklist) => tracklist.values.len(),
_ => 0,
}
}
}