[whatwg] Compatibility problems with HTML5 Canvas spec.

Oliver Hunt oliver at apple.com
Mon Sep 24 14:47:07 PDT 2007


Hi All,

We've encountered a number of website compatibility issues in WebKit  
due to our adherence to the new Canvas specifications -- a good  
example of this is rect drawing at http://canvaspaint.org

The most obvious issues can be shown if you use the draw rect tool  
and resize the rect repeatedly.

The first problem is the repeated drawing of old rects, this is due  
to the context path not being cleared by draw rect and fill rect  
which is the behaviour present in Safari 2 and Firefox 2.  While I've  
discussed the issue with Hixie in the past (and to an extent agree  
with him) the Firefox 3 nightlies do not appear to have adopted this  
behaviour, leaving us in a position where we have to choose between  
compatibility and compliance which is awkward.

The second problem is that the rules for drawing rects/adding rects  
to the path require us to throw an exception on negative width/ 
height, once again Firefox 3 does not match this behaviour, putting  
us in a position where we need to choose between compatibility and  
compliance.  In this case however it is relatively easy to make the  
argument that an exception should _not_ be thrown, as it means webapp  
developers either need to litter their code with exception handlers  
or add significant logic to ensure that their apps do not  
unexpectedly terminate.

The possible responses to drawing a rect with negative dimensions are  
(excluding the unappealing exception behaviour currently defined) to  
cull/ignore them (as we do with 0-sized rects), to normalise them  
(the current behaviour of firefox, and the behaviour expected by  
those apps that are affected by it), or to normalise them and treat  
the negative dimensions as an implicitly reversing the winding  
direction.

Both Opera and Safari 3 match the specification behaviour in both  
these cases, which results in multiple sites failing to render.

Cheers,
   Oliver



More information about the whatwg mailing list