Re: [whatwg] High-density canvases

I was wondering if there is anything we can do with this feature to prevent
web apps from creating layout feedback loops.  What I mean is that if the
event listener for renderedsizechange changes the layout of the page in a
way that does not preserve renderedPixelWidth/Height, we can get into a lot
of trouble. Even if the resizing arithmetic in the event listener is sound,
if the rounding logic does not match exactly what the browser does,
fractional scales may cause instabilities.

The main source of of the problem is that intrinsic size affects CSS size
when width or height are set to 'auto', which is the default.  Some ideas
that come to mind for breaking the feedback loop:
1) renderedPixelWidth/Height return the intrinsic size when CSS
width/height are set to 'auto'
2) renderedPixelWidth/Height do not change when CSS width/height are set to
'auto'
3) have an explicit way to enable this feature. When it is enabled, the
canvas follows non-replaced element layout rules.




On Wed, Jun 25, 2014 at 1:09 AM, Robert O'Callahan <robert@ocallahan.org>
wrote:

> On Wed, Jun 25, 2014 at 3:30 PM, Rik Cabanier <cabanier@gmail.com> wrote:
>
> > Add a new event renderedsizechange to HTMLCanvasElement. This event does
> > not bubble and is not cancelable. Whenever the value that would be
> returned
> > by renderedPixelWidth orrenderedPixelHeight changes, queue a task to fire
> > renderedsizechange at the HTMLCanvasElement if there is not already a
> task
> > pending to fire such an event at that element.
> >
> >
> > - If there's a transition or animation that affects the canvas element,
> > should it receive resize events at 60fps?
> >
>
> UA dependent. In practice I would change the renderedPixelWidth/Height
> properties whenever Gecko rerasterizes the surrounding CSS content with a
> new resolution.
>
>
> > - will CSS 3D transforms affect the rendered canvas size? If so, what
> would
> > the optimal resolution be if there's a rotation
> >
>
> UA dependent. Again, I would change the renderedPixelWidth/Height
> properties whenever Gecko rerasterizes the surrounding CSS content with a
> new resolution, based on that resolution.
>
>
> > - what happens if the canvas element is not in the document? Will it just
> > return the pixel width/height?
> >
>
> UA dependent. I'd probably just leave it unchanged while it's not in the
> document (and assume 1 CSS pixel per device pixel if it's never been in a
> document with a screen presentation).
>
> Rob
> --
> Jtehsauts  tshaei dS,o n" Wohfy  Mdaon  yhoaus  eanuttehrotraiitny  eovni
> le atrhtohu gthot sf oirng iyvoeu rs ihnesa.r"t sS?o  Whhei csha iids  teoa
> stiheer :p atroa lsyazye,d  'mYaonu,r  "sGients  uapr,e  tfaokreg iyvoeunr,
> 'm aotr  atnod  sgaoy ,h o'mGee.t"  uTph eann dt hwea lmka'n?  gBoutt  uIp
> waanndt  wyeonut  thoo mken.o w
>

Received on Wednesday, 25 June 2014 14:49:36 UTC