If fillStyle() and strokeStyle() gets wrong arguments, they are set to transparent black. But fillStyle() and strokeStyle() should be ignored in this case and Canvas should fallback to the last fillStyle() or strokeStyle(), if there are no styles before, it should be transparent black.
Created attachment 23057 [details] Canvas invalid styles I changed the behaviour on invalid styles from transparent black to the last valid style. FF and Opera initialise canvas with a 'fillStyle' and 'strokeStyle' of black like webkit. That's why I don't follow the spec on that.
Comment on attachment 23057 [details] Canvas invalid styles The gradient and pattern if's aren't necessary. We shouldn't be ever applying with a NULL gradient or pattern. Otherwise this looks great! Nice use of the js tests! If you were a commiter I would just r+ this and you could fix it as you commit, as is, you should upload a new patch so it's easier for someone else to land.
Created attachment 23064 [details] Canvas and invalid styles Changes to the comment from eseidel above.
Comment on attachment 23064 [details] Canvas and invalid styles r=me
Landed in r36044.