Streamline parsing of NonNegativeLengthOrNumber a bit

This commit is contained in:
Anthony Ramine 2018-02-26 17:08:55 +01:00
parent f097dfad59
commit 4a98fa70bf
5 changed files with 20 additions and 31 deletions

View file

@ -4795,10 +4795,10 @@ fn static_assert() {
use values::Either;
match v {
Either::Second(non_negative_number) => {
Either::First(non_negative_number) => {
self.gecko.mTabSize.set_value(CoordDataValue::Factor(non_negative_number.0));
}
Either::First(non_negative_length) => {
Either::Second(non_negative_length) => {
self.gecko.mTabSize.set(non_negative_length);
}
}
@ -4809,8 +4809,8 @@ fn static_assert() {
use values::Either;
match self.gecko.mTabSize.as_value() {
CoordDataValue::Coord(coord) => Either::First(Au(coord).into()),
CoordDataValue::Factor(number) => Either::Second(From::from(number)),
CoordDataValue::Coord(coord) => Either::Second(Au(coord).into()),
CoordDataValue::Factor(number) => Either::First(From::from(number)),
_ => unreachable!(),
}
}

View file

@ -511,7 +511,6 @@ ${helpers.single_keyword("resize",
${helpers.predefined_type("perspective",
"LengthOrNone",
"Either::Second(None_)",
"parse_non_negative_length",
gecko_ffi_name="mChildPerspective",
spec="https://drafts.csswg.org/css-transforms/#perspective",
extra_prefixes="moz webkit",

View file

@ -488,7 +488,7 @@ ${helpers.predefined_type(
${helpers.predefined_type(
"-moz-tab-size", "length::NonNegativeLengthOrNumber",
"::values::Either::Second(From::from(8.0))",
"::values::Either::First(From::from(8.0))",
products="gecko", animation_value_type="::values::computed::length::NonNegativeLengthOrNumber",
spec="https://drafts.csswg.org/css-text-3/#tab-size-property")}