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)]
48#[repr(C)]
49pub struct OffsetRotate {
50 #[animation(constant)]
55 #[css(represents_keyword)]
56 pub auto: bool,
57 #[css(contextual_skip_if = "is_auto_zero_angle")]
59 pub angle: Angle,
60}
61
62impl OffsetRotate {
63 #[inline]
65 pub fn auto() -> Self {
66 OffsetRotate {
67 auto: true,
68 angle: Zero::zero(),
69 }
70 }
71}