Created attachment 114073 [details] Test case with four foreignObjects in an SVG and displaying script output Given an SVG document with XHTML content embedded via <foreignObject>, the getBoundingClientRect() method should return the coordinates of the element with respect to foreignObject's coordinate space. Instead, it currently is returning the bounding box for object transformed into the web browser viewport. In the attachment (or hosted URL) the return value for getBoundingClientRect() should be the same for all four cases, always showing: {left:0, top:0, right:16, bottom:16}. The CSSOM View Module spec[1] for getBoundingClientRect() says: > The getClientRects() and getBoundingClientRect() methods provide information about the > position of the border box edges of an element relative to the viewport. …and elsewhere[2] explicitly defines _viewport_ as: > [...] defined by CSS 2.1 unless there is an ancestor `foreignObject` element in the > http://www.w3.org/2000/svg namespace in which case that element acts as viewport and > initial containing block. The current behavior is understandable, as it makes code like this[3] work more easily. However the current behavior is * …wrong, per the spec * …different from Firefox v7 (which gets this right), and * …less useful than the spec (scripter transformations can identify all four real screen corners of a rotated object, not the screen-aligned bounding box). [1] http://www.w3.org/TR/cssom-view/#the-getclientrects-and-getboundingclientrect-methods [2] http://www.w3.org/TR/cssom-view/#terminology [3] http://phrogz.net/SVG/html_location_in_svg.svg
There are numerous Chromium bugs surrounding transforms of foreign objects and events. e.g. http://code.google.com/p/chromium/issues/detail?id=116566 My guess is that this is the same issue.
Created attachment 427180 [details] Zoom foreignObject reproduction I think this is the same or a closely related issue to https://bugs.webkit.org/show_bug.cgi?id=173841, and here is a modified reproduction of that issue but inside a <foreignObject>
<rdar://problem/115000886>