W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2008

[whatwg] Canvas ath construction over save/restore boundaries

From: Krzysztof Żelechowski <giecrilj@stegny.2a.pl>
Date: Fri, 07 Mar 2008 19:54:51 +0100
Message-ID: <1204916091.7695.27.camel@a1dmin.vola.spe.com.pl>

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

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:40 UTC