Raf delivery: run rafs for all pipeline if tick received for any. (#33395)

* update the rendering: run rafs for all pipeline, if tick received for any

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* prioritize only one updating of the rendering per event-loop wake-up

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

---------

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
This commit is contained in:
Gregory Terzian 2024-09-12 00:23:20 +08:00 committed by GitHub
parent 9175e598ad
commit 23b0dc603c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 42 additions and 12 deletions

View file

@ -3335,10 +3335,17 @@ impl Document {
self.pending_animation_ticks.borrow_mut().extend(tick_type);
}
/// Whether this document has received an animation tick for rafs.
pub fn has_received_raf_tick(&self) -> bool {
self.pending_animation_ticks
.borrow()
.contains(AnimationTickType::REQUEST_ANIMATION_FRAME)
}
/// As part of a `update_the_rendering` task, tick all pending animations.
pub fn tick_all_animations(&self) {
pub fn tick_all_animations(&self, should_run_rafs: bool) {
let tick_type = mem::take(&mut *self.pending_animation_ticks.borrow_mut());
if tick_type.contains(AnimationTickType::REQUEST_ANIMATION_FRAME) {
if should_run_rafs {
self.run_the_animation_frame_callbacks();
}
if tick_type.contains(AnimationTickType::CSS_ANIMATIONS_AND_TRANSITIONS) {