Bug 1360144 - make stroke-{*} animatable for stylo. r=boris

This part includes making stroke-linecap, stroke-linejoin, stroke-miterlimit,
stroke-opacity, and stroke-dasharray animatable.

For properties that already implemented Interpolate trait and clone() for
glue code, we can just make them animatable by replacing the animation_value_type
with proper type name. So, set animation_value_type to 'discrete' for
stroke-linecap and stroke-linejoin. Set animation_value_type to 'ComputedValue'
for stroke-miterlimit and stroke-opacity.

As to stroke-dasharray, we need to implement Interpolate trait and glue codes
for it.
This commit is contained in:
Jeremy Chen 2017-05-02 13:50:53 +08:00
parent 896a920ff5
commit 729b4f7901
3 changed files with 28 additions and 5 deletions

View file

@ -3808,6 +3808,26 @@ clip-path
bindings::Gecko_nsStyleSVG_CopyDashArray(&mut self.gecko, &other.gecko);
}
}
pub fn clone_stroke_dasharray(&self) -> longhands::stroke_dasharray::computed_value::T {
use smallvec::SmallVec;
use values::computed::LengthOrPercentage;
let mut vec = SmallVec::new();
for gecko in self.gecko.mStrokeDasharray.iter() {
match gecko.as_value() {
CoordDataValue::Factor(number) => vec.push(Either::First(number)),
CoordDataValue::Coord(coord) =>
vec.push(Either::Second(LengthOrPercentage::Length(Au(coord)))),
CoordDataValue::Percent(p) =>
vec.push(Either::Second(LengthOrPercentage::Percentage(p))),
CoordDataValue::Calc(calc) =>
vec.push(Either::Second(LengthOrPercentage::Calc(calc.into()))),
_ => unreachable!(),
}
}
longhands::stroke_dasharray::computed_value::T(vec)
}
</%self:impl_trait>
<%self:impl_trait style_struct_name="Color"