From 20b3c4bf21b8cc2bdc378a77e180cfaa0ec242fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Naz=C4=B1m=20Can=20Alt=C4=B1nova?= Date: Thu, 15 Sep 2016 15:32:34 +0300 Subject: [PATCH] Normalize rotations in computed transforms --- .../style/properties/longhand/effects.mako.rs | 3 ++- tests/wpt/mozilla/meta/MANIFEST.json | 24 +++++++++++++++++++ .../tests/css/normalize-rotation-ref.html | 21 ++++++++++++++++ .../mozilla/tests/css/normalize-rotation.html | 22 +++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 tests/wpt/mozilla/tests/css/normalize-rotation-ref.html create mode 100644 tests/wpt/mozilla/tests/css/normalize-rotation.html diff --git a/components/style/properties/longhand/effects.mako.rs b/components/style/properties/longhand/effects.mako.rs index 6e58419ce452..c7865e53ba02 100644 --- a/components/style/properties/longhand/effects.mako.rs +++ b/components/style/properties/longhand/effects.mako.rs @@ -1099,7 +1099,8 @@ ${helpers.predefined_type("opacity", result.push(computed_value::ComputedOperation::Scale(sx, sy, sz)); } SpecifiedOperation::Rotate(ax, ay, az, theta) => { - result.push(computed_value::ComputedOperation::Rotate(ax, ay, az, theta)); + let len = (ax * ax + ay * ay + az * az).sqrt(); + result.push(computed_value::ComputedOperation::Rotate(ax / len, ay / len, az / len, theta)); } SpecifiedOperation::Skew(theta_x, theta_y) => { result.push(computed_value::ComputedOperation::Skew(theta_x, theta_y)); diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index bbc79260a5fb..2e317963759a 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -3720,6 +3720,18 @@ "url": "/_mozilla/css/non-inline-block-resets-underline-property.html" } ], + "css/normalize-rotation.html": [ + { + "path": "css/normalize-rotation.html", + "references": [ + [ + "/_mozilla/css/normalize-rotation-ref.html", + "==" + ] + ], + "url": "/_mozilla/css/normalize-rotation.html" + } + ], "css/noscript.html": [ { "path": "css/noscript.html", @@ -13114,6 +13126,18 @@ "url": "/_mozilla/css/non-inline-block-resets-underline-property.html" } ], + "css/normalize-rotation.html": [ + { + "path": "css/normalize-rotation.html", + "references": [ + [ + "/_mozilla/css/normalize-rotation-ref.html", + "==" + ] + ], + "url": "/_mozilla/css/normalize-rotation.html" + } + ], "css/noscript.html": [ { "path": "css/noscript.html", diff --git a/tests/wpt/mozilla/tests/css/normalize-rotation-ref.html b/tests/wpt/mozilla/tests/css/normalize-rotation-ref.html new file mode 100644 index 000000000000..65fbe7907e84 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/normalize-rotation-ref.html @@ -0,0 +1,21 @@ + + + + + Rotations should be normalized in computed transforms + + + +
+ + diff --git a/tests/wpt/mozilla/tests/css/normalize-rotation.html b/tests/wpt/mozilla/tests/css/normalize-rotation.html new file mode 100644 index 000000000000..c689f9e92e6c --- /dev/null +++ b/tests/wpt/mozilla/tests/css/normalize-rotation.html @@ -0,0 +1,22 @@ + + + + + Rotations should be normalized in computed transforms + + + + +
+ +