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

Re: [css3-images] Image fallback feature's dependency on media fragments

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 22 Feb 2012 12:53:58 -0500
Message-ID: <4F452BB6.5040505@mit.edu>
To: www-style@w3.org
On 2/22/12 12:43 PM, Tab Atkins Jr. wrote:
> Presumably it should be identically usable in the other<image>-using
> properties besides 'content', right?

There is no such thing.  All properties that do uri stuff do pretty 
different things, so they're handled on a case-by-case basis.

> What makes it hard to use in 'content'?

url() in content is implemented in Gecko by creating an actual image 
element with src set to that url, basically.  Which means that 
supporting MF syntax means either adding support to it for <img> or 
changing the implementation of 'content' significantly.

background-image, on the other hand, just stores a pointer to image 
data, and when -moz-image-region is used a clip rect, and paints the 
image data, possibly clipped.

I think your basic assumption that your mental model of image() values 
matches how implementations actually work, especially implementations 
that predate the existence of the concept of image() values is 
fundamentally false, fwiw.  Which is why it's generally a bad idea to 
make statements about ease of implementation about a codebase that 
you're not familiar with: the correctness of such statements is strongly 
correlated with how well your mental model matches the actual 
implementation.  If it doesn't match well, it's easy to overestimate or 
underestimate ease of implementation by several orders of magnitude...

> It's reasonable that a *good* implementation would take more time.  We
> have a similar difficulty. I'm curious what the use-case for
> -moz-image-rect() was in the first place, if not precisely what you
> describe (lots of references to the same image with different rects).

That was precisely the use case, yes.  But since the clip rect is not 
stored in the URI itself, the URI can just be passed to the image 
library and then the clip rect applied if needed; the image library only 
sees one URI.

> But you already have implemented the *exact* user-facing behavior that
> the #xywh=... fragment has

In some contexts.

I do think that implementing this in Gecko for the specific case of 
background-image would not be too bad, fwiw.

Received on Wednesday, 22 February 2012 17:54:26 UTC

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