Re: [whatwg] High-density canvases

On Mon, Sep 9, 2013 at 5:00 PM, Ian Hickson <> wrote:
> It would be nice to fix these all at once, and I think we can, by
> introducing a configuration option on getContext(), in the style of WebGL:
>    getContext('2d', { density: 'autosize' });
> This would trigger the following behaviour: When the context is created,
> and subsequently when the <canvas> changes size (e.g. due to being sized
> with CSS relative units and the element they're relative to changing), or
> when the display density changes size (e.g. due to page zoom), then:
>    - the width and height of the canvas bitmaps get updated to match the
>      new native size of the <canvas>, at native density.
>    - the coordinate space of the canvas (context.width/context.height)
>      gets updated to match the size of the <canvas> in CSS pixel units.
>    - a 'resize' event gets fired at the <canvas>.
> We would dump the *HD versions of the methods, and make the regular ones
> go back to returning the actual raw pixels, since that would now work fine
> and still provide HD-quality content everywhere it's available.
> What do people think?

Sounds reasonable to me.  Firing a resize directly at the <canvas> is
nice and convenient.


Received on Tuesday, 10 September 2013 00:08:15 UTC