mirror of
https://github.com/servo/servo.git
synced 2025-08-02 12:10:29 +01:00
Ensure that rAF callbacks which don't mutate the DOM, but aren't
yet considered spurious force a reflow / composite / animation tick cycle.
This commit is contained in:
parent
c8255922a9
commit
6c9e305442
1 changed files with 16 additions and 0 deletions
|
@ -1596,6 +1596,22 @@ impl Document {
|
||||||
ReflowQueryType::NoQuery,
|
ReflowQueryType::NoQuery,
|
||||||
ReflowReason::RequestAnimationFrame);
|
ReflowReason::RequestAnimationFrame);
|
||||||
|
|
||||||
|
if spurious && !was_faking_animation_frames {
|
||||||
|
// If the rAF callbacks did not mutate the DOM, then the
|
||||||
|
// reflow call above means that layout will not be invoked,
|
||||||
|
// and therefore no new frame will be sent to the compositor.
|
||||||
|
// If this happens, the compositor will not tick the animation
|
||||||
|
// and the next rAF will never be called! When this happens
|
||||||
|
// for several frames, then the spurious rAF detection below
|
||||||
|
// will kick in and use a timer to tick the callbacks. However,
|
||||||
|
// for the interim frames where we are deciding whether this rAF
|
||||||
|
// is considered spurious, we need to ensure that the layout
|
||||||
|
// and compositor *do* tick the animation.
|
||||||
|
self.window.force_reflow(ReflowGoal::ForDisplay,
|
||||||
|
ReflowQueryType::NoQuery,
|
||||||
|
ReflowReason::RequestAnimationFrame);
|
||||||
|
}
|
||||||
|
|
||||||
// Only send the animation change state message after running any callbacks.
|
// Only send the animation change state message after running any callbacks.
|
||||||
// This means that if the animation callback adds a new callback for
|
// This means that if the animation callback adds a new callback for
|
||||||
// the next frame (which is the common case), we won't send a NoAnimationCallbacksPresent
|
// the next frame (which is the common case), we won't send a NoAnimationCallbacksPresent
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue