Wrong rotation direction for rotate3d(x,y,z,angle)

VERIFIED FIXED in Firefox 10

Status

()

defect
VERIFIED FIXED
8 years ago
7 years ago

People

(Reporter: waste, Assigned: mattwoodrow)

Tracking

10 Branch
mozilla11
x86
macOS
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox10- fixed, firefox11 fixed)

Details

(Whiteboard: [qa!])

Attachments

(4 attachments, 1 obsolete attachment)

Reporter

Description

8 years ago
Posted file HTML-demo
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22

Steps to reproduce:

Apply CSS3 3d rotation (rotate3d(0,0,1,50deg) to element.


Actual results:

Element rotated counterclockwise around axis 


Expected results:

According to the spec it should have rotated *clockwise*. (See http://www.eleqtriq.com/wp-content/static/demos/2011/mozbugs/)

Updated

8 years ago
Attachment #576138 - Attachment mime type: text/plain → text/html

Comment 1

8 years ago
I am fairly sure that this is invalid. As I see it, vector (0,0,1) is coming out of
the screen so any rotation will be as 'seen' from behind the screen; The rotation
that you want would be (0,0,-1,50deg).
[cf (1,0,0) being left to right, and (0,1,0) being top to bottom]
Component: General → Style System (CSS)
Product: Firefox → Core
QA Contact: general → style-system
Reporter

Comment 2

8 years ago
As I understand the spec the rotation vector is relative to the rotation origin of the elements local coordinate system. In the example the rotation occurs around a positive vector pointing towards the viewer, so a clockwise rotation should be a rotation from left to right IMHO. Another way to describe this rotation would be rotateZ(50deg), which works consistently in Fox and Webkit. The third way to describe this rotation would be to transfer vector and angle into a matrix. And again, applying a CSS3D transform with the resulting matrix, matrix3d(0.643,0.7663,0,0,-0.766,0.643,0,0,0,0,1,0,0,0,0,1) suddenly gives us the transformation we expected -clockwise around the Z-axis- consistently in Fox and Webkit.

However, even If your assumption would be true, this would mean that Webkit implementation has a bug. Unfortunately Webkit supports CSS3d for almost two years, which means every existing content will break in Fox10 causing new headaches for developers.  If this is the case, I as a developer would prefer the pragmatic solution that the spec is changed and Fox adopts the webkit way of handling rotations.

Comment 3

8 years ago
Posted file -1 in vector vs rotatex/y/z (obsolete) —
Reporter

Comment 4

8 years ago
According to the spec the axis angle combination is equivalent to this matrix3d transformation: matrix3d(1 + (1-cos(angle))*(x*x-1), -z*sin(angle)+(1-cos(angle))*x*y, y*sin(angle)+(1-cos(angle))*x*z, 0, z*sin(angle)+(1-cos(angle))*x*y, 1 + (1-cos(angle))*(y*y-1), -x*sin(angle)+(1-cos(angle))*y*z, 0, -y*sin(angle)+(1-cos(angle))*x*z, x*sin(angle)+(1-cos(angle))*y*z, 1 + (1-cos(angle))*(z*z-1), 0, 0, 0, 0, 1).

However, both transformations behave differently in aurora, one more indication that rotate3d is not implemented as expected.

Updated

8 years ago
Attachment #576443 - Attachment mime type: text/plain → text/html
Matt, can you take a look please?
Assignee: nobody → matt.woodrow
Blocks: 505115
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 6

8 years ago
Added -webkit-transform styles
Attachment #576434 - Attachment is obsolete: true

Comment 7

8 years ago
(In reply to Dirk from comment #2)
> ... And again, applying a CSS3D transform with
> the resulting matrix,
> matrix3d(0.643,0.7663,0,0,-0.766,0.643,0,0,0,0,1,0,0,0,0,1) suddenly gives
> us the transformation we expected -clockwise around the Z-axis- consistently
> in Fox and Webkit.

This is not the matrix you get when applying the algorithm from the spec

-z*sin(angle) gives -0.76626 so AFAICT we are following the standard but don't give
the same result as webkit.

[in attachment 576443 [details] computed styles are
 rotate3d: -moz-transform: matrix(0.642531, -0.76626, 0.76626, 0.642531, 0px, 0px);
 matrix3d: -moz-transform: matrix(0.643, 0.7663, -0.766, 0.643, 0px, 0px);]
Reporter

Comment 8

8 years ago
Your right! Well then -  hello again, inconsistencies and vendorprefix, my old friends :-/
We do need to figure out whether the bug is in the spec or in WebKit...
(And to be clear why there's a tracking nomination:  we should figure this out before we ship 3d transforms.)
Assignee

Comment 12

8 years ago
Looks like there is a consensus about this on www-style.

This patch reverse the rotation direction of rotate3d() with a note that it's still wrong in the spec.
Attachment #578940 - Flags: review?(dbaron)
Comment on attachment 578940 [details] [diff] [review]
Reverse the rotation direction

r=dbaron
Attachment #578940 - Flags: review?(dbaron) → review+
https://hg.mozilla.org/mozilla-central/rev/a0e9e2640477
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla11
Comment on attachment 578940 [details] [diff] [review]
Reverse the rotation direction

We shouldn't ship 3d transforms without this trivial fix, so requesting aurora approval.
Attachment #578940 - Flags: approval-mozilla-aurora?

Updated

8 years ago
Attachment #578940 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+

Comment 18

8 years ago
Verified s fixed using the attached test cases on:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0a2) Gecko/20111214 
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:11.0a1) Gecko/20111212
Status: RESOLVED → VERIFIED
Whiteboard: [qa!]

Updated

7 years ago
Depends on: 769892

Updated

7 years ago
No longer depends on: 769892
You need to log in before you can comment on or make changes to this bug.