style: Use Rust types from transform-origin / perspective-origin.

Differential Revision: https://phabricator.services.mozilla.com/D20382
This commit is contained in:
Emilio Cobos Álvarez 2019-02-19 20:28:47 +00:00
parent 74d7d5bc42
commit 71daec59eb
4 changed files with 11 additions and 86 deletions

View file

@ -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>;

View file

@ -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 }
}
}