W3C home > Mailing lists > Public > www-svg@w3.org > August 2012

Clarification on getBBox() with shapes of zero width

From: Philip Rogers <pdr@google.com>
Date: Mon, 6 Aug 2012 14:33:01 -0700
Message-ID: <CAJgFLLvPwPxviX+BfuK4e=Y9kk3zFz5zE56BakHgZnQqke0mzg@mail.gmail.com>
To: www-svg@w3.org
Hello www-svg!

I'm looking for clarification on what getBBox() should return for this:
<rect height="100" width="0" />

I think the correct result is to return an SVGRect of width 0 and height
100. This is due to the following sections of the spec:
[1] "A negative value is an error. A value of zero disables rendering of
the element."
[2] "Returns the tight bounding box in current user space ... 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."

Currently in browserland Opera and IE9 agree with me; Firefox, Chrome, and
Safari disagree and return a bounding box of size (0,0).

This recently came up as part of
https://bugs.webkit.org/show_bug.cgi?id=93290

[1]
http://www.w3.org/TR/SVG/single-page.html#shapes-RectElementWidthAttribute
[2]
http://www.w3.org/TR/SVG/single-page.html#types-__svg__SVGLocatable__getBBox

Thanks,
Philip
Received on Monday, 6 August 2012 21:33:48 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:51 GMT