Skip to content
Permalink
Browse files

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:
w3c/csswg-drafts#2574

Differential Revision: https://phabricator.services.mozilla.com/D35510
  • Loading branch information...
BorisChiou authored and emilio committed Jun 21, 2019
1 parent c87da27 commit 815d18922849abda1e39a89caea2f509d0d10f30
Showing with 1 addition and 11 deletions.
  1. +1 −11 components/style/values/generics/background.rs
@@ -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`

0 comments on commit 815d189

Please sign in to comment.
You can’t perform that action at this time.