Created attachment 576138 [details] 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/)

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]

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.

Created attachment 576434 [details] -1 in vector vs rotatex/y/z

Created attachment 576443 [details] rotate3d and equivalent matrix3d css3d transform 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.

Matt, can you take a look please?

Created attachment 576494 [details] -1 in vector vs rotatex/y/z Added -webkit-transform styles

(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);]

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...

See http://lists.w3.org/Archives/Public/www-style/2011Nov/0653.html

(And to be clear why there's a tracking nomination: we should figure this out before we ship 3d transforms.)

Created attachment 578940 [details] [diff] [review] Reverse the rotation direction 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.

Comment on attachment 578940 [details] [diff] [review] Reverse the rotation direction r=dbaron

https://hg.mozilla.org/integration/mozilla-inbound/rev/a0e9e2640477

https://hg.mozilla.org/mozilla-central/rev/a0e9e2640477

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.

https://hg.mozilla.org/releases/mozilla-aurora/rev/73f3cfb7ccce

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