From d99606a841cb0c00cc71745ef3c229730c1bb007 Mon Sep 17 00:00:00 2001 From: Boris Chiou Date: Thu, 31 Oct 2019 20:07:41 +0000 Subject: [PATCH] style: Add new layer messages for passing motion path info. This also includes the implementation of SetAnimatable, FromAnimatable, and merge the final matrix with motion path. Besides, we always use PathBuilderSkia for calculating the gfx::Path for web-renderer. Differential Revision: https://phabricator.services.mozilla.com/D50011 --- components/style/values/specified/svg_path.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/components/style/values/specified/svg_path.rs b/components/style/values/specified/svg_path.rs index 4f49029b51e..9a94af6a82f 100644 --- a/components/style/values/specified/svg_path.rs +++ b/components/style/values/specified/svg_path.rs @@ -46,7 +46,7 @@ impl SVGPathData { /// Create a normalized copy of this path by converting each relative /// command to an absolute command. - fn normalize(&self) -> Box<[PathCommand]> { + pub fn normalize(&self) -> Self { let mut state = PathTraversalState { subpath_start: CoordPair::new(0.0, 0.0), pos: CoordPair::new(0.0, 0.0), @@ -56,7 +56,8 @@ impl SVGPathData { .iter() .map(|seg| seg.normalize(&mut state)) .collect::>(); - result.into_boxed_slice() + + SVGPathData(crate::ArcSlice::from_iter(result.into_iter())) } } @@ -119,8 +120,9 @@ impl Animate for SVGPathData { // re-normalize again. let result = self .normalize() + .0 .iter() - .zip(other.normalize().iter()) + .zip(other.normalize().0.iter()) .map(|(a, b)| a.animate(&b, procedure)) .collect::, _>>()?; @@ -134,8 +136,9 @@ impl ComputeSquaredDistance for SVGPathData { return Err(()); } self.normalize() + .0 .iter() - .zip(other.normalize().iter()) + .zip(other.normalize().0.iter()) .map(|(this, other)| this.compute_squared_distance(&other)) .sum() }