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
This commit is contained in:
Boris Chiou 2019-06-21 21:48:54 +00:00 committed by Emilio Cobos Álvarez
parent c87da27bca
commit 815d189228
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A

View file

@ -6,13 +6,6 @@
use crate::values::generics::length::{GenericLengthPercentageOrAuto, LengthPercentageOrAuto};
fn width_and_height_are_auto<L>(
width: &LengthPercentageOrAuto<L>,
height: &LengthPercentageOrAuto<L>,
) -> bool {
width.is_auto() && height.is_auto()
}
/// A generic value for the `background-size` property.
#[derive(
Animate,
@ -37,10 +30,7 @@ pub enum GenericBackgroundSize<LengthPercent> {
/// Explicit width.
width: GenericLengthPercentageOrAuto<LengthPercent>,
/// 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<LengthPercent>,
},
/// `cover`