Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
BorisChiou authored and emilio committed Nov 4, 2019
1 parent fc1233f commit d99606a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions components/style/values/specified/svg_path.rs
Expand Up @@ -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),
Expand All @@ -56,7 +56,8 @@ impl SVGPathData {
.iter()
.map(|seg| seg.normalize(&mut state))
.collect::<Vec<_>>();
result.into_boxed_slice()

SVGPathData(crate::ArcSlice::from_iter(result.into_iter()))
}
}

Expand Down Expand Up @@ -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::<Result<Vec<_>, _>>()?;

Expand All @@ -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()
}
Expand Down

0 comments on commit d99606a

Please sign in to comment.