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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 14 Jul 2011 13:55:26 -0700
Message-ID: <CAAWBYDAK5kuUPT=H8z0C_ndOqMDViuEndGxgs44kTHsdf9-Miw@mail.gmail.com>
To: robert@ocallahan.org
Cc: www-style list <www-style@w3.org>
On Wed, Jul 13, 2011 at 9:40 PM, Robert O'Callahan <robert@ocallahan.org> 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).  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. 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.

Ah, good to hear.  I'll proceed with my plans, then.


> 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.

Your last line is intriguing.  Do you mean that, if you have a
document like this:

foo.svg
<svg>
  <rect id=foo fill=blue />
</svg>

...that you could do url(foo.svg#foo) and get a blue rectangular image?

I'm not sure how that would work with non-rectangular elements.  SVG
already has a good way to handle this, via the <view> element, as it
explicitly establishes a viewport.  I'm somewhat more comfortable
limiting myself to just letting svg documents reference paint servers
and <view> elements directly.

Also, it would mean that doing url(foo.html#bar) means you have to
load up the linked document, running scripts/etc. as if you were
loading an iframe, before you were able to extract out the element.
Still slightly uncomfortable with this.

~TJ
Received on Thursday, 14 July 2011 20:56:16 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:42 GMT