A brief look at CanvasRenderingContext2D suggests this can be done in a couple of steps. First we need to add basic Cairo fill/stroke and possibly image support. Gradient support will require some abstraction and further work (for which #13312 may provide inspiration). It seems that unlike most of the WebKit porting layer, CanvasRenderingContext2D porting is simply done with inline conditional macros.
Created attachment 16258 [details] Initial work on Cairo canvas support This is not particularly complete, but eg. canvas painter mostly works (http://caimansys.com/painter/). Thoughts and improvements welcome.
Created attachment 16261 [details] Cairo canvas support Now renders canvas content in the correct position. Memory leak fixed.
Created attachment 16514 [details] Cairo canvas support Not complete, but works quite well. There are a few FIXMEs and CanvasPattern is not yet implemented, but it may make sense to get this landed soon so the patch doesn't become obsolete every time the QT port is tweaked. (No ChangeLog entry just yet)
Comment on attachment 16514 [details] Cairo canvas support Ick. The code looks fine. The only problem is see is that this makes Canvas code even uglier (as now there is a 3-way ifdef. Canvas needs to be taught to use platform dependent support classes, and the platform independent bits should then have all the #ifdef'd code removed. I mentioned some needless comments on IRC. Please remove those, then feel free to land.
Fixed in r26021