W3C home > Mailing lists > Public > public-svg-wg@w3.org > January to March 2012

Re: Agenda, 2 February 2012 SVG WG telcon

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Sun, 5 Feb 2012 23:08:11 -0800
Message-ID: <CAAWBYDDj=H8sU5Vjn8qbsJifQF1GOYU=yJnV0YF1cCFt=1uf1w@mail.gmail.com>
To: Cyril Concolato <Cyril.Concolato@cisra.canon.com.au>
Cc: Tavmjong Bah <tavmjong@free.fr>, Erik Dahlstrom <ed@opera.com>, "public-svg-wg@w3.org" <public-svg-wg@w3.org>
On Sun, Feb 5, 2012 at 2:37 PM, Cyril Concolato
<Cyril.Concolato@cisra.canon.com.au> wrote:
> Hi Tab,
>> -----Original Message-----
>> From: Tab Atkins Jr. [mailto:jackalmage@gmail.com]
>> Sent: Friday, 3 February 2012 1:31 AM
>> To: Tavmjong Bah
>> Cc: Erik Dahlstrom; public-svg-wg@w3.org
>> Subject: Re: Agenda, 2 February 2012 SVG WG telcon
>>
>> On Thu, Feb 2, 2012 at 6:17 AM, Tavmjong Bah <tavmjong@free.fr> wrote:
>> > On Wed, 2012-02-01 at 13:30 +0100, Erik Dahlstrom wrote:
>> >> * currentColor change in CSS
>> >>    http://www.w3.org/mid/4F21EFE8.5020309@mcc.id.au
>> >
>> > If I understand correctly, we have agreed to add currentFillPaint and
>> > currentStrokePaint SVG2 and these along with currentColor would have
>> > two sets of values: "on define" and "on use".[1] It's not clear to me
>> > how this would be specified in practice. The value "on use" is needed
>> > to solve the long standing problem with marker color matching stroke color.
>>
>> The additional five values are all compatible with the proposed change.
>
> Could you elaborate a bit more?
>
> The SVG WG already agreed to include the following keywords in SVG 2:
> currentColor
> currentFillPaint
> currentStrokePaint
> For these, the value of the 'color' (or fill or stroke) property replaces the current* value in the property, where it is specified.
>
> <svg>
> <g display="none" color="yellow">
>  <rect id="myRect" fill="currentColor"/>
> </g>
> <g color="red">
>  <use xlink:href="#myRect"/>
> </g>
> </svg>
> This would display a yellow rectangle.
>
> useColor
> useFillPaint
> useStrokePaint
> For these, the value of the 'color' (or fill or stroke) property replaces the current* value in the property, where it is used.
>
> <svg>
> <g display="none" color="yellow">
>  <rect id="myRect" fill="useColor"/>
> </g>
> <g color="red">
>  <use xlink:href="#myRect"/>
> </g>
> </svg>
> This would display a red rectangle.
>
> <svg>
> <g display="none" color="yellow">
>  <g id="myG" fill="currentColor">
>   <rect id="myRect"/>
>  </g>
> </g>
> <g color="red">
>  <use xlink:href="#myG"/>
> </g>
> </svg>
> According to the modification you propose, the currentColor keyword is inherited to the rectangle. When the rectangle is used, the currentColor keyword is replaced by the color value (here red). This would produce a red rectangle instead of a yellow, right? In effect, it is similar to the 'useColor' keyword. Why not use the useColor keyword in the first place?

You're looking solely at <use> embedding, not normal inheritance.
Take the following example:

<g color='red' fill='currentColor'>
 <rect />
 <g color='green'>
  <rect />
 </g>
</g>

In this example, the <rect>s both inherit a "fill: currentColor".
Since the first has a parent with color=red, and the second has a
parent with color=green, I think you'd naively expect the first to be
filled with red and the second with green.  But, because currentColor
computes to 'red', you'll instead get two red rectangles.

useColor doesn't help here, because then it simply wouldn't have a
definite color at all until it was <use>d. (And then both rectangles
would be the same color again.)

Changing currentColor to inherit as itself and resolve to a real color
at used-value time would help the above, and wouldn't affect your
examples.

~TJ
Received on Monday, 6 February 2012 10:03:26 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:20:14 UTC