New issue
Advanced search Search tips

Issue 800897 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 785940
Owner: ----
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

DocumentTimeline.currentTime should match rAF now

Project Member Reported by majidvp@chromium.org, Jan 10 2018

Issue description

According to specification [1]

"The time passed to a requestAnimationFrame callback will be equal to document.timeline.currentTime"

For example:
window.requestAnimationFrame(function(now) {
  // Displays 0
  console.log(now - document.timeline.currentTime);
});

Testing this in Linux I am getting a changing value that is not Zero.
The difference value slowely moves from -16ms to 0 and back. Pretty sure this is because AnimationClock approximate frame and the clocks are slightly different. [2]

[1] https://drafts.csswg.org/web-animations/#model-liveness
[2] https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/animation/AnimationClock.cpp?sq=package:chromium&l=41

 
Interesting; on my machine on ToT I'm seeing almost always 0, and occasionally a small negative value. Is the attached repro what you were using? (Give or take).
index.html
222 bytes View Download
Yes. That is pretty much my repo.
> Pretty sure this is because AnimationClock approximate frame and the clocks are slightly different. [2]

AnimationClock should source its time the same way as RAF (during raf callback tasks). The approximation is only used for tasks outside frame callbacks.

https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/page/PageAnimator.cpp?sq=package:chromium&l=34

Comment 4 by flackr@chromium.org, Jan 14 2018

So if the delta is non-zero during requestAnimationFrame, then we must have incorrectly called AnimationClock::NotifyTaskStart (i.e. putting us in the outside frame callbacks approximation mode).
Status: Available (was: Untriaged)

Comment 6 by meade@chromium.org, Jan 16 2018

Labels: Hotlist-Interop
Mergedinto: 785940
Status: Duplicate (was: Available)

Sign in to add a comment