Open
Bug 903575
Opened 11 years ago
Updated 2 years ago
canvas element need to provide information about its visibility state
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
NEW
People
(Reporter: yury, Unassigned)
References
Details
(Whiteboard: [shumway])
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
Details | Diff | Splinter Review |
It will be nice to have an attribute (and event, if possible) for the canvas element that will indicate its visibly. A typical use case for this functionality is not to perform painting on the canvas during animation if the canvas is out-of-view.
The Page Visibility API [1] will be a good candidate for the interface for this API. The functionality can be extended to add "near" state to detect if the canvas is about to be visible (similar to the bug 689623).
The state may be polled every with requestAnimationFrame. The visibility state change event will be good to have if the visibility state property polling interval is too low, e.g. less than 1 time per second.
[1] https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html
Comment 1•11 years ago
|
||
Here's a quick hack to add a mozVisible attribute to canvas elements that returns true if the canvas is visible or near visible.
Comment 2•11 years ago
|
||
Would it be better to just support passing an element to requestAnimationFrame and not triggering the callback if the element is not visible?
Reporter | ||
Comment 3•11 years ago
|
||
(In reply to Vacation until Aug 19. Do not ask for review. from comment #2)
> Would it be better to just support passing an element to
> requestAnimationFrame and not triggering the callback if the element is not
> visible?
Yeah, I just noticed the same idea in the webperf threads. We would want to continue generating frames (e.g. to execute actionscript stuff) but not paint them. In this case we would probably need to maintain the frame rate using e.g. setInterval and use requestAnimationFrame to just paint them.
Comment 4•11 years ago
|
||
How should this behave in a background tab? Note that in background tabs requestAnimationFrame is turned off altogether, but setInterval is just throttled to 1Hz...
Reporter | ||
Comment 5•11 years ago
|
||
(In reply to Vacation until Aug 19. Do not ask for review. from comment #4)
> How should this behave in a background tab? Note that in background tabs
> requestAnimationFrame is turned off altogether, but setInterval is just
> throttled to 1Hz...
I guess we have to play by rules set by requestAnimationFrame or setInterval
Updated•11 years ago
|
Assignee: tnikkel → nobody
Updated•11 years ago
|
Attachment #788355 -
Attachment is obsolete: true
Updated•10 years ago
|
Blocks: shumway-m4
Updated•9 years ago
|
Blocks: shumway-m5
Updated•9 years ago
|
No longer blocks: shumway-m4
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•