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

Re: [css3-images] Using SVG Paint Servers as <image>

From: Alan Gresley <alan@css-class.com>
Date: Thu, 14 Jul 2011 22:15:14 +1000
Message-ID: <4E1EDDD2.2090907@css-class.com>
To: robert@ocallahan.org
CC: "Tab Atkins Jr." <jackalmage@gmail.com>, www-style list <www-style@w3.org>
On 14/07/2011 2:40 PM, Robert O'Callahan wrote:
> On Thu, Jul 14, 2011 at 1:13 PM, Tab Atkins Jr.<jackalmage@gmail.com>wrote:
>> Second, how should paint servers be referenced?  In roc's old code,
>> you simply used url(), with the fragment pointing to the paint
>> server's id.  More recently, though, roc has suggested using
>> element(), extending it to take a url.  I'm not so much a fan of this
>> latter solution; for one, it's confusing to have both an idselector
>> and a url with a fragid, as they'll refer to different things -
>> element(#foo) refers to the element with id=foo in the host document,
>> while element("#foo") would refer to the element with id=foo in the
>> CSS document (which wouldn't refer to anything at all if the CSS was
>> external).

I don't follow Tab. A url string can be both (#foo) and ("#foo"). Are 
you saying that the later can refer to an identifier in a CSS document 
like #foo { ... }?

>> Also, would this then mean that you could reference
>> arbitrary elements from external pages (presumably same-origin
>> restricted)?
> Yes, you can in Firefox at the moment.
> I've come full circle on this, in a way.

Can you clarify what you mean by coming full circle? Is this for or 
against your recent suggestion regarding element() also taking a url?

> I now think that unifying CSS
> images and SVG paint servers completely would be great, in which case since
> url(foo.svg#pattern) is a valid SVG paint server, it should also be a valid
> CSS image with the equivalent meaning. I had concerns about compatibility
> with other possible uses of fragment references for SVG images, and fallback
> behavior for browsers not supporting the feature, but unifying CSS images
> and SVG paint servers seems a big enough win to just go ahead.
> I agree that for CSS images we can just have element(id) refer to the
> element with that id in the host document (or the anonymous element map). I
> think element(id) and url(#id) should behave the same whenever they refer to
> the same element.
> Rob

I don't quite follow Roc. What behavior is the same when an element(id) 
and url(#id) are referring to the same element. To my understanding, 
this can only happen in a xmlns:svg document like in your example on 
your weblog [1].

As I follow (I have little knowledge of <canvas>), we can have this.

   h1 { background-image: element(two); }
   p { background-image: url(http://external.com/bucket.svg#bar); }

<h1 id="one">Heading</h1>
<p id="two">Paragraph</p>

Does this cross same-origin restrictions?

[1] http://weblogs.mozillazine.org/roc/archives/2008/07/svg_paint_serve.html

Alan Gresley
Received on Thursday, 14 July 2011 12:15:45 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:02 UTC