diff options
author | Boris Chiou <boris.chiou@gmail.com> | 2017-11-27 14:26:17 +0800 |
---|---|---|
committer | Boris Chiou <boris.chiou@gmail.com> | 2017-11-28 10:08:12 +0800 |
commit | 3a38e815ecbbcb7ae5ba93d9763894c4907fb87a (patch) | |
tree | 3cad321ed9202d0390de355b1c5afcf758808d28 /components/layout/fragment.rs | |
parent | ac6e04ebfbf27317fea00ea93e855520237b538d (diff) | |
download | servo-3a38e815ecbbcb7ae5ba93d9763894c4907fb87a.tar.gz servo-3a38e815ecbbcb7ae5ba93d9763894c4907fb87a.zip |
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.
Diffstat (limited to 'components/layout/fragment.rs')
-rw-r--r-- | components/layout/fragment.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 020c4b65ab3..5366502ac51 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -46,13 +46,13 @@ use style::computed_values::{transform_style, white_space, word_break}; use style::computed_values::content::ContentItem; use style::logical_geometry::{Direction, LogicalMargin, LogicalRect, LogicalSize, WritingMode}; use style::properties::ComputedValues; -use style::properties::longhands::transform::computed_value::T as TransformList; use style::selector_parser::RestyleDamage; use style::servo::restyle_damage::ServoRestyleDamage; use style::str::char_is_whitespace; use style::values::{self, Either, Auto}; use style::values::computed::{Length, LengthOrPercentage, LengthOrPercentageOrAuto}; use style::values::generics::box_::VerticalAlign; +use style::values::generics::transform; use text; use text::TextRunScanner; use webrender_api; @@ -2895,7 +2895,7 @@ impl Fragment { /// Returns the 4D matrix representing this fragment's transform. pub fn transform_matrix(&self, stacking_relative_border_box: &Rect<Au>) -> Option<Transform3D<f32>> { let list = &self.style.get_box().transform; - let transform = list.to_transform_3d_matrix(Some(stacking_relative_border_box))?; + let transform = list.to_transform_3d_matrix(Some(stacking_relative_border_box)).ok()?.0; let transform_origin = &self.style.get_box().transform_origin; let transform_origin_x = @@ -2939,7 +2939,7 @@ impl Fragment { -perspective_origin.y, 0.0); - let perspective_matrix = TransformList::create_perspective_matrix(length.px()); + let perspective_matrix = transform::create_perspective_matrix(length.px()); Some(pre_transform.pre_mul(&perspective_matrix).pre_mul(&post_transform)) } |