Implement Servo_ParseTransformIntoMatrix.

DOMMatrix needs to convert a specified transform list into a matrix, so
we could rewrite to_transform_3d_matrix by generics for both specified
and computed transform lists.

Besides, we have to update the test case because we use Transform3D<f64> to
compute the matrix, instead of Transform3D<f32>, so the result will be
the same as that in Gecko. Using 0.3 may cause floating point issue
because (0.3f32 as f64) is not equal to 0.3 (i.e. floating point precision
issue), so using 0.25 instead.
This commit is contained in:
Boris Chiou 2017-11-27 14:26:17 +08:00
parent ac6e04ebfb
commit 3a38e815ec
16 changed files with 450 additions and 238 deletions

View file

@ -63,6 +63,10 @@ pub enum CalcUnit {
}
/// A struct to hold a simplified `<length>` or `<percentage>` expression.
///
/// In some cases, e.g. DOMMatrix, we support calc(), but reject all the relative lengths, and
/// to_computed_pixel_length_without_context() handles this case. Therefore, if you want to add a
/// new field, please make sure this function work properly.
#[derive(Clone, Copy, Debug, Default, MallocSizeOf, PartialEq)]
#[allow(missing_docs)]
pub struct CalcLengthOrPercentage {