mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
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:
parent
c88a483322
commit
5af6abfb78
5 changed files with 63 additions and 156 deletions
|
@ -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())
|
||||
|
|
|
@ -85,7 +85,7 @@ ${helpers.predefined_type(
|
|||
|
||||
${helpers.predefined_type(
|
||||
"stroke-width", "SVGWidth",
|
||||
"::values::computed::NonNegativeLength::new(1.).into()",
|
||||
"computed::SVGWidth::one()",
|
||||
products="gecko",
|
||||
animation_value_type="::values::computed::SVGWidth",
|
||||
spec="https://www.w3.org/TR/SVG2/painting.html#StrokeWidth",
|
||||
|
@ -135,8 +135,9 @@ ${helpers.predefined_type(
|
|||
)}
|
||||
|
||||
${helpers.predefined_type(
|
||||
"stroke-dashoffset", "SVGLength",
|
||||
"Au(0).into()",
|
||||
"stroke-dashoffset",
|
||||
"SVGLength",
|
||||
"computed::SVGLength::zero()",
|
||||
products="gecko",
|
||||
animation_value_type="ComputedValue",
|
||||
spec="https://www.w3.org/TR/SVG2/painting.html#StrokeDashing",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue