javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -


request animation frame stops working when exiting fullscreen clicking on original space's safari window. fine if fullscreen mode canceled escape key or calling cancelfullscreen().

steps reproduce:

what handling click calling:

window.requestanimationframe(draw); 

which draws on canvas context:

function draw() {     ctx.drawimage(img, math.random()*500|0, math.random()*400|0, 100, 100); } 

i checked .hidden , .visibilitystate, updated correctly.

tested on osx 10.9.3, safari 7.0.4 (9537.76.4).

has workaround/solution other switching old settimeout?

this sounds webkit bug 88940:

using requestanimationframe , fullscreen api on drawingarea-backed window cause raf permanently suspend animations when fullscreened, because of following:

  1. javascript causes fullscreen transition start.
  2. painting (and raf) suspended.
  3. the page changes size. a. drawingareaproxyimpl::sizedidchange() calls drawingareaimpl::updatebackingstorestate, calls drawingareaimpl::resumepainting. b. drawingareaimpl::resumepainting resumes painting, not resume raf, because windowisvisible (legitimately) false.
  4. the view becomes visible, windowisvisible updated true.
  5. visibilitydidchange() calls resumepainting again, time exits because painting not suspended.

notice because of exit in 4, raf never resumed.

based on description suspect there no effective workaround, since drawing area gets state calling resumepainting has no effect.

(thanks jason davies finding bug report.)


Comments

Popular posts from this blog

Python ctypes access violation with const pointer arguments -