Closed Bug 654145 Opened 13 years ago Closed 13 years ago

SVG getBoundingClientRect is affected by stroke-width

Categories

(Core :: SVG, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: joao.eiras, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Opera/9.80 (X11; Linux i686; U; en) Presto/2.8.131 Version/11.10
Build Identifier: Mozilla/5.0 (X11; Linux i686; rv:2.0.1) Gecko/20100101 Firefox/4.0.1

The values returned by getBoudingClientRect on a svg element is affected by stroke-width on that element or its children, while it should not. Stroking should be completely ignored when calculating the values for getBoudingClientRect.

Reproducible: Always

Steps to Reproduce:
1. Open provided TC, should say PASS
Attached image Testcase
Passes in recent Chrome and Opera.
Where is it written that it shouldn't include the stroke-width? If you want something that doesn't include the stroke width then use getBBox.
IE9 includes the stroke-width and as getBoundingClientRect is a Microsoft thing (http://msdn.microsoft.com/en-us/library/aa703987%28v=vs.85%29.aspx), it makes whatever IE does as right so that makes us right too :-)
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
Then this is a clear incompatibility with webkit and Opera, which have much older implementations of SVG than IE. I would presume that getBoudingClientRect in them is just an alias for getBBox.

What made me initially make a testcase for this was that despite stroke-width being included it's severely miscalculated. A stroke-width of 1 unit causes the bounding box to be reported with extra 4 units on each side, which is not true.
Do raise another bug for the bounds being miscalculated :-)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: