mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Introduce Matrix for matrix() transformations
This commit is contained in:
parent
5f1cb084d0
commit
118291ca91
2 changed files with 81 additions and 69 deletions
|
@ -9,6 +9,20 @@ use std::fmt;
|
|||
use style_traits::{HasViewportPercentage, ToCss};
|
||||
use values::CSSFloat;
|
||||
|
||||
/// A generic 2D transformation matrix.
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue, ToCss)]
|
||||
#[css(comma, function)]
|
||||
pub struct Matrix<T, U = T> {
|
||||
pub a: T,
|
||||
pub b: T,
|
||||
pub c: T,
|
||||
pub d: T,
|
||||
pub e: U,
|
||||
pub f: U,
|
||||
}
|
||||
|
||||
/// A generic transform origin.
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, HasViewportPercentage, PartialEq, ToComputedValue, ToCss)]
|
||||
|
@ -37,10 +51,6 @@ pub enum TimingFunction<Integer, Number> {
|
|||
Frames(Integer),
|
||||
}
|
||||
|
||||
impl<I, N> HasViewportPercentage for TimingFunction<I, N> {
|
||||
fn has_viewport_percentage(&self) -> bool { false }
|
||||
}
|
||||
|
||||
define_css_keyword_enum! { TimingKeyword:
|
||||
"linear" => Linear,
|
||||
"ease" => Ease,
|
||||
|
@ -67,6 +77,10 @@ impl<H, V, D> TransformOrigin<H, V, D> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<I, N> HasViewportPercentage for TimingFunction<I, N> {
|
||||
fn has_viewport_percentage(&self) -> bool { false }
|
||||
}
|
||||
|
||||
impl<Integer, Number> TimingFunction<Integer, Number> {
|
||||
/// `ease`
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue