servo/components
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
..
allocator Add rust-version to all Cargo.toml files (#33483) 2024-09-17 16:39:07 +00:00
background_hang_monitor Only compile platform samplers when cargo feature enabled (#35312) 2025-02-06 06:53:08 +00:00
bluetooth Include WebViewId into EmbedderMsg variants where possible (#35211) 2025-01-30 11:15:35 +00:00
canvas Revert "Use surfman with glow bindings (#34328)" (#35402) 2025-02-10 17:20:27 +00:00
compositing libservo: Don't bounce ready-to-present frame notifications to the Constellation (#35369) 2025-02-12 08:25:58 +00:00
config prefs: Stop precaching WebRender shaders by default (#35431) 2025-02-12 08:28:41 +00:00
constellation libservo: Don't bounce ready-to-present frame notifications to the Constellation (#35369) 2025-02-12 08:25:58 +00:00
deny_public_fields Add rust-version to all Cargo.toml files (#33483) 2024-09-17 16:39:07 +00:00
devtools libservo: Flesh out permissions API (#35396) 2025-02-10 15:50:33 +00:00
dom_struct script: Feature-gate all crown support. (#35055) 2025-01-18 21:36:15 +00:00
domobject_derive Upgrade rustc to 1.83 (#34793) 2025-01-01 09:38:28 +00:00
fonts Include WebViewId into EmbedderMsg variants where possible (#35211) 2025-01-30 11:15:35 +00:00
geometry servoshell: Allow overriding screen resolution with a command-line argument (#34038) 2024-10-30 11:54:13 +00:00
hyper_serde Elide lifetimes where possible after rustup (#34824) 2025-01-03 18:54:44 +00:00
jstraceable_derive Add rust-version to all Cargo.toml files (#33483) 2024-09-17 16:39:07 +00:00
layout deps: Upgrade to webrender@0.66 (#35325) 2025-02-07 11:57:26 +00:00
layout_2020 Implement overflow:clip (#35103) 2025-02-12 07:02:06 +00:00
layout_thread deps: Upgrade to webrender@0.66 (#35325) 2025-02-07 11:57:26 +00:00
layout_thread_2020 script_traits: Rename ConstellationControlMsg to ScriptThreadMessage (#35226) 2025-01-30 22:46:17 +00:00
malloc_size_of malloc_size_of: enable sync in tokio (#35320) 2025-02-06 09:16:51 +00:00
media Remove some unused dependencies (#34355) 2024-11-25 10:29:58 +00:00
metrics script_traits: Rename ConstellationControlMsg to ScriptThreadMessage (#35226) 2025-01-30 22:46:17 +00:00
net libservo: Add a delegate method for HTTP authentication (#35400) 2025-02-10 23:39:24 +00:00
pixels Update pixels::unmultiply_inplace to support RB swap and use it in canvas_state (#35313) 2025-02-06 05:02:49 +00:00
profile deps: Upgrade to webrender@0.66 (#35325) 2025-02-07 11:57:26 +00:00
rand crypto: Begin SubtleCrypto implementation (#33628) 2024-10-08 03:51:08 +00:00
range Add rust-version to all Cargo.toml files (#33483) 2024-09-17 16:39:07 +00:00
script script: fix spurious animation checks to correctly invoke rAF callbacks (#35387) 2025-02-12 09:11:19 +00:00
script_bindings bindings: Support non-object this values for callbacks. (#35427) 2025-02-12 05:41:00 +00:00
servo libservo: Don't bounce ready-to-present frame notifications to the Constellation (#35369) 2025-02-12 08:25:58 +00:00
shared libservo: Don't bounce ready-to-present frame notifications to the Constellation (#35369) 2025-02-12 08:25:58 +00:00
timers script: Make timers per-process (#34581) 2024-12-24 09:53:35 +00:00
url Add rust-version to all Cargo.toml files (#33483) 2024-09-17 16:39:07 +00:00
webdriver_server Add support for Upgrade request to a potentially trustworthy URL. (#34986) 2025-02-05 12:49:56 +00:00
webgpu deps: Upgrade to webrender@0.66 (#35325) 2025-02-07 11:57:26 +00:00
webxr Revert "Use surfman with glow bindings (#34328)" (#35402) 2025-02-10 17:20:27 +00:00