Re: Clarification on getBBox() with shapes of zero width

On Aug 6, 2012, at 2:55 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> On Mon, Aug 6, 2012 at 2:33 PM, Philip Rogers <pdr@google.com> wrote:
>> 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
> 
> Yes, (0, 100) should be the correct answer.  It would be great if we
> could change to align with IE and Opera here, so that answer has a
> majority and FF can change.

Well, it depends on the interpretation of ""A negative value is an error. A value of zero disables rendering of the
element". Actually it says it should not be rendered. So no renderer is created, like for display: none? I would interpret it as not rendering, no renderer, no bounding box. So FF and Webkit behavior sound reasonable before.

We had bug reports for that on WebKit before and discussed it with people from Mozilla and they had the same understanding.

Greetings,
Dirk

> 
> ~TJ
> 

Received on Monday, 6 August 2012 23:55:51 UTC