[webkit-dev] webkit-resource: referring to resources in User Agent stylesheet

Jer Noble jer.noble at apple.com
Tue Apr 26 13:27:46 PDT 2011

On Apr 26, 2011, at 1:18 PM, Dimitri Glazkov wrote:

> SOLUTION: Looking at the current media controls implementations, most
> of the -webkit-appearance states are kind of like background images,
> each reflecting appearance of an element at a particular state. Thus,
> it seems we should be able to solve this by just using CSS
> backgrounds:
> video:playing::-webkit-media-controls-play-button:hover {
>   background: url(/media-controls/play-button-hover.png);
> }
> That is how the authors would style the media controls. However, at
> the UA level, we shouldn't probably be loading resources from random
> sites. Instead, we need a way to bake these images into the WebKit
> runtime, and then a way to refer to them from the stylesheet.
> This is where a vendor-specific URL scheme comes in:
> video:playing::-webkit-media-controls-play-button:hover {
>   background: url(webkit-resource:/media-controls/play-button-hover.png);
> }
> A quick poll of smart people (abarth and smfr) seems to indicate it's
> not a completely horrid idea.
> WDYT? Thoughts? Comments?

FWIW, WebKit/mac generates these images programmatically, so there's not really a URL for "play button hover state" which can be targeted.  That said, if the URL scheme could be overloaded to handle generated content, I guess this could still work.  WebKit/mac could either parse the URL path and special case "media-controls/play-button-hover.png", or define our own URL scheme, e.g. "background: url(webkit-generated:media-play-button-playing-hover);"  But then we're just back to something functionally identical to -webkit-appearance.

I guess what I'm getting at is, if support for webkit-resource: is added, great.  However, at least one port will still need the old behavior.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110426/33578ae4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1652 bytes
Desc: not available
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110426/33578ae4/attachment.bin>

More information about the webkit-dev mailing list