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