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

Hi,

getBBox() "Returns the tight bounding box in current user space"
therefore is independent of any rasterizers, Cairo or anything like that.

Robert, I very much doubt the code in FF is reaching down into Cairo
to get the boudning box unless you are doing some weird reverse transform
that I did at one time and found it couldn't follow the getBBox implementation
rules and tests.

So no doubt (0,100) is correct.

Similarly, display:none has no effect on the user space co-ordinate system
and should return the same values.

Philip is correct, Opera is the only implementation in the tested group
that does the correct thing.

Returning a value of (0,0) for display:none is wrong - the calculation
should be done in user space where the element exists and whether it
gets rendered or not is immaterial in regard to its actual geometry.

Alex

--Original Message--:
>On the topic of how this is implemented at the moment... 
>
>getBBox() on a one-dimensional rect:
><rect height="100" width="0"/>Chrome: (0,0)
>Firefox: (0,0)
>IE: (0,100)
>Opera: (0,100)
>
>getBBox() on a display:none rect:
><rect height="100" width="100" style="display:none"/>
>
>Chrome: (0,0)
>Firefox: Throws NS_ERROR_FAILURE (see https://bugzilla.mozilla.org/show_bug.cgi?id=612118)
>IE: (100,200) (the lacuna value?)
>Opera: (100,100)
>
>getBBox() on a "one-dimensional" line:
><line x1="100" y1="100" x2="100" y2="200" />
>
>Chrome: (0,100)
>Firefox: (0,100)
>IE: (0,100)
>Opera: (0,100)
>
>I think everyone is getting something wrong, except maybe Opera.
>
>As an implementer, returning the correct values for width=0 in WebKit will not be too hard and will be easiest to understand for users.
>
>The display:none case will require working around a well-known optimization in SVG in IE/Firefox/Chrome where a render tree is not created for display:none nodes, so I would like to argue we should return a rect of size (0,0) in that case. This attribute is already not animatable so I do not think it will be surprising.
>
>Philip
>
>
>On Tue, Aug 7, 2012 at 1:58 PM, Dirk Schulze <dschulze@adobe.com> wrote:
>
>
>On Aug 7, 2012, at 1:55 PM, Philip Rogers <pdr@google.com> wrote:
>
>>Dirk,
>>
>>You've said this a few times but it is not true: " A shape with one dimension does not get rendered and is in error."
>>The spec says it does not get rendered, but it is not in error.
>
>Yes, just noticed it. Thanks for the clarification.
>
>Dirk
>
>>
>>For getBBox() you can calculate the size of rects, ellipses, and circles analytically from just the width/height/radii without creating any renderers. This is simple because getBBox() is exclusive of "complicated' things like strokes, markers, etc, so you can rely on the attributes alone.
>>
>>Philip
>>
>>
>>On Tue, Aug 7, 2012 at 1:47 PM, Dirk Schulze <dschulze@adobe.com> wrote:
>>
>>On Aug 7, 2012, at 12:23 PM, Rick <graham.rick@gmail.com> wrote:
>>
>>>
>>>On Tue, Aug 7, 2012 at 2:51 PM, Robert Longson <longsonr@gmail.com> wrote:
>>>In most cases nobody wants this so why clutter up UA code with it. In the extremely rare cases you need it I don't see why the svg file shouldn't have an "ugly hack" rather than having dozens of lines of mostly unused ugly hack UA code handle it.
>>>
>>>
>>>As a content developer, I expect the geometry of SVG elements to be correct.
>>>
>>>Let me suggest this another way then.
>>>
>>>I don't think introducing illogical hacks into the SVG spec to solve coding problems for specific UA's sets a good precedent.
>>>
>>>As a former UA implementer, I ask, what impact does this have on other UA's?  Should they adopt your hack because you don't want to check for a zero in your rendering pipeline?
>>
>>It is not necessarily a hack. It is an inconsistency in the spec. A lot of engines create renderers for rendering content. A shape with one dimension does not get rendered and is in error. That is the spec text. So if it is in error, why do you expect reasonable results from it? It is not just Firefox that behaves like that, but also WebKit and all WebKit based browsers/applications.
>>
>>Greetings,
>>Dirk
>>
>>>
>>>
>>>Robert
>>>
>>>
>>>On 7 August 2012 19:47, Rick <graham.rick@gmail.com> wrote:
>>>
>>>
>>>On Tue, Aug 7, 2012 at 2:03 PM, Robert Longson <longsonr@gmail.com> wrote:
>>>>>If you want the shape included then give it a small non-zero width/height hidden visibility.
>>>
>>>Making a rectangle of zero width not render is logical, but it is still a legal rectangle object and can be interacted with, so it should have geometry semantics.
>>>
>>>Giving zero widths/heights a small value is an ugly hack.  There must be a better way.
>>>
>>>Is there no bottleneck in Cairo where you could discard ineligible shapes?
>>>
>>>--
>>>"A child is a person who can't understand why someone would give away a perfectly good kitten."
>>>-- Doug Larson
>>>
>>>
>>>
>>>
>>>--
>>>"A child is a person who can't understand why someone would give away a perfectly good kitten."
>>>-- Doug Larson
>>
>>
>
>
>
>
>

Received on Thursday, 9 August 2012 11:16:14 UTC