diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs
index 8574ce018a0..9a78c0d8909 100644
--- a/components/layout/display_list_builder.rs
+++ b/components/layout/display_list_builder.rs
@@ -1217,8 +1217,8 @@ impl FragmentDisplayListBuilding for Fragment {
transform::ComputedOperation::Matrix(m) => {
m.to_gfx_matrix()
}
- transform::ComputedOperation::Skew(sx, sy) => {
- Matrix4::create_skew(sx, sy)
+ transform::ComputedOperation::Skew(theta_x, theta_y) => {
+ Matrix4::create_skew(theta_x.radians(), theta_y.radians())
}
};
diff --git a/components/style/animation.rs b/components/style/animation.rs
index 34043e47a98..247ceb6b2a5 100644
--- a/components/style/animation.rs
+++ b/components/style/animation.rs
@@ -415,6 +415,13 @@ impl Interpolate for i32 {
}
}
+impl Interpolate for Angle {
+ #[inline]
+ fn interpolate(&self, other: &Angle, time: f64) -> Option {
+ self.radians().interpolate(&other.radians(), time).map(Angle)
+ }
+}
+
impl Interpolate for Visibility {
#[inline]
fn interpolate(&self, other: &Visibility, time: f64)
@@ -804,7 +811,7 @@ fn build_identity_transform_list(list: &Vec) -> Vec {
- result.push(TransformOperation::Skew(0.0, 0.0));
+ result.push(TransformOperation::Skew(Angle(0.0), Angle(0.0)));
}
TransformOperation::Translate(..) => {
result.push(TransformOperation::Translate(LengthOrPercentage::zero(),
diff --git a/components/style/properties.mako.rs b/components/style/properties.mako.rs
index 879a2aea195..57376f599ff 100644
--- a/components/style/properties.mako.rs
+++ b/components/style/properties.mako.rs
@@ -3610,7 +3610,7 @@ pub mod longhands {
#[derive(Clone, Debug, PartialEq, HeapSizeOf)]
pub enum ComputedOperation {
Matrix(ComputedMatrix),
- Skew(CSSFloat, CSSFloat),
+ Skew(computed::Angle, computed::Angle),
Translate(computed::LengthOrPercentage,
computed::LengthOrPercentage,
computed::Length),
@@ -3645,6 +3645,15 @@ pub mod longhands {
Ok((first, second))
}
+ fn parse_two_angles(input: &mut Parser) -> Result<(specified::Angle, specified::Angle),()> {
+ let first = try!(specified::Angle::parse(input));
+ let second = input.try(|input| {
+ try!(input.expect_comma());
+ specified::Angle::parse(input)
+ }).unwrap_or(specified::Angle(0.0));
+ Ok((first, second))
+ }
+
#[derive(Copy, Clone, Debug, PartialEq)]
enum TranslateKind {
Translate,
@@ -3657,7 +3666,7 @@ pub mod longhands {
#[derive(Clone, Debug, PartialEq)]
enum SpecifiedOperation {
Matrix(SpecifiedMatrix),
- Skew(CSSFloat, CSSFloat),
+ Skew(specified::Angle, specified::Angle),
Translate(TranslateKind,
specified::LengthOrPercentage,
specified::LengthOrPercentage,
@@ -3946,22 +3955,22 @@ pub mod longhands {
},
"skew" => {
try!(input.parse_nested_block(|input| {
- let (sx, sy) = try!(parse_two_floats(input));
- result.push(SpecifiedOperation::Skew(sx, sy));
+ let (theta_x, theta_y) = try!(parse_two_angles(input));
+ result.push(SpecifiedOperation::Skew(theta_x, theta_y));
Ok(())
}))
},
"skewx" => {
try!(input.parse_nested_block(|input| {
- let sx = try!(input.expect_number());
- result.push(SpecifiedOperation::Skew(sx, 1.0));
+ let theta_x = try!(specified::Angle::parse(input));
+ result.push(SpecifiedOperation::Skew(theta_x, specified::Angle(0.0)));
Ok(())
}))
},
"skewy" => {
try!(input.parse_nested_block(|input| {
- let sy = try!(input.expect_number());
- result.push(SpecifiedOperation::Skew(1.0, sy));
+ let theta_y = try!(specified::Angle::parse(input));
+ result.push(SpecifiedOperation::Skew(specified::Angle(0.0), theta_y));
Ok(())
}))
},
@@ -4009,8 +4018,8 @@ pub mod longhands {
SpecifiedOperation::Rotate(ax, ay, az, theta) => {
result.push(computed_value::ComputedOperation::Rotate(ax, ay, az, theta));
}
- SpecifiedOperation::Skew(sx, sy) => {
- result.push(computed_value::ComputedOperation::Skew(sx, sy));
+ SpecifiedOperation::Skew(theta_x, theta_y) => {
+ result.push(computed_value::ComputedOperation::Skew(theta_x, theta_y));
}
SpecifiedOperation::Perspective(d) => {
result.push(computed_value::ComputedOperation::Perspective(d.to_computed_value(context)));
diff --git a/tests/ref/basic.list b/tests/ref/basic.list
index b70bc02f9a0..8e3c6864a64 100644
--- a/tests/ref/basic.list
+++ b/tests/ref/basic.list
@@ -371,6 +371,7 @@ flaky_cpu == linebreak_simple_a.html linebreak_simple_b.html
== transform_3d.html transform_3d_ref.html
== transform_optimization.html transform_optimization_ref.html
== transform_simple_a.html transform_simple_ref.html
+== transform_skew_a.html transform_skew_ref.html
== transform_stacking_context_a.html transform_stacking_context_ref.html
== upper_id_attr.html upper_id_attr_ref.html
flaky_cpu,prefs:"layout.writing-mode.enabled" == vertical-lr-blocks.html vertical-lr-blocks_ref.html
diff --git a/tests/ref/transform_skew_a.html b/tests/ref/transform_skew_a.html
new file mode 100644
index 00000000000..72ca4790880
--- /dev/null
+++ b/tests/ref/transform_skew_a.html
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/ref/transform_skew_ref.html b/tests/ref/transform_skew_ref.html
new file mode 100644
index 00000000000..c0af1babcd2
--- /dev/null
+++ b/tests/ref/transform_skew_ref.html
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+