style: Simplify the SVG animation code.

It's overly generic for no good reason.

Differential Revision: https://phabricator.services.mozilla.com/D10844
This commit is contained in:
Emilio Cobos Álvarez 2018-11-04 15:48:08 +01:00
parent c88a483322
commit 5af6abfb78
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
5 changed files with 63 additions and 156 deletions

View file

@ -561,17 +561,24 @@ def set_gecko_property(ffi_name, expr):
return SVGLength::ContextValue;
}
let length = match self.gecko.${gecko_ffi_name}.as_value() {
CoordDataValue::Factor(number) =>
SvgLengthOrPercentageOrNumber::Number(number),
CoordDataValue::Coord(coord) =>
CoordDataValue::Factor(number) => {
SvgLengthOrPercentageOrNumber::Number(number)
},
CoordDataValue::Coord(coord) => {
SvgLengthOrPercentageOrNumber::LengthOrPercentage(
LengthOrPercentage::Length(Au(coord).into())),
CoordDataValue::Percent(p) =>
LengthOrPercentage::Length(Au(coord).into())
)
},
CoordDataValue::Percent(p) => {
SvgLengthOrPercentageOrNumber::LengthOrPercentage(
LengthOrPercentage::Percentage(Percentage(p))),
CoordDataValue::Calc(calc) =>
LengthOrPercentage::Percentage(Percentage(p))
)
},
CoordDataValue::Calc(calc) => {
SvgLengthOrPercentageOrNumber::LengthOrPercentage(
LengthOrPercentage::Calc(calc.into())),
LengthOrPercentage::Calc(calc.into())
)
},
_ => unreachable!("Unexpected coordinate in ${ident}"),
};
SVGLength::Length(length.into())