From 708ce0489605782fa796b3489b5e030e9c807273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 2 Jul 2019 01:35:50 +0200 Subject: [PATCH] Bug 1519958 - Improve stack size of grid templates and re-enable style struct size assertions disabled in the previous patch. r=boris This re-enables the assertion which was disabled on the previous patch by doing a bit of boxing around. Differential Revision: https://phabricator.services.mozilla.com/D36599 --- components/style/properties/shorthands/position.mako.rs | 7 +++++-- components/style/values/generics/grid.rs | 4 ++-- components/style/values/specified/grid.rs | 5 +++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/components/style/properties/shorthands/position.mako.rs b/components/style/properties/shorthands/position.mako.rs index ef59f6d0346..4b7397719b1 100644 --- a/components/style/properties/shorthands/position.mako.rs +++ b/components/style/properties/shorthands/position.mako.rs @@ -353,8 +353,11 @@ GenericGridTemplateComponent::None }; - Ok((GenericGridTemplateComponent::TrackList(template_rows), - template_cols, GridTemplateAreas::Areas(TemplateAreasArc(Arc::new(template_areas))))) + Ok(( + GenericGridTemplateComponent::TrackList(Box::new(template_rows)), + template_cols, + GridTemplateAreas::Areas(TemplateAreasArc(Arc::new(template_areas))) + )) } else { let mut template_rows = GridTemplateComponent::parse(context, input)?; if let GenericGridTemplateComponent::TrackList(ref mut list) = template_rows { diff --git a/components/style/values/generics/grid.rs b/components/style/values/generics/grid.rs index a5b1c733b72..7da6f54d147 100644 --- a/components/style/values/generics/grid.rs +++ b/components/style/values/generics/grid.rs @@ -710,12 +710,12 @@ pub enum GenericGridTemplateComponent { #[compute(field_bound)] #[resolve(field_bound)] #[shmem(field_bound)] - GenericTrackList, + Box>, ), /// A `subgrid ?` /// TODO: Support animations for this after subgrid is addressed in [grid-2] spec. #[animation(error)] - Subgrid(LineNameList), + Subgrid(Box), } pub use self::GenericGridTemplateComponent as GridTemplateComponent; diff --git a/components/style/values/specified/grid.rs b/components/style/values/specified/grid.rs index 0d00f4cdb5d..29629a6c0c6 100644 --- a/components/style/values/specified/grid.rs +++ b/components/style/values/specified/grid.rs @@ -321,10 +321,11 @@ impl GridTemplateComponent { ) -> Result> { if allow_grid_template_subgrids() { if let Ok(t) = input.try(|i| LineNameList::parse(context, i)) { - return Ok(GridTemplateComponent::Subgrid(t)); + return Ok(GridTemplateComponent::Subgrid(Box::new(t))); } } - TrackList::parse(context, input).map(GridTemplateComponent::TrackList) + let track_list = TrackList::parse(context, input)?; + Ok(GridTemplateComponent::TrackList(Box::new(track_list))) } }