aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/script/dom/document.rs4
-rw-r--r--components/script/script_thread.rs23
2 files changed, 18 insertions, 9 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index f7bfc88de82..83a98351ddc 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -2264,6 +2264,10 @@ impl Document {
&mut *self.animation_frame_list.borrow_mut(),
);
+ self.pending_animation_ticks
+ .borrow_mut()
+ .remove(AnimationTickType::REQUEST_ANIMATION_FRAME);
+
self.running_animation_callbacks.set(true);
let was_faking_animation_frames = self.is_faking_animation_frames();
let timing = self.global().performance().Now();
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index e17abcd65f1..b920a286c7c 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -1205,13 +1205,11 @@ impl ScriptThread {
.documents
.borrow()
.iter()
- .any(|(_, doc)| doc.has_received_raf_tick());
+ .any(|(_, doc)| doc.is_fully_active() && doc.has_received_raf_tick());
- let any_animations_running = self
- .documents
- .borrow()
- .iter()
- .any(|(_, document)| document.animations().running_animation_count() != 0);
+ let any_animations_running = self.documents.borrow().iter().any(|(_, document)| {
+ document.is_fully_active() && document.animations().running_animation_count() != 0
+ });
// TODO: The specification says to filter out non-renderable documents,
// as well as those for which a rendering update would be unnecessary,
@@ -1251,6 +1249,10 @@ impl ScriptThread {
.find_document(*pipeline_id)
.expect("Got pipeline for Document not managed by this ScriptThread.");
+ if !document.is_fully_active() {
+ continue;
+ }
+
// TODO(#31581): The steps in the "Revealing the document" section need to be implemente
// `process_pending_compositor_events` handles the focusing steps as well as other events
// from the compositor.
@@ -1350,14 +1352,17 @@ impl ScriptThread {
// ticks). In this case, don't schedule an opportunity, just wait for the next
// one.
if self.documents.borrow().iter().any(|(_, document)| {
- document.animations().running_animation_count() != 0 ||
- document.has_active_request_animation_frame_callbacks()
+ document.is_fully_active() &&
+ (document.animations().running_animation_count() != 0 ||
+ document.has_active_request_animation_frame_callbacks())
}) {
return;
}
let Some((_, document)) = self.documents.borrow().iter().find(|(_, document)| {
- !document.window().layout_blocked() && document.needs_reflow().is_some()
+ document.is_fully_active() &&
+ !document.window().layout_blocked() &&
+ document.needs_reflow().is_some()
}) else {
return;
};