From 7bf6b528b1e6cc75efde87039b6897b241577106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 6 Sep 2017 13:32:04 +0200 Subject: [PATCH] style: Stop the grid shorthand from resetting grid-gap properties. Bug: 1387410 Reviewed-by: heycam MozReview-Commit-ID: GxU9YuAUc00 --- .../style/properties/shorthand/position.mako.rs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/components/style/properties/shorthand/position.mako.rs b/components/style/properties/shorthand/position.mako.rs index e0b2b8f7507..076a2b40e0d 100644 --- a/components/style/properties/shorthand/position.mako.rs +++ b/components/style/properties/shorthand/position.mako.rs @@ -448,8 +448,7 @@ <%helpers:shorthand name="grid" sub_properties="grid-template-rows grid-template-columns grid-template-areas - grid-auto-rows grid-auto-columns grid-row-gap grid-column-gap - grid-auto-flow" + grid-auto-rows grid-auto-columns grid-auto-flow" spec="https://drafts.csswg.org/css-grid/#propdef-grid" products="gecko"> use parser::Parse; @@ -457,7 +456,7 @@ use properties::longhands::grid_auto_flow::computed_value::{AutoFlow, T as SpecifiedAutoFlow}; use values::{Either, None_}; use values::generics::grid::{GridTemplateComponent, TrackListType}; - use values::specified::{GenericGridTemplateComponent, NonNegativeLengthOrPercentage, TrackSize}; + use values::specified::{GenericGridTemplateComponent, TrackSize}; pub fn parse_value<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result> { @@ -517,9 +516,6 @@ grid_auto_rows: auto_rows, grid_auto_columns: auto_cols, grid_auto_flow: flow, - // This shorthand also resets grid gap - grid_row_gap: NonNegativeLengthOrPercentage::zero(), - grid_column_gap: NonNegativeLengthOrPercentage::zero(), }) } @@ -535,14 +531,6 @@ impl<'a> ToCss for LonghandsToSerialize<'a> { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - // `grid` shorthand resets these properties. If they are not zero, that means they - // are changed by longhands and in that case we should fail serializing `grid`. - if *self.grid_row_gap != NonNegativeLengthOrPercentage::zero() || - *self.grid_column_gap != NonNegativeLengthOrPercentage::zero() { - return Ok(()); - } - - if *self.grid_template_areas != Either::Second(None_) || (*self.grid_template_rows != GridTemplateComponent::None && *self.grid_template_columns != GridTemplateComponent::None) ||