Closed Bug 647517 Opened 13 years ago Closed 3 years ago

Add an element argument to mozRequestAnimationFrame

Categories

(Core :: DOM: Core & HTML, defect, P2)

defect

Tracking

()

RESOLVED WONTFIX

People

(Reporter: heycam, Unassigned)

Details

We should support an optional second argument to mozRequestAnimationFrame, an element, which would cause the animation callback function not to be called when the element is known not to be visible (e.g. scrolled out of view).
(In reply to comment #0)
> We should support an optional second argument to mozRequestAnimationFrame, an
> element, which would cause the animation callback function not to be called
> when the element is known not to be visible (e.g. scrolled out of view).

How do you define being visible?
> How do you define being visible?

Current plan, I think, is "overflow area of one of the continuations of the primary frame intersects the viewport".

Taking, but if someone is interested they should feel free to steal.
Assignee: nobody → bzbarsky
Priority: -- → P1
Wouldn't it make more sense to support mozRequestAnimationFrame as an API on elements as well as Window?
I seem to recall that James Robinson thought having it always on Window made it easier to cancel because you don't need an element reference. But I don't think cancellation is going to be widely used, personally. I suppose we could have both.
Canceling would just use the id of the request; it wouldn't need an element reference.

Hanging it off the element does raise questions about the right behavior if the element is move between documents before the refresh timer fires.
(In reply to comment #5)
> Canceling would just use the id of the request; it wouldn't need an element
> reference.
> 
> Hanging it off the element does raise questions about the right behavior if the
> element is move between documents before the refresh timer fires.

Right - I wasn't sure how to handle this case:
var id = elem.mozRequestAnimationFrame(foo);
someOtherDocument.adoptNode(elem);

Is the callback cancelled by this:
window.mozCancelRequestAnimationFrame(id);
or by:
someOtherDocument.window.mozCancelRequestAnimationFrame(id);

Also, this would mean that ids would have to be allocated to be global across all possible documents, not just the one.  This point isn't too difficult to deal with in the implementation but is somewhat confusing.
Severity: normal → major
Priority: P1 → P2
Component: DOM → DOM: Core & HTML

This never got specced; I think we should wontfix this bug.

Assignee: bzbarsky → nobody

Hey Boris,
Since this has never been specced according to the last comment should we close the bug?

Flags: needinfo?(bzbarsky)

Yeah

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WONTFIX
Flags: needinfo?(bzbarsky)
You need to log in before you can comment on or make changes to this bug.