Auto merge of #20124 - servo:perspective, r=emilio

Replace LengthOrNone by a specific type for the perspective property

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20124)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-02-26 16:35:32 -05:00 committed by GitHub
commit 6df0dc5b27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 113 additions and 68 deletions

View file

@ -1447,18 +1447,18 @@ impl Clone for ${style_struct.gecko_struct_name} {
# Types used with predefined_type()-defined properties that we can auto-generate.
predefined_types = {
"Color": impl_color,
"GreaterThanOrEqualToOneNumber": impl_simple,
"Integer": impl_simple,
"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,
"LengthOrNormal": impl_style_coord,
"LengthOrPercentage": impl_style_coord,
"LengthOrPercentageOrAuto": impl_style_coord,
"LengthOrPercentageOrNone": impl_style_coord,
"LengthOrNone": impl_style_coord,
"LengthOrNormal": impl_style_coord,
"MaxLength": impl_style_coord,
"MozLength": impl_style_coord,
"MozScriptMinSize": impl_absolute_length,
@ -1466,9 +1466,9 @@ impl Clone for ${style_struct.gecko_struct_name} {
"NonNegativeLengthOrPercentage": impl_style_coord,
"NonNegativeNumber": impl_simple,
"Number": impl_simple,
"Integer": impl_simple,
"Opacity": impl_simple,
"Color": impl_color,
"Perspective": impl_style_coord,
"Position": impl_position,
"RGBAColor": impl_rgba_color,
"SVGLength": impl_svg_length,
"SVGOpacity": impl_svg_opacity,
@ -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

@ -507,17 +507,17 @@ ${helpers.single_keyword("resize",
flags="APPLIES_TO_PLACEHOLDER",
animation_value_type="discrete")}
${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",
flags="CREATES_STACKING_CONTEXT FIXPOS_CB",
animation_value_type="ComputedValue",
servo_restyle_damage = "reflow_out_of_flow")}
${helpers.predefined_type(
"perspective",
"Perspective",
"computed::Perspective::none()",
gecko_ffi_name="mChildPerspective",
spec="https://drafts.csswg.org/css-transforms/#perspective",
extra_prefixes="moz webkit",
flags="CREATES_STACKING_CONTEXT FIXPOS_CB",
animation_value_type="AnimatedPerspective",
servo_restyle_damage = "reflow_out_of_flow",
)}
${helpers.predefined_type("perspective-origin",
"position::Position",

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")}