[Bug 16377] Define handling of singular 3D transforms

https://www.w3.org/Bugs/Public/show_bug.cgi?id=16377

--- Comment #3 from Aryeh Gregor <ayg@aryeh.name> 2012-03-15 16:20:06 UTC ---
(In reply to comment #2)
> It might be a good idea to look what SVG does.

SVG only supports 2D transforms, and there it's obvious that everything should
disappear.  A singular 2D transform maps everything to a line or a point, so it
has zero thickness.  A singular 3D transform can map everything to a plane, so
it's not obvious that it should disappear.  scaleZ(0) projects everything to
the x-y plane, but everything started out on the x-y plane, so it would make
sense for it to be a no-op rather than making everything disappear.

However, I think we should indeed spec that everything disappears.  We can
rationalize this by saying that elements don't really have zero thickness, but
rather infinitesimal thickness, and if you squish them to zero thickness they
vanish.

> Now to the bounding box. If you check the bounding box of the SVGGElement if no
> transform was applied to the rect, it should be (100,100,100,100).
> 
> But when you check the bounding box with the transform on the child, you get
> (0,0,0,0), as if no rect was in the DOM.

This isn't how most browsers behave with singular 2D transforms. 
getBoundingClientRect() returns the smallest rectangle that would contain the
transformed element, same as always.  If it gets mapped to a point, it returns
a rectangle at that point with no width and height.  Test-case:

data:text/html,<!doctype html>
<body style="margin:0">
<div style="height:100px; width:100px;
-ms-transform: scale(0);
-moz-transform: scale(0);
-webkit-transform: scale(0);
-o-transform: scale(0)"></div>
<script>
var rect = document.querySelector("div").getBoundingClientRect();
document.body.textContent = rect.top + "," + rect.right + ","
+ rect.bottom + "," + rect.left;
</script>

In Firefox 14.0a1, Chrome 19 dev, WebKit nightly r109732 on Windows, and Opera
Next 12.00 alpha, this outputs "50,50,50,50".  In IE10 Developer Preview, it
outputs apparent gibberish ("0.4399871826171875,100,100.44000244140625,0"),
which seems like an IE bug.  If there were no rendered box at all, it would be
"0,0,0,0".

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Thursday, 15 March 2012 16:20:15 UTC