Auto merge of #13275 - canaltinova:rotate, r=Manishearth

Normalize rotations in computed transforms

<!-- Please describe your changes on the following line: -->
Normalize rotations in computed transforms.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #13265  (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13275)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-09-15 11:38:32 -05:00 committed by GitHub
commit 2024487913
4 changed files with 69 additions and 1 deletions

View file

@ -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));

View file

@ -3732,6 +3732,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",
@ -13138,6 +13150,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",

View file

@ -0,0 +1,21 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Rotations should be normalized in computed transforms</title>
<style type="text/css">
#box {
width: 100px;
height: 100px;
transform: rotate3d(0.5,0.5,0.5,45deg);
background-color: red;
position: absolute;
top: 200px;
left: 200px;
}
</style>
</head>
<body>
<div id="box"></div>
</body>
</html>

View file

@ -0,0 +1,22 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Rotations should be normalized in computed transforms</title>
<link rel="match" href="normalize-rotation-ref.html">
<style type="text/css">
#box {
width: 100px;
height: 100px;
transform: rotate3d(1,1,1,45deg);
background-color: red;
position: absolute;
top: 200px;
left: 200px;
}
</style>
</head>
<body>
<div id="box"></div>
</body>
</html>