mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +01:00
Bug 1374233 - Part 4: Add NonNegativeLengthOr{Auto|Normal|Number}.
Add NonNegativeLength, which could be computed to NonNegativeAu. So we can declare Either<NonNegativeLength, X>, X=Auto, Normal, or Number. NonNegativeLengthOrAuto is for column-width. NonNegativeLengthOrNormal is for column-gap. NonNegativeLengthOrNumber is for -moz-tab-size. MozReview-Commit-ID: AfU8XpA1um0
This commit is contained in:
parent
234d2c1b32
commit
2ef38ce67a
8 changed files with 68 additions and 20 deletions
|
@ -1089,6 +1089,8 @@ impl Clone for ${style_struct.gecko_struct_name} {
|
|||
predefined_types = {
|
||||
"length::LengthOrAuto": impl_style_coord,
|
||||
"length::LengthOrNormal": impl_style_coord,
|
||||
"length::NonNegativeLengthOrAuto": impl_style_coord,
|
||||
"length::NonNegativeLengthOrNormal": impl_style_coord,
|
||||
"GreaterThanOrEqualToOneNumber": impl_simple,
|
||||
"Length": impl_absolute_length,
|
||||
"Position": impl_position,
|
||||
|
@ -4797,11 +4799,11 @@ fn static_assert() {
|
|||
use values::Either;
|
||||
|
||||
match v {
|
||||
Either::Second(number) => {
|
||||
self.gecko.mTabSize.set_value(CoordDataValue::Factor(number));
|
||||
Either::Second(non_negative_number) => {
|
||||
self.gecko.mTabSize.set_value(CoordDataValue::Factor(non_negative_number.0));
|
||||
}
|
||||
Either::First(au) => {
|
||||
self.gecko.mTabSize.set(au);
|
||||
Either::First(non_negative_au) => {
|
||||
self.gecko.mTabSize.set(non_negative_au.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4811,8 +4813,8 @@ fn static_assert() {
|
|||
use values::Either;
|
||||
|
||||
match self.gecko.mTabSize.as_value() {
|
||||
CoordDataValue::Coord(coord) => Either::First(Au(coord)),
|
||||
CoordDataValue::Factor(number) => Either::Second(number),
|
||||
CoordDataValue::Coord(coord) => Either::First(Au(coord).into()),
|
||||
CoordDataValue::Factor(number) => Either::Second(From::from(number)),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue