W3C home > Mailing lists > Public > www-svg@w3.org > July 2011

Re: stroke=gradient for lines or horizontal paths

From: Alex Danilo <alex@abbra.com>
Date: Thu, 14 Jul 2011 11:19:41 +1000
Message-Id: <TCUAOL.BEBIW8XF14DF@abbra.com>
To: "Erik Dahlstrom" <ed@opera.com>
Cc: "Robert Longson" <longsonr@gmail.com>, www-svg@w3.org
Hi Erik & Robert,

--Original Message--:
>On Wed, 13 Jul 2011 14:43:31 +0200, Alex Danilo <alex@abbra.com> wrote:
>> Hi Robert,
>> --Original Message--:
>>> Alex,
>>>> Which of course begs the question - how do you get
>>>> the bounding box of a stroked object through the DOM?
>>> You can call getBoundingClientRect
>>> https://developer.mozilla.org/en/DOM/element.getBoundingClientRect
>>> This works on IE9 and Firefox. I'm not sure where else it is  
>>> implemented.
>> Thanks.
>> But can you point me at the W3C spec. that defines this, or
>> is this another vendor specific extension?
>http://www.w3.org/TR/cssom-view/#the-getclientrects (or  
>if you wanted an editor's draft).
>Now, it doesn't say that it should return anything else than the  
>boundingbox defined by the SVG specification, and that definition doesn't  
>include the stroke.
>There is no DOM method available to get a bbox including the stroke/filter  
>effects/markers or any combination thereof in SVG 1.1. That doesn't  
>exclude the possibility of adding that functionality to SVG2 of course,  
>which I assume is what Alex was getting at.

Yes indeed that is exactly what I was getting at.

A method defined by implementations of IE and copied by Gecko doesn't
qualify as a kosher method IMO.

Robert also quotes: "Keyword objectBoundingBox should not be used when the
geometry of the applicable element has no width or no height" etc.

The intent of that sentence is that the _keyword_ should not be used. It does
not say what to do if the keyword _is_ used. One could well argue that the
bounding box of two points co-incident in an axis has either a width and
no height, or a height and no width. But it does have an extent and in
one  direction the extent is 0. In that case, it seems perfectly reasonable
to use the extent for working out where the gradient goes - no?

So ASV is not failing - their (and my) interpretation of what to do when someone
didn't read the spec. and used the keyword 'objectBoundingBox' is different
to the other implementations.

A simple example - you could animate one of the end points of the line to trace
an arc - does the gradient disappear as it goes horizontal, then reappear? If it
does, one could well argue the implementation is broken...


>Erik Dahlstrom, Core Technology Developer, Opera Software
>Co-Chair, W3C SVG Working Group
>Personal blog: http://my.opera.com/macdev_ed
Received on Thursday, 14 July 2011 01:20:38 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:25 UTC