Closed Bug 897333 Opened 12 years ago Closed 12 years ago

SVG getBBox and getBoundingClientRect incorrect results

Categories

(Core :: SVG, defect)

22 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: marcjeanmougin, Unassigned)

Details

Attachments

(1 file)

Attached file Minimal example
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0 (Beta/Release) Build ID: 20130627161625 Steps to reproduce: [[ tested on firefox 22.0 on linux and aurora 24.0a on windows ]] (see attachment) : trying to get a BBox and a BoundingClientRect from a svg element (path) Actual results: - when there is a stroke, the BoundingClientRect is WAY larger than the object (about 4 times the stroke width away) - the BBox does not take the stroke width into account at all - the BBox does not take the transform into account at all (shadow object is right one without transforms) - the BoudingClientRect when there are transformations seems to have nothing to do with the element but seems to be (the boundingclientrect of ((the bouding box of the object [without transforms, see 3rd point])transformed) ) Expected results: I'm not 100% certain, but from what I understood of the CSSOM and SVG1.1 specs, - the getBoundingClientRect should return the same thing as getBBox[1][2], not taking into account the strokeWidth (even if i wish it did, but in any case, why taking 4 times the strokeWidth and not strokeWidth/2 ?) - the getBBox should take into account the transformations ? [2] [1] (getBoundingClientRect) "returns [...]object that describes the bounding box of the element as defined by the SVG specification.[3]" ( http://www.w3.org/TR/cssom-view/#the-getclientrects-and-getboundingclientrect-methods ) [2] (getBBox) "Returns the tight bounding box in current user space (i.e., after application of the ‘transform’ attribute, if any) on the geometry of all contained graphics elements, exclusive of stroking, clipping, masking and filter effects). Note that getBBox must return the actual bounding box at the time the method was called, even in case the element has not yet been rendered." ( http://www.w3.org/TR/SVG/types.html#__svg__SVGLocatable__getBBox ) [3] "The bounding box is the tightest fitting rectangle aligned with the axes of the applicable element's user coordinate system that entirely encloses the applicable element and its descendants. The bounding box is computed exclusive of any values for clipping, masking, filter effects, opacity and stroke-width."
Summary: SVG getBBox and getBoudingClientRect incorrect results → SVG getBBox and getBoundingClientRect incorrect results
Please raise one bug per issue though point 2 is your misunderstanding, per spec getBBox ignores stroke width. I'm marking this invalid as we can't track more than one thing per bug.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
Attachment #780166 - Attachment mime type: text/plain → text/html
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: