servo/components/script
Mukilan Thiyagarajan bcbb1d67d5
script: fix spurious animation checks to correctly invoke rAF callbacks (#35387)
After running an `rAF` callback, if no new callbacks were registered, we
send a `NoAnimationFramesCallback` to the compositor to stop ticking
animations using video refresh callbacks. This interacts badly with the
mechanism to track spurious animations frames i.e. rAF callbacks that
don't mutate the DOM. Such 'faked' rAF callbacks are triggered by
registering a oneshot timer instead of the compositor callback.

The compositor's refresh callback is never enabled back again once a
non-spurious rAF callback runs and registers a new rAF callback. If the
former callback resets the `spurious_animations_frames` counter, then when
the latter rAF callback runs, it will not schedule a OneShotTimer timer
for any rAF callback that itself registers, since the counter was reset
previously. Hence that third rAF callback that never runs as it relies
on the compsitor's refresh callback, which was disabled previously.

The current logic also doesn't actually recognize spurious animation
frames because the `spurious_animations_frames` counter is updated at
the end of the `run_the_animation_frame_callbacks`, effectively meaning
`was_faking_animation_frames` and `self.is_faking_animation_frames` will
always be the same value but the logic effectively only runs when
`(!was_faking && is_faking)` is true.

This patch fixes the logic to detect spurious animations frames by
moving logic to update the counter to be before the check for spurious
frames. It also ensures that the compositor's refesh callbacks is
re-enabled once we see a non-spurious callback.


Fixes #35386

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-02-12 09:11:19 +00:00
..
docs Update branch name to main (#30877) 2023-12-16 09:32:20 +00:00
dom script: fix spurious animation checks to correctly invoke rAF callbacks (#35387) 2025-02-12 09:11:19 +00:00
layout_dom Implement ServoLayoutNode::traversal_parent (#35338) 2025-02-07 01:05:27 +00:00
xpath script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
animation_timeline.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
animations.rs Implement Event propagation across shadow roots (#34884) 2025-01-22 15:25:16 +00:00
body.rs Move various reflector types and traits to script_bindings (#35279) 2025-02-04 06:58:08 +00:00
build.rs script: Move code generation and webidl files to new script_bindings crate. (#35157) 2025-01-24 20:47:43 +00:00
canvas_state.rs Update pixels::unmultiply_inplace to support RB swap and use it in canvas_state (#35313) 2025-02-06 05:02:49 +00:00
Cargo.toml Let script/webgpu feature imply script_traits/webgpu (#35424) 2025-02-11 15:44:36 +00:00
clipboard_provider.rs libservo: Add a ClipboardDelegate and a default implementation (#35297) 2025-02-07 10:43:46 +00:00
conversions.rs suppress build warnings when disabling webgpu and webxr (#35379) 2025-02-08 08:16:21 +00:00
devtools.rs Inform the devtools about shadow roots on a node (#35294) 2025-02-05 13:16:36 +00:00
document_collection.rs script: Feature-gate all crown support. (#35055) 2025-01-18 21:36:15 +00:00
document_loader.rs script: Feature-gate all crown support. (#35055) 2025-01-18 21:36:15 +00:00
drag_data_store.rs DataTransfer: propagate CanGc argument (#35062) 2025-01-18 18:24:49 +00:00
fetch.rs Add support for Upgrade request to a potentially trustworthy URL. (#34986) 2025-02-05 12:49:56 +00:00
iframe_collection.rs script: Feature-gate all crown support. (#35055) 2025-01-18 21:36:15 +00:00
init.rs Make generated bindings generic over DOM types (#35169) 2025-01-25 05:08:49 +00:00
layout_image.rs Move various reflector types and traits to script_bindings (#35279) 2025-02-04 06:58:08 +00:00
lib.rs Update pixels::unmultiply_inplace to support RB swap and use it in canvas_state (#35313) 2025-02-06 05:02:49 +00:00
links.rs Add support for Upgrade request to a potentially trustworthy URL. (#34986) 2025-02-05 12:49:56 +00:00
mem.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
messaging.rs suppress build warnings when disabling webgpu and webxr (#35379) 2025-02-08 08:16:21 +00:00
microtask.rs Fire slot change events when the slot content changes (#35137) 2025-01-27 14:13:22 +00:00
navigation.rs Add support for Upgrade request to a potentially trustworthy URL. (#34986) 2025-02-05 12:49:56 +00:00
network_listener.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
realms.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
script_module.rs script: make Error::to_jsval safe (#35411) 2025-02-10 23:47:31 +00:00
script_runtime.rs Move more foundational types to script_bindings (#35280) 2025-02-04 10:36:30 +00:00
script_thread.rs dom: Always replace unpaired surrogates when handling page text (#35381) 2025-02-09 08:56:05 +00:00
security_manager.rs Move various reflector types and traits to script_bindings (#35279) 2025-02-04 06:58:08 +00:00
serviceworker_manager.rs api: Flatten and simplify Servo preferences (#34966) 2025-01-14 13:54:06 +00:00
stylesheet_loader.rs Add support for Upgrade request to a potentially trustworthy URL. (#34986) 2025-02-05 12:49:56 +00:00
stylesheet_set.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
task.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
task_manager.rs Implement HTMLCanvasElement.toBlob (#34938) 2025-01-10 19:04:42 +00:00
task_queue.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
task_source.rs Implement HTMLCanvasElement.toBlob (#34938) 2025-01-10 19:04:42 +00:00
test.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
textinput.rs libservo: Add a ClipboardDelegate and a default implementation (#35297) 2025-02-07 10:43:46 +00:00
timers.rs Move various reflector types and traits to script_bindings (#35279) 2025-02-04 06:58:08 +00:00
unminify.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00
webdriver_handlers.rs Move various reflector types and traits to script_bindings (#35279) 2025-02-04 06:58:08 +00:00
window_named_properties.rs script: Limit public exports. (#34915) 2025-01-10 08:19:19 +00:00