[whatwg] Canvas ath construction over save/restore boundaries

Oliver Hunt oliver at apple.com
Fri Mar 7 04:16:42 PST 2008


Hi all, while working on a bug in our canvas implementation I've  
noticed that there's a difference in behaviour between Opera and  
Firefox when handling path construction over save/restore  
boundaries.   Section 3.12.11.1.1 says that the canvas path is not  
part of the state that is effected by save/restore, unfortunately  
Opera and Firefox disagree on what this actually means.  Firefox  
appears to treat restore() (effectively) as a transform that undoes  
the any transformations performed in the current state, so given the  
example:

context.beginPath();
context.save()
context.translate(100,100)
context.rect(0,0,10,10)
context.restore()
context.fill()

Firefox behaves as though the set of operations was

context.beginPath();
context.translate(100,100)
context.rect(0,0,10,10)
context.translate(-100,-100)
context.fill()

which, given 3.12.11.1.8., results in the fill operation still drawing  
a 10x10 rect at (100,100).  Opera meanwhile treats the path as being  
completely independent of the canvas state, and so draws the rect at  
(0,0).

What I want to know is which behaviour the spec actually intends on  
providing.

--Oliver




More information about the whatwg mailing list