mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Implement to_transform_3d_matrix for computing distance of mismatched transform lists.
We could use this method to convert a TransformList into a Matrix, and use this matrix for computing distance for Stylo and rendering the transform for Servo. This is an equivalent of nsStyleTransformMatrix::ReadTransforms in Gecko.
This commit is contained in:
parent
772a8464eb
commit
5c2d8507be
5 changed files with 215 additions and 146 deletions
|
@ -7,11 +7,10 @@
|
|||
#![deny(unsafe_code)]
|
||||
|
||||
use app_units::Au;
|
||||
use euclid::{Transform3D, SideOffsets2D, Size2D};
|
||||
use euclid::{SideOffsets2D, Size2D};
|
||||
use fragment::Fragment;
|
||||
use std::cmp::{max, min};
|
||||
use std::fmt;
|
||||
use style::computed_values::transform::ComputedMatrix;
|
||||
use style::logical_geometry::{LogicalMargin, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::{BorderCornerRadius, LengthOrPercentageOrAuto};
|
||||
|
@ -508,20 +507,6 @@ pub fn specified_margin_from_style(style: &ComputedValues,
|
|||
MaybeAuto::from_style(margin_style.margin_left, Au(0)).specified_or_zero()))
|
||||
}
|
||||
|
||||
pub trait ToGfxMatrix {
|
||||
fn to_gfx_matrix(&self) -> Transform3D<f32>;
|
||||
}
|
||||
|
||||
impl ToGfxMatrix for ComputedMatrix {
|
||||
fn to_gfx_matrix(&self) -> Transform3D<f32> {
|
||||
Transform3D::row_major(
|
||||
self.m11 as f32, self.m12 as f32, self.m13 as f32, self.m14 as f32,
|
||||
self.m21 as f32, self.m22 as f32, self.m23 as f32, self.m24 as f32,
|
||||
self.m31 as f32, self.m32 as f32, self.m33 as f32, self.m34 as f32,
|
||||
self.m41 as f32, self.m42 as f32, self.m43 as f32, self.m44 as f32)
|
||||
}
|
||||
}
|
||||
|
||||
/// A min-size and max-size constraint. The constructor has a optional `border`
|
||||
/// parameter, and when it is present the constraint will be subtracted. This is
|
||||
/// used to adjust the constraint for `box-sizing: border-box`, and when you do so
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue