Bug 46576
| Summary: | <canvas> stops working when out of view for some time | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Gilles Dubuc <kouiskas> |
| Component: | Canvas | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED INVALID | ||
| Severity: | Normal | CC: | kling, mdelaney7 |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | Mac (Intel) | ||
| OS: | OS X 10.5 | ||
| URL: | http://kouiskas.deviantart.com | ||
Gilles Dubuc
I've written a little <canvas> demo that renders metaballs: http://kouiskas.deviantart.com If you open that page then go do some browsing on other tabs for a while, when you come back to the demo the canvas is empty, despite the animation code still running (verified with developer tools). The duration it takes for the canvas to become empty seems random, sometimes it takes 5 seconds browsing on another tab, sometimes a minute. Even scrolling on the current window can trigger it sometimes (when the canvas goes out of view by scrolling), but most times won't.
If you inspect the page around the canvas you should find the javascript code that renders the animation.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Andreas Kling
Your code ends up calling CanvasRenderingContext2D's arc() with x=NaN and y=NaN, which makes WebKit ignore the call in accordance with HTML5:
"Except where otherwise specified, for the 2D context interface, any method call with a numeric argument whose value is infinite or a NaN value must be ignored."
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#2dcontext