Closed Bug 755947 Opened 9 years ago Closed 9 years ago
Bounding Client Rect differs from all other browsers for transformed SVG elements
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5 Steps to reproduce: Call getBoundingClientRect() on an SVG element that has a rotated transform. Actual results: The "client rect" is exactly as big as the element itself. Expected results: Firefox should behave in a manner consistent with Chrome, Safari, Opera, and IE9: the client rect should be the bounding box of the transformed points of the local bounding box of the object.
Note that I personally prefer the current behavior in Firefox (as described in http://phrogz.net/getboundingclientrect-is-lame-for-svg). With a clear indication that this behavior is incorrect per the specification, I'll happily withdraw this bug and file bugs with the other browsers. However, the specifications seem to me to be unclear on how this should behave (leaning in favor of the behavior by the "other browsers"), and as such Firefox being the odd man out appears to be a bug.
Attachment #624576 - Attachment mime type: text/plain → text/html
http://go2ghana.net/devel/svg/demo.php worked in Chrome 10 according to bug 460946. The specification just says it's the bounding box according to the SVG specification http://dev.w3.org/csswg/cssom-view/#the-getclientrects-and-getboundingclientrect-methods (which is wrong since it's supposed to include stroke as well). The SVG specification says it's the tight bounding box after transforms not the tight bounding box transformed so I think we're good on the transform part. http://www.w3.org/TR/SVG/types.html#__svg__SVGLocatable__getBBox
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
Component: Untriaged → SVG
Product: Firefox → Core
QA Contact: untriaged → general
I do prefer what FF has done here, but I'm not sure about your argument. Yes, the CSSOM View spec punts to SVG, but the SVG spec you reference is talking specifically about the getBBox method, which explicitly mentions accounting for the transform, being in the current user space of the element, and excluding stroke. Is there any W3C errata or discussion you can point to which clarifies that the bounding box of an element for the purposes of getBoundingClientRect() should be tight and axis-aligned in ownerSVGElement space? If so, I can use that as an argument against other browsers. Without it...it seems simply underspecified.
That's all the text there is that I know about. There was a discussion about including CSS transforms: http://old.nabble.com/-CSSOM--Revisiting-transforms-and-getBoundingClientRect%28%29-td31636050.html which led to Firefox 12 including CSS transforms.
Arguably the CSSOM specification should change. We'll stay as we are till it does.
Resolution: INVALID → WONTFIX
You need to log in before you can comment on or make changes to this bug.