style: Serialize background-size: auto auto as "auto".

With this change, all of Chrome, Edge, Firefox, and Safari serialize
background-size by omitting the second "auto" if the value is "auto
auto".  Other keywords are still repeated.

Differential Revision: https://phabricator.services.mozilla.com/D10446
This commit is contained in:
Cameron McCormack 2018-11-05 02:21:41 +00:00 committed by Emilio Cobos Álvarez
parent 68f4ad9557
commit 56fd3b786f
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
4 changed files with 53 additions and 3 deletions

View file

@ -17,7 +17,7 @@ use values::generics::length::{MaxLength as GenericMaxLength, MozLength as Gener
use values::generics::NonNegative;
use values::specified::length::ViewportPercentageLength;
use values::specified::length::{AbsoluteLength, FontBaseSize, FontRelativeLength};
use values::{specified, Auto, CSSFloat, Either, Normal};
use values::{specified, Auto, CSSFloat, Either, Normal, IsAuto};
pub use super::image::Image;
pub use values::specified::url::UrlOrNone;
@ -528,6 +528,13 @@ impl LengthOrPercentageOrAuto {
/// A wrapper of LengthOrPercentageOrAuto, whose value must be >= 0.
pub type NonNegativeLengthOrPercentageOrAuto = NonNegative<LengthOrPercentageOrAuto>;
impl IsAuto for NonNegativeLengthOrPercentageOrAuto {
#[inline]
fn is_auto(&self) -> bool {
*self == Self::auto()
}
}
impl NonNegativeLengthOrPercentageOrAuto {
/// `auto`
#[inline]