Bug 1356941 - ComputedDistance for IntermediateBoxShadow. r?boris
MozReview-Commit-ID: 1ZOIXCkkcQ3
--- a/servo/components/style/properties/helpers/animated_properties.mako.rs
+++ b/servo/components/style/properties/helpers/animated_properties.mako.rs
@@ -2822,17 +2822,17 @@ impl ComputeDistance for TextShadowList
},
(None, None) => unreachable!(),
};
}
Ok(diff_squared)
}
}
-impl ComputeDistance for BoxShadow {
+impl ComputeDistance for IntermediateBoxShadow {
#[inline]
fn compute_distance(&self, other: &Self) -> Result<f64, ()> {
self.compute_squared_distance(other).map(|sd| sd.sqrt())
}
#[inline]
fn compute_squared_distance(&self, other: &Self) -> Result<f64, ()> {
if self.inset != other.inset {
@@ -2842,31 +2842,31 @@ impl ComputeDistance for BoxShadow {
try!(self.offset_y.compute_distance(&other.offset_y)),
try!(self.color.compute_distance(&other.color)),
try!(self.spread_radius.compute_distance(&other.spread_radius)),
try!(self.blur_radius.compute_distance(&other.blur_radius)) ];
Ok(list.iter().fold(0.0f64, |sum, diff| sum + diff * diff))
}
}
-impl ComputeDistance for BoxShadowList {
+impl ComputeDistance for IntermediateBoxShadowList {
#[inline]
fn compute_distance(&self, other: &Self) -> Result<f64, ()> {
self.compute_squared_distance(other).map(|sd| sd.sqrt())
}
#[inline]
fn compute_squared_distance(&self, other: &Self) -> Result<f64, ()> {
// The inset value must change
- let mut zero = BoxShadow {
+ let mut zero = IntermediateBoxShadow {
offset_x: Au(0),
offset_y: Au(0),
spread_radius: Au(0),
blur_radius: Au(0),
- color: CSSParserColor::RGBA(RGBA::transparent()),
+ color: IntermediateColor::IntermediateRGBA(IntermediateRGBA::transparent()),
inset: false,
};
let max_len = cmp::max(self.0.len(), other.0.len());
let mut diff_squared = 0.0f64;
for i in 0..max_len {
diff_squared += match (self.0.get(i), other.0.get(i)) {
(Some(shadow), Some(other)) => {