mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Use Rust types from transform-origin / perspective-origin.
Differential Revision: https://phabricator.services.mozilla.com/D20382
This commit is contained in:
parent
74d7d5bc42
commit
71daec59eb
4 changed files with 11 additions and 86 deletions
|
@ -21,7 +21,7 @@ pub type TransformOperation =
|
|||
pub type Transform = generic::Transform<TransformOperation>;
|
||||
|
||||
/// The computed value of a CSS `<transform-origin>`
|
||||
pub type TransformOrigin = generic::TransformOrigin<LengthPercentage, LengthPercentage, Length>;
|
||||
pub type TransformOrigin = generic::GenericTransformOrigin<LengthPercentage, LengthPercentage, Length>;
|
||||
|
||||
/// A vector to represent the direction vector (rotate axis) for Rotate3D.
|
||||
pub type DirectionVector = Vector3D<CSSFloat>;
|
||||
|
|
|
@ -83,7 +83,8 @@ impl<T: Into<f64>> From<Matrix3D<T>> for Transform3D<f64> {
|
|||
ToComputedValue,
|
||||
ToCss,
|
||||
)]
|
||||
pub struct TransformOrigin<H, V, Depth> {
|
||||
#[repr(C)]
|
||||
pub struct GenericTransformOrigin<H, V, Depth> {
|
||||
/// The horizontal origin.
|
||||
pub horizontal: H,
|
||||
/// The vertical origin.
|
||||
|
@ -92,14 +93,12 @@ pub struct TransformOrigin<H, V, Depth> {
|
|||
pub depth: Depth,
|
||||
}
|
||||
|
||||
pub use self::GenericTransformOrigin as TransformOrigin;
|
||||
|
||||
impl<H, V, D> TransformOrigin<H, V, D> {
|
||||
/// Returns a new transform origin.
|
||||
pub fn new(horizontal: H, vertical: V, depth: D) -> Self {
|
||||
Self {
|
||||
horizontal: horizontal,
|
||||
vertical: vertical,
|
||||
depth: depth,
|
||||
}
|
||||
Self { horizontal, vertical, depth }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue