mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
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:
parent
fd184f6b4a
commit
744cf0ee44
2 changed files with 74 additions and 3 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue