Re: [css3-values][css3-images] element() function

On Tue, Aug 31, 2010 at 3:35 PM, Simon Fraser <smfr@me.com> wrote:
> On Aug 31, 2010, at 2:47 PM, Tab Atkins Jr. wrote:
>> Well, -webkit-canvas() suggests that we're cool with using things in
>> the page as image sources.
>
> A -webkit-canvas is not really a "thing in the page". There is no canvas
> element in the DOM.

Oh, huh.  My mistake.  I misremembered how that worked.  I assumed you
pointed it at a <canvas> by id; instead, you specify some name, and
then use a js function to grab a drawing context by that name.


>> Then we have properties like
>> -webkit-box-reflect, which show that we've already got the issue of
>> drawing a single element in multiple places solved in some fashion
>> (though from what I hear, it's not being solved in the way we'd
>> probably want to use for element()).
>
> I'm glad you brought up -webkit-box-reflect; this is another example of
> rendering a "replica" of something in another place on the page. It would
> be nice if we could unify reflections and element() somehow (without having
> to add another element in the page for the reflection).

Isn't that what generated content is for?

#foo::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  top: 100%;
  left: 0;
  background: element(#foo);
  transform: rotateX(180deg);
  /* Stuff to do masking */
}

This requires either that #foo is also positioned (can just be
relpos), or that we have sufficient control over abspos positioning
roots that we can tell the ::after to just position off of its parent.

This is obviously a lot more complex than just doing
-webkit-box-reflect, but reflection is a relatively complex effect in
the first place.  Most of it is just boilerplate.  (And with mixins,
we can hide away all the boilerplate, too!)


>> So, the will and the techniques are there, is my point.  Webkit
>> probably won't push back on this feature.  ^_^
>
> No push-back from me, but I'm not convinced that element() is quite right yet.

Could you elaborate?  I'd obviously like to know what isn't right
before I try and spec this.  ^_^

~TJ

Received on Wednesday, 1 September 2010 00:22:25 UTC