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

Re: Mask and Clip behavior

From: Erik Dahlstrom <ed@opera.com>
Date: Thu, 16 Feb 2012 14:54:58 +0100
To: www-svg@w3.org
Message-ID: <op.v9rx9wsggeuyw5@localhost.localdomain>
On Sat, 11 Feb 2012 21:28:18 +0100, Jeremie Patonnier  
<jeremie.patonnier@gmail.com> wrote:

> Hi,
> Tab, thanks for this enlightenment :)
> 2012/2/11 Tab Atkins Jr. <jackalmage@gmail.com>
> So to make things clearer for every one, I suggest two actions :
>    1. Update the current SVG spec to add a note to all the relevant
>    attributes definition that do not support percentage value relative  
> to the
>    object bounding box (gradientUnits, patternUnits, patternContentUnits,
>    clipPathUnits, maskUnits, maskContentUnits, filterUnits or  
> primitiveUnits):
>    « Note that percentage values are not affected by the
>    'objectBoundingBox' value and, according to the units processing  
> rules, are
>    defined to be relative to the size of the viewport applicable to the  
> object
>    the gradient|mask|pattern|clip|filter|primitive is applied to. »

Yes, that's similar to the rule of thumb I use when dealing with these  
elements: "percentages are relative to the viewport, [0..1] (fractions)  
are relative to the boundingbox".

It works in a majority of the cases, but not always. Percentages in the  
font-size attribute/property for example (relative to the parent's  
font-size). I'm not sure if the term "applicable viewport" needs further  
clarification here, but a link from that to somewhere describing viewports  
might be good if the proposed text is accepted.

>    2. I propose some changes to the upcoming SVG 2.0 to have things more
>    consistent and more author friendly:
>    1. Mark all the gradientUnits, patternUnits, patternContentUnits,
>       clipPathUnits, maskUnits, maskContentUnits, filterUnits or  
> primitiveUnits
>       attributes deprecated. It's to many different attributes that
> basically do
>       the same : switching between 'userSpaceOnUse' and  
> 'objectBoundingBox'
>       values.
>       2. Add two new attributes « units » and « contentUnits ». « units »
>       will be a unified attribute that will be used in replacement of
>       gradientUnits, patternUnits, maskUnits, filterUnits and  
> primitiveUnits. «
>       contentUnits » will be a unified attribute that will be used in
> replacement
>       of patternContentUnits, clipPathUnits and maskContentUnits
>       3. The old deprecated attributes will remain with their behavior
>       unchanged but the new attributes will allow the use of percentage  
> values
>       always relative to the object bounding box if the value of the «
> units » or
>       « contentUnits » is set to "objectBoundingBox" (which is, IMO,
> what authors
>       expect : when something is bound to the bounding box, everything
> should be
>       and percentage are much more readable than fraction).
>       4. if both the old deprecated attribute and the new friendly
>       attribute are used at the same times, the new attribute will  
> override the
>       behavior of the old one.
>       5. if only one attribute is declared, the default value of the
>       undeclared attribute is ignored
>       6. if there is no attribute, both old and new attributes should  
> have
>       the same default value which will insure backward compatibility
> with legacy
>       content.

I like the general idea of using one attribute instead of five and so on,  
but I fear that it would become even more of a mess to authors to keep  
track of - at least in a transitional period.

Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed
Received on Thursday, 16 February 2012 13:55:36 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:34 UTC