[whatwg] Canvas ath construction over save/restore boundaries

Dnia 07-03-2008, Pt o godzinie 04:16 -0800, Oliver Hunt pisze:

> 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)

This instruction means to me: 
put a rectangle on a drawing plane, not over it.  
Once it has been put, it cannot be moved.

> 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).

Firefox is right.

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

Received on Friday, 7 March 2008 10:54:51 UTC