mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Ensure that when outputting screenshots, animations are ticked as required.
Fixes timeout in transition_calc.html.
This commit is contained in:
parent
de81d88324
commit
6a85102a5a
1 changed files with 34 additions and 21 deletions
|
@ -65,8 +65,7 @@ pub enum NotReadyToPaint {
|
||||||
LayerHasOutstandingPaintMessages,
|
LayerHasOutstandingPaintMessages,
|
||||||
MissingRoot,
|
MissingRoot,
|
||||||
PendingSubpages(usize),
|
PendingSubpages(usize),
|
||||||
AnimationsRunning,
|
AnimationsActive,
|
||||||
AnimationCallbacksRunning,
|
|
||||||
JustNotifiedConstellation,
|
JustNotifiedConstellation,
|
||||||
WaitingOnConstellation,
|
WaitingOnConstellation,
|
||||||
}
|
}
|
||||||
|
@ -1584,6 +1583,22 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if any pipelines currently have active animations or animation callbacks.
|
||||||
|
fn animations_active(&self) -> bool {
|
||||||
|
for (_, details) in &self.pipeline_details {
|
||||||
|
// If animations are currently running, then don't bother checking
|
||||||
|
// with the constellation if the output image is stable.
|
||||||
|
if details.animations_running {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if details.animation_callbacks_running {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
/// Query the constellation to see if the current compositor
|
/// Query the constellation to see if the current compositor
|
||||||
/// output matches the current frame tree output, and if the
|
/// output matches the current frame tree output, and if the
|
||||||
/// associated script threads are idle.
|
/// associated script threads are idle.
|
||||||
|
@ -1617,15 +1632,6 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
// frame tree.
|
// frame tree.
|
||||||
let mut pipeline_epochs = HashMap::new();
|
let mut pipeline_epochs = HashMap::new();
|
||||||
for (id, details) in &self.pipeline_details {
|
for (id, details) in &self.pipeline_details {
|
||||||
// If animations are currently running, then don't bother checking
|
|
||||||
// with the constellation if the output image is stable.
|
|
||||||
if details.animations_running {
|
|
||||||
return Err(NotReadyToPaint::AnimationsRunning);
|
|
||||||
}
|
|
||||||
if details.animation_callbacks_running {
|
|
||||||
return Err(NotReadyToPaint::AnimationCallbacksRunning);
|
|
||||||
}
|
|
||||||
|
|
||||||
pipeline_epochs.insert(*id, details.current_epoch);
|
pipeline_epochs.insert(*id, details.current_epoch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1686,19 +1692,26 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
return Err(UnableToComposite::WindowUnprepared)
|
return Err(UnableToComposite::WindowUnprepared)
|
||||||
}
|
}
|
||||||
|
|
||||||
match target {
|
let wait_for_stable_image = match target {
|
||||||
CompositeTarget::WindowAndPng | CompositeTarget::PngFile => {
|
CompositeTarget::WindowAndPng | CompositeTarget::PngFile => true,
|
||||||
if let Err(result) = self.is_ready_to_paint_image_output() {
|
CompositeTarget::Window => opts::get().exit_after_load,
|
||||||
|
};
|
||||||
|
|
||||||
|
if wait_for_stable_image {
|
||||||
|
match self.is_ready_to_paint_image_output() {
|
||||||
|
Ok(()) => {
|
||||||
|
// The current image is ready to output. However, if there are animations active,
|
||||||
|
// tick those instead and continue waiting for the image output to be stable AND
|
||||||
|
// all active animations to complete.
|
||||||
|
if self.animations_active() {
|
||||||
|
self.process_animations();
|
||||||
|
return Err(UnableToComposite::NotReadyToPaintImage(NotReadyToPaint::AnimationsActive));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(result) => {
|
||||||
return Err(UnableToComposite::NotReadyToPaintImage(result))
|
return Err(UnableToComposite::NotReadyToPaintImage(result))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CompositeTarget::Window => {
|
|
||||||
if opts::get().exit_after_load {
|
|
||||||
if let Err(result) = self.is_ready_to_paint_image_output() {
|
|
||||||
return Err(UnableToComposite::NotReadyToPaintImage(result))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let (framebuffer_ids, texture_ids) = match target {
|
let (framebuffer_ids, texture_ids) = match target {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue