diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 30d51e1b1e8..20768a31f47 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -3077,6 +3077,9 @@ fn static_assert() { ${transform_function_arm("ScaleY", "scaley", ["number"])} ${transform_function_arm("ScaleZ", "scalez", ["number"])} ${transform_function_arm("Scale", "scale3d", ["number"] * 3)} + ${transform_function_arm("RotateX", "rotatex", ["angle"])} + ${transform_function_arm("RotateY", "rotatey", ["angle"])} + ${transform_function_arm("RotateZ", "rotatez", ["angle"])} ${transform_function_arm("Rotate", "rotate3d", ["number"] * 3 + ["angle"])} ${transform_function_arm("Perspective", "perspective", ["length"])} ${transform_function_arm("InterpolateMatrix", "interpolatematrix", @@ -3204,6 +3207,9 @@ fn static_assert() { ${computed_operation_arm("ScaleY", "scaley", ["number"])} ${computed_operation_arm("ScaleZ", "scalez", ["number"])} ${computed_operation_arm("Scale", "scale3d", ["number"] * 3)} + ${computed_operation_arm("RotateX", "rotatex", ["angle"])} + ${computed_operation_arm("RotateY", "rotatey", ["angle"])} + ${computed_operation_arm("RotateZ", "rotatez", ["angle"])} ${computed_operation_arm("Rotate", "rotate3d", ["number"] * 3 + ["angle"])} ${computed_operation_arm("Perspective", "perspective", ["length"])} ${computed_operation_arm("InterpolateMatrix", "interpolatematrix", diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 0afe77246a9..51f9d9c362e 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -1163,6 +1163,9 @@ impl ToAnimatedZero for TransformOperation { TransformOperation::ScaleX(_) => Ok(TransformOperation::ScaleX(1.)), TransformOperation::ScaleY(_) => Ok(TransformOperation::ScaleY(1.)), TransformOperation::ScaleZ(_) => Ok(TransformOperation::ScaleZ(1.)), + TransformOperation::RotateX(_) => Ok(TransformOperation::RotateX(Angle::zero())), + TransformOperation::RotateY(_) => Ok(TransformOperation::RotateY(Angle::zero())), + TransformOperation::RotateZ(_) => Ok(TransformOperation::RotateZ(Angle::zero())), TransformOperation::Rotate(x, y, z, a) => { let (x, y, z, _) = TransformList::get_normalized_vector_and_angle(x, y, z, a); Ok(TransformOperation::Rotate(x, y, z, Angle::zero())) diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index 622b48c79fd..44f42de0fa3 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -693,6 +693,9 @@ ${helpers.predefined_type( ScaleY(CSSFloat), ScaleZ(CSSFloat), Scale(CSSFloat, CSSFloat, CSSFloat), + RotateX(computed::Angle), + RotateY(computed::Angle), + RotateZ(computed::Angle), Rotate(CSSFloat, CSSFloat, CSSFloat, computed::Angle), Perspective(computed::Length), // For mismatched transform lists. @@ -1317,15 +1320,15 @@ ${helpers.predefined_type( } SpecifiedOperation::RotateX(theta) => { let theta = theta.to_computed_value(context); - result.push(computed_value::ComputedOperation::Rotate(1.0, 0.0, 0.0, theta)); + result.push(computed_value::ComputedOperation::RotateX(theta)); } SpecifiedOperation::RotateY(theta) => { let theta = theta.to_computed_value(context); - result.push(computed_value::ComputedOperation::Rotate(0.0, 1.0, 0.0, theta)); + result.push(computed_value::ComputedOperation::RotateY(theta)); } SpecifiedOperation::RotateZ(theta) => { let theta = theta.to_computed_value(context); - result.push(computed_value::ComputedOperation::Rotate(0.0, 0.0, 1.0, theta)); + result.push(computed_value::ComputedOperation::RotateZ(theta)); } SpecifiedOperation::Rotate3D(ax, ay, az, theta) => { let ax = ax.to_computed_value(context); @@ -1456,6 +1459,18 @@ ${helpers.predefined_type( Number::from_computed_value(sy), Number::from_computed_value(sz))); } + computed_value::ComputedOperation::RotateX(ref rx) => { + result.push(SpecifiedOperation::RotateX( + ToComputedValue::from_computed_value(rx))); + } + computed_value::ComputedOperation::RotateY(ref ry) => { + result.push(SpecifiedOperation::RotateY( + ToComputedValue::from_computed_value(ry))); + } + computed_value::ComputedOperation::RotateZ(ref rz) => { + result.push(SpecifiedOperation::RotateZ( + ToComputedValue::from_computed_value(rz))); + } computed_value::ComputedOperation::Rotate(ref ax, ref ay, ref az, ref theta) => { result.push(SpecifiedOperation::Rotate3D( Number::from_computed_value(ax), diff --git a/components/style/values/computed/transform.rs b/components/style/values/computed/transform.rs index 8ec14a5fdad..244055ba408 100644 --- a/components/style/values/computed/transform.rs +++ b/components/style/values/computed/transform.rs @@ -80,6 +80,18 @@ impl TransformList { for operation in list { let matrix = match *operation { + ComputedOperation::RotateX(theta) => { + let theta = Angle::from_radians(2.0f32 * f32::consts::PI - theta.radians()); + Transform3D::create_rotation(1., 0., 0., theta.into()) + } + ComputedOperation::RotateY(theta) => { + let theta = Angle::from_radians(2.0f32 * f32::consts::PI - theta.radians()); + Transform3D::create_rotation(0., 1., 0., theta.into()) + } + ComputedOperation::RotateZ(theta) => { + let theta = Angle::from_radians(2.0f32 * f32::consts::PI - theta.radians()); + Transform3D::create_rotation(0., 0., 1., theta.into()) + } ComputedOperation::Rotate(ax, ay, az, theta) => { let theta = Angle::from_radians(2.0f32 * f32::consts::PI - theta.radians()); let (ax, ay, az, theta) =