Re: transform as a presentation attribute [was: Re: [whatwg] SVG cloning elements from HTML5]

Hello world,

it seems that I am very unclear (probably because I have such a touch of 
irony in some of my statements) ... that's why I try to describe the 
issue another time (without any irony, hopefully):

If you have an SVG file with lots of presentation attributes (stroke, 
fill, ... and in the new interpretation, "transform" would also be a 
presentation attribute which it was not in SVG, so far), each value of 
those attributes would be easily overwritten by any other CSS rule 
originating from the author (style attribute, style tag, external 
referenced style sheet). If you intend to have "general" styling rules 
given as CSS statements, preferably in an external CSS file, but 
"specific" styling for specific objects given as presentation 
attributes, this does not work, as the CSS rules override the 
presentation attributes. You can override the "global" style rules no 
other way than using the style attribute of the tag, but not by the 
presentation attribute. Now, when we make transform a presentation 
attribute, this would be valid for the transform attribute as well. So, 
all the "presentation" (which was not presentation, before, but just a 
specific transform) made in a SVG file by using the transform attribute 
would easily be overwritten by any "global" CSS rule with a property of 
"transform". And this might even happen for old content when you just 
modify the referenced CSS author style sheet, i.e. add a rule with a 
"transform" property for elements which are already transformed by a 
transform attribute in the SVG file - the latter (the specific value) 
gets overridden by the former (the global rule).

Thus, I would propose to change the behaviour of the CSS styling cascade 
(or add an exception, if it is not possible in general to change that), 
that such presentation attributes override any other CSS style 
properties given in a style tag or in an external style file, in the 
same way as it is already the case for CSS styling given as a style 
attribute.

Is my intention clear enough, now?

Best regards,

Juergen Roethig

Am 24.06.2014 11:10, schrieb Dirk Schulze:
> Hello, Juergen,
>
> I am not entirely sure what you try to suggest. I just try to reply to some of your proposals/questions.
>
> On Jun 24, 2014, at 10:37 AM, Juergen Roethig <roethig@dhbw-karlsruhe.de> wrote:
>
>> Hello world,
>>
>> (sorry for not copying the whatwg mailing list, but I do not read that list, and so I am probably not able to write to that, neither) ...
>>
>> Tab Atkins Jr. wrote:
>>> On Mon, Jun 23, 2014 at 9:35 PM, Dirk Schulze <dschulze@adobe.com> wrote:
>>>> On Jun 24, 2014, at 5:25 AM, Robert O'Callahan <robert@ocallahan.org> wrote:
>>>>> 4) Add a "transform" attribute to HTMLElement and have it map to the
>>>>> "transform" CSS property.
>>>> In this case we should think about making transform a presentation attribute in general for HTML and SVG.
>>> That's effectively what it would do, yes.
>>
>> Hey, that's a nice proposal - transform as a presentation attribute in SVG! Why? What would that mean?
>
> This is not a proposal anymore. It is already specced for SVG elements and partly implemented in WebKit, Blink and Firefox. The relevant spec is CSS Transforms[1]. The discussion here is about extending it to all HTMLElements as well. It seems unlikely that content uses the ’transform’ attribute in HTML today.
>
>> If your SVG objects are carefully placed and transformed in SVG via the transform attribute (e.g. in order to achieve a projection of a map on a globe, or to have specific objects displayed in specific sizes), this will be easily overridden by one simple CSS rule. Why? In [http://www.w3.org/TR/2008/REC-CSS2-20080411/cascade.html#q12], we read:
>> "The UA may choose to honor presentational hints from other sources than style sheets, for example the FONT element or the "align" attribute in HTML. If so, the non-CSS presentational hints must be translated to the corresponding CSS rules with specificity equal to zero. The rules are assumed to be at the start of the author style sheet and may be overridden by subsequent style sheet rules."
>> And in [http://www.w3.org/TR/2011/REC-CSS2-20110607/cascade.html#preshint], this is complemented by the following statement as well as an example:
>> "For other languages, all document language-based styling must be translated to the corresponding CSS and either enter the cascade at the user agent level or, as with HTML presentational hints, be treated as author level rules with a specificity of zero placed at the start of the author style sheet."
>>
>> Great? Fabulous ;-)
>>
>> Such a change would even be able to break existing content - ok, existing content would not be broken as long as nothing gets changed at all for the complete group of old files. But if in any referenced CSS stylesheet, a CSS rule with a rather general selector and a transform property gets added (to adopt the old content to new abilities, e.g. in order to move all elements slightly, or to increase their size a little bit, whatever reason might be possible), all the specific transform attributes in the old SVG code become useless.
>>
>> That's a perfect opportunity to repeat my old proposal ("Precedence of CSS rules and presentation attributes in SVG" with "Date: Sat, 18 Jan 2014 19:44:29 +0100"), or better to refine it:
>>
>> Shouldn't the precedence rule mentioned in CSS be changed, so that (real and modern) presentation attributes (that refers to _all_ presentation attributes in SVG, at least) should be treated in the same way as a CSS rule added via style attribute to the object tag? "Real and modern" in the sense that <body bgcolor=black> (does anybody remember such ugly constructs from more than 15 years ago?) will not be affected, as we should not break existing content ... ;-)
>
> I am not entirely sure what your proposal is and the descriptions above are hard to keep apart. In general, SVG specifies presentation attributes as an author stylesheet with a higher precedence than the UA style sheets but lower precedence than any other author style sheets and especially inline style. I tried to illustrate the precedence in an article some time ago[2]. HTML has presentation attributes as well IIRC and at least WebKit/Blink implements them the same way.
>
> To summarize: The behavior of presentation attributes in the styling cascade is specified in SVG and is already implemented this way by all browsers with SVG support.
>
> Greetings,
> Dirk
>
> [1] http://dev.w3.org/csswg/css-transforms/
> [2] http://blogs.adobe.com/webplatform/2013/01/08/svg-styling/
>
> .
>

Received on Tuesday, 24 June 2014 10:22:36 UTC