From 098eb300ac759a4db5cdedae0c9db1c5c005538c Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Thu, 18 Apr 2019 01:16:03 +0200 Subject: [PATCH] style: [cssom][css-grid] 'grid-auto-flow: row dense' should serialize to 'dense' since 'row' is implied. Differential Revision: https://phabricator.services.mozilla.com/D28058 --- components/style/values/specified/position.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/style/values/specified/position.rs b/components/style/values/specified/position.rs index f75af3f5585..c0ac56c9822 100644 --- a/components/style/values/specified/position.rs +++ b/components/style/values/specified/position.rs @@ -460,6 +460,11 @@ pub enum AutoFlow { Column, } +/// If `dense` is specified, `row` is implied. +fn is_row_dense(autoflow: &AutoFlow, dense: &bool) -> bool { + *autoflow == AutoFlow::Row && *dense +} + #[derive( Clone, Copy, @@ -477,6 +482,7 @@ pub enum AutoFlow { /// specifying exactly how auto-placed items get flowed into the grid pub struct GridAutoFlow { /// Specifiy how auto-placement algorithm fills each `row` or `column` in turn + #[css(contextual_skip_if = "is_row_dense")] pub autoflow: AutoFlow, /// Specify use `dense` packing algorithm or not #[css(represents_keyword)]