From 815d18922849abda1e39a89caea2f509d0d10f30 Mon Sep 17 00:00:00 2001 From: Boris Chiou Date: Fri, 21 Jun 2019 21:48:54 +0000 Subject: [PATCH] style: Fix the serialization of the computed value of background-size. This patch produces the following serialization: ``` input | computed value ------------------------------ 1. "auto" "auto" 2. "auto auto" "auto" 3. "15px auto" "15px" 4. "15px" "15px" ``` i.e. If the second value is 'auto', then it's omitted from our serialization, because it's implied. Besides, we update the wpt to address this spec issue: https://github.com/w3c/csswg-drafts/issues/2574 Differential Revision: https://phabricator.services.mozilla.com/D35510 --- components/style/values/generics/background.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/components/style/values/generics/background.rs b/components/style/values/generics/background.rs index b64fccb6051..d9b6624595d 100644 --- a/components/style/values/generics/background.rs +++ b/components/style/values/generics/background.rs @@ -6,13 +6,6 @@ use crate::values::generics::length::{GenericLengthPercentageOrAuto, LengthPercentageOrAuto}; -fn width_and_height_are_auto( - width: &LengthPercentageOrAuto, - height: &LengthPercentageOrAuto, -) -> bool { - width.is_auto() && height.is_auto() -} - /// A generic value for the `background-size` property. #[derive( Animate, @@ -37,10 +30,7 @@ pub enum GenericBackgroundSize { /// Explicit width. width: GenericLengthPercentageOrAuto, /// Explicit height. - /// NOTE(emilio): We should probably simplify all these in case `width` - /// and `height` are the same, but all other browsers agree on only - /// special-casing `auto`. - #[css(contextual_skip_if = "width_and_height_are_auto")] + #[css(skip_if = "GenericLengthPercentageOrAuto::is_auto")] height: GenericLengthPercentageOrAuto, }, /// `cover`