style: Use rust types for background-size.

Hopefully straight-forward.

Differential Revision: https://phabricator.services.mozilla.com/D19625
This commit is contained in:
Emilio Cobos Álvarez 2019-02-13 03:59:09 +01:00
parent 1e6338e1ee
commit 07cb325402
6 changed files with 27 additions and 137 deletions

View file

@ -26,7 +26,7 @@ impl Parse for BackgroundSize {
let height = input
.try(|i| NonNegativeLengthPercentageOrAuto::parse(context, i))
.unwrap_or(NonNegativeLengthPercentageOrAuto::auto());
return Ok(GenericBackgroundSize::Explicit { width, height });
return Ok(GenericBackgroundSize::ExplicitSize { width, height });
}
Ok(try_match_ident_ignore_ascii_case! { input,
"cover" => GenericBackgroundSize::Cover,
@ -35,16 +35,6 @@ impl Parse for BackgroundSize {
}
}
impl BackgroundSize {
/// Returns `auto auto`.
pub fn auto() -> Self {
GenericBackgroundSize::Explicit {
width: NonNegativeLengthPercentageOrAuto::auto(),
height: NonNegativeLengthPercentageOrAuto::auto(),
}
}
}
/// One of the keywords for `background-repeat`.
#[derive(
Clone,