[whatwg] CSS canvas() function

Tab Atkins Jr. jackalmage at gmail.com
Tue Nov 23 16:13:26 PST 2010


(This is being sent to the WHATWG list, rather than the CSSWG list, as
it seems like the sort of thing that should be primarily defined in
HTML, with a CSS spec just referring to the HTML definition, like
:active and similar things.)

Webkit has for some time now supported using the -webkit-canvas()
function in CSS anywhere you could use an image
(<http://webkit.org/blog/176/css-canvas-drawing/>, published in April
2008).  The function takes an ident, which can then be used in the
window.getCSSCanvasContext() function in javascript to grab a context
keyed to that ident.  Drawing on that context is then reflected
everywhere on the page that references that canvas.

In essence, this is defining a scriptable paint server, which seems
useful enough that we'd really like it in the platform.

I'm willing to define a canvas() function in the CSS Image Values
specification, but since this relies explicitly on an HTML feature, it
feels like the full definition should exist in the HTML spec.

Thoughts?

~TJ


More information about the whatwg mailing list