Comments and minor fixes

This commit is contained in:
Manish Goregaokar 2017-11-02 14:10:28 -07:00
parent 123bc1d6de
commit cb9645cd17
No known key found for this signature in database
GPG key ID: 3BBF4D3E2EF79F98
3 changed files with 13 additions and 6 deletions

View file

@ -3202,8 +3202,7 @@ fn static_assert() {
let result = match list { let result = match list {
Some(list) => { Some(list) => {
let vec: Vec<_> = list list.into_iter()
.into_iter()
.filter_map(|value| { .filter_map(|value| {
// Handle none transform. // Handle none transform.
if value.is_none() { if value.is_none() {
@ -3212,12 +3211,11 @@ fn static_assert() {
Some(Self::clone_single_transform_function(value)) Some(Self::clone_single_transform_function(value))
} }
}) })
.collect(); .collect::<Vec<_>>()
if !vec.is_empty() { Some(vec) } else { None }
}, },
_ => None, _ => vec![],
}; };
Transform(result.unwrap_or(vec!())) Transform(result)
} }
${impl_transition_time_value('delay', 'Delay')} ${impl_transition_time_value('delay', 'Delay')}

View file

@ -1438,6 +1438,8 @@ impl Animate for Matrix3D {
} }
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
// Gecko doesn't exactly follow the spec here; we use a different procedure
// to match it
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> { fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
let (from, to) = if self.is_3d() || other.is_3d() { let (from, to) = if self.is_3d() || other.is_3d() {
(decompose_3d_matrix(*self), decompose_3d_matrix(*other)) (decompose_3d_matrix(*self), decompose_3d_matrix(*other))
@ -1467,6 +1469,8 @@ impl Animate for Matrix {
} }
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
// Gecko doesn't exactly follow the spec here; we use a different procedure
// to match it
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> { fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
let from = decompose_2d_matrix(&(*self).into()); let from = decompose_2d_matrix(&(*self).into());
let to = decompose_2d_matrix(&(*other).into()); let to = decompose_2d_matrix(&(*other).into());
@ -2471,6 +2475,9 @@ impl ComputeSquaredDistance for ComputedTransformOperation {
} }
p_matrix.compute_squared_distance(&m) p_matrix.compute_squared_distance(&m)
} }
// Gecko cross-interpolates amongst all translate and all scale
// functions (See ToPrimitive in layout/style/StyleAnimationValue.cpp)
// without falling back to InterpolateMatrix
_ if self.is_translate() && other.is_translate() => { _ if self.is_translate() && other.is_translate() => {
self.to_translate_3d().compute_squared_distance(&other.to_translate_3d()) self.to_translate_3d().compute_squared_distance(&other.to_translate_3d())
} }

View file

@ -59,6 +59,8 @@ pub type Matrix = GenericMatrix<Number>;
/// computed value of matrix() in -moz-transform /// computed value of matrix() in -moz-transform
pub type PrefixedMatrix = GenericMatrix<Number, LengthOrPercentageOrNumber>; pub type PrefixedMatrix = GenericMatrix<Number, LengthOrPercentageOrNumber>;
// we rustfmt_skip here because we want the matrices to look like
// matrices instead of being split across lines
#[cfg_attr(rustfmt, rustfmt_skip)] #[cfg_attr(rustfmt, rustfmt_skip)]
impl Matrix3D { impl Matrix3D {
#[inline] #[inline]