style/values/computed/
motion.rs1use crate::derives::*;
8use crate::values::computed::basic_shape::BasicShape;
9use crate::values::computed::url::ComputedUrl;
10use crate::values::computed::{Angle, LengthPercentage, Position};
11use crate::values::generics::motion::{
12 GenericOffsetPath, GenericOffsetPathFunction, GenericOffsetPosition, GenericRayFunction,
13};
14use crate::Zero;
15
16pub type RayFunction = GenericRayFunction<Angle, Position>;
18
19pub type OffsetPathFunction = GenericOffsetPathFunction<BasicShape, RayFunction, ComputedUrl>;
21
22pub type OffsetPath = GenericOffsetPath<OffsetPathFunction>;
24
25pub type OffsetPosition = GenericOffsetPosition<LengthPercentage, LengthPercentage>;
27
28#[inline]
29fn is_auto_zero_angle(auto: &bool, angle: &Angle) -> bool {
30 *auto && angle.is_zero()
31}
32
33#[derive(
35 Animate,
36 Clone,
37 ComputeSquaredDistance,
38 Copy,
39 Debug,
40 Deserialize,
41 MallocSizeOf,
42 PartialEq,
43 Serialize,
44 ToAnimatedValue,
45 ToAnimatedZero,
46 ToCss,
47 ToResolvedValue,
48 ToTyped,
49)]
50#[repr(C)]
51#[typed(todo_derive_fields)]
52pub struct OffsetRotate {
53 #[animation(constant)]
58 #[css(represents_keyword)]
59 pub auto: bool,
60 #[css(contextual_skip_if = "is_auto_zero_angle")]
62 pub angle: Angle,
63}
64
65impl OffsetRotate {
66 #[inline]
68 pub fn auto() -> Self {
69 OffsetRotate {
70 auto: true,
71 angle: Zero::zero(),
72 }
73 }
74}