diff options
Diffstat (limited to 'components/layout')
-rw-r--r-- | components/layout/display_list_builder.rs | 17 | ||||
-rw-r--r-- | components/layout/model.rs | 11 |
2 files changed, 11 insertions, 17 deletions
diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index f2cf382a23a..5491e9d0bc6 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -1163,16 +1163,13 @@ impl FragmentDisplayListBuilding for Fragment { let matrix = match operation { &transform::ComputedOperation::Rotate(ax, ay, az, theta) => { let theta = f32::consts::PI_2 - theta.radians(); - let transform = Matrix4::create_rotation(ax, ay, az, theta); - pre_transform.mul(&transform).mul(&post_transform) + Matrix4::create_rotation(ax, ay, az, theta) } &transform::ComputedOperation::Perspective(d) => { - let transform = Matrix4::create_perspective(d.to_f32_px()); - pre_transform.mul(&transform).mul(&post_transform) + Matrix4::create_perspective(d.to_f32_px()) } &transform::ComputedOperation::Scale(sx, sy, sz) => { - let transform = Matrix4::create_scale(sx, sy, sz); - pre_transform.mul(&transform).mul(&post_transform) + Matrix4::create_scale(sx, sy, sz) } &transform::ComputedOperation::Translate(tx, ty, tz) => { let tx = tx.to_au(border_box.size.width).to_f32_px(); @@ -1181,17 +1178,17 @@ impl FragmentDisplayListBuilding for Fragment { Matrix4::create_translation(tx, ty, tz) } &transform::ComputedOperation::Matrix(m) => { - let transform = m.to_gfx_matrix(&border_box.size); - pre_transform.mul(&transform).mul(&post_transform) + m.to_gfx_matrix() } &transform::ComputedOperation::Skew(sx, sy) => { - let transform = Matrix4::create_skew(sx, sy); - pre_transform.mul(&transform).mul(&post_transform) + Matrix4::create_skew(sx, sy) } }; transform = transform.mul(&matrix); } + + transform = pre_transform.mul(&transform).mul(&post_transform); } // FIXME(pcwalton): Is this vertical-writing-direction-safe? diff --git a/components/layout/model.rs b/components/layout/model.rs index 87e4d3cf3db..ad6dd66cf17 100644 --- a/components/layout/model.rs +++ b/components/layout/model.rs @@ -8,7 +8,7 @@ use fragment::Fragment; -use geom::{Matrix4, SideOffsets2D, Size2D}; +use geom::{Matrix4, SideOffsets2D}; use std::cmp::{max, min}; use std::fmt; use style::computed_values::transform::ComputedMatrix; @@ -426,19 +426,16 @@ pub fn padding_from_style(style: &ComputedValues, containing_block_inline_size: } pub trait ToGfxMatrix { - fn to_gfx_matrix(&self, containing_size: &Size2D<Au>) -> Matrix4<f32>; + fn to_gfx_matrix(&self) -> Matrix4<f32>; } impl ToGfxMatrix for ComputedMatrix { - fn to_gfx_matrix(&self, containing_size: &Size2D<Au>) -> Matrix4<f32> { + fn to_gfx_matrix(&self) -> Matrix4<f32> { Matrix4 { m11: self.m11 as f32, m12: self.m12 as f32, m13: self.m13 as f32, m14: self.m14 as f32, m21: self.m21 as f32, m22: self.m22 as f32, m23: self.m23 as f32, m24: self.m24 as f32, m31: self.m31 as f32, m32: self.m32 as f32, m33: self.m33 as f32, m34: self.m34 as f32, - m41: self.m41.to_au(containing_size.width).to_f32_px(), - m42: self.m42.to_au(containing_size.height).to_f32_px(), - m43: self.m43 as f32, - m44: self.m44 as f32 + m41: self.m41 as f32, m42: self.m42 as f32, m43: self.m43 as f32, m44: self.m44 as f32 } } } |