Skip to content

Commit

Permalink
style: Use the standalone struct and enum for the flags in SVG path.
Browse files Browse the repository at this point in the history
We define the standalone types for using derive macro easily and overriding
the behaviors of this traits. This could avoid defining the general
behavior of booleans.

Depends on D4788

Differential Revision: https://phabricator.services.mozilla.com/D4813
  • Loading branch information
BorisChiou authored and emilio committed Sep 9, 2018
1 parent b0604c9 commit 31fc6cd
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 130 deletions.
14 changes: 0 additions & 14 deletions components/style/values/animated/mod.rs
Expand Up @@ -141,20 +141,6 @@ impl Animate for f64 {
}
}

/// This is only used in SVG PATH. We return Err(()) if the flags are mismatched.
// FIXME: Bug 653928: If we want to do interpolation on the flags in Arc, we have to update this
// because `absolute`, `large_arc_flag`, and `sweep_flag` are using this implementation for now.
impl Animate for bool {
#[inline]
fn animate(&self, other: &Self, _procedure: Procedure) -> Result<Self, ()> {
if *self == *other {
Ok(*other)
} else {
Err(())
}
}
}

impl<T> Animate for Option<T>
where
T: Animate,
Expand Down
7 changes: 0 additions & 7 deletions components/style/values/distance.rs
Expand Up @@ -81,13 +81,6 @@ impl ComputeSquaredDistance for Au {
}
}

impl ComputeSquaredDistance for bool {
#[inline]
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
(*self as i32).compute_squared_distance(&(*other as i32))
}
}

impl<T> ComputeSquaredDistance for Option<T>
where
T: ComputeSquaredDistance,
Expand Down

0 comments on commit 31fc6cd

Please sign in to comment.