compositor: Do not wait for animation termination to take screenshots (#38055)

WPT tests are expected to create screenshots as soon as everything is
loaded. If an animation is happening adding the "reftest-wait" class to
the root element is appropriate way to delay the screenshot. Previously,
the
test harness was waiting for all animations to finish, but that is just
leading to many timeouts. Removing that code fixes the timeouts.

Two Servo-specific tests are also updated as they were written with
Servo's previous behavior in mind.

Testing: There are test result updates for this change. Many TIMEOUTS
now either correctly
PASS OR FAIL.
Fixes: #36931.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-07-14 14:18:18 +02:00 committed by GitHub
parent f6b98d5c56
commit 5bc3c3088a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
45 changed files with 26 additions and 102 deletions

View file

@ -66,7 +66,6 @@ enum UnableToComposite {
#[derive(Debug, PartialEq)]
enum NotReadyToPaint {
AnimationsActive,
JustNotifiedConstellation,
WaitingOnConstellation,
}
@ -234,10 +233,6 @@ pub(crate) struct PipelineDetails {
}
impl PipelineDetails {
pub(crate) fn animations_or_animation_callbacks_running(&self) -> bool {
self.animations_running || self.animation_callbacks_running
}
pub(crate) fn animation_callbacks_running(&self) -> bool {
self.animation_callbacks_running
}
@ -1273,13 +1268,6 @@ impl IOCompositor {
.get(&pipeline_id)
}
// Check if any pipelines currently have active animations or animation callbacks.
fn animations_or_animation_callbacks_running(&self) -> bool {
self.webview_renderers
.iter()
.any(WebViewRenderer::animations_or_animation_callbacks_running)
}
/// Returns true if any animation callbacks (ie `requestAnimationFrame`) are waiting for a response.
fn animation_callbacks_running(&self) -> bool {
self.webview_renderers
@ -1424,13 +1412,6 @@ impl IOCompositor {
}
if opts::get().wait_for_stable_image {
// The current image may be ready to output. However, if there are animations active,
// continue waiting for the image output to be stable AND all active animations to complete.
if self.animations_or_animation_callbacks_running() {
return Err(UnableToComposite::NotReadyToPaintImage(
NotReadyToPaint::AnimationsActive,
));
}
if let Err(result) = self.is_ready_to_paint_image_output() {
return Err(UnableToComposite::NotReadyToPaintImage(result));
}

View file

@ -139,12 +139,6 @@ impl WebViewRenderer {
}
}
pub(crate) fn animations_or_animation_callbacks_running(&self) -> bool {
self.pipelines
.values()
.any(PipelineDetails::animations_or_animation_callbacks_running)
}
pub(crate) fn animation_callbacks_running(&self) -> bool {
self.pipelines
.values()

View file

@ -1,2 +1,2 @@
[animation-delay-008.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[animation-delay-009.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[animation-important-002.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +0,0 @@
[chrome-bug-404743651.html]
expected: TIMEOUT

View file

@ -1,2 +1,2 @@
[inheritance-pseudo-element.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +0,0 @@
[transform-animation-under-large-scale.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[translation-animation-on-important-property.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[translation-animation-subpixel-offset.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[background-color-animation-element-not-visible-at-current-viewport.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[background-color-animation-fragmented.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[background-color-animation-in-body.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[background-color-animation-non-zero-size-element-change-to-zero.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[background-color-animation-with-images.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[background-color-animation-with-table2.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[background-color-animation-with-table3.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[background-color-animation-zero-size-element-change-to-non-zero.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[background-color-transition.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[background-color-transparent-animation-in-body.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[background-color-animation-with-zero-alpha.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[important-prop.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[size-change-during-transition-crash.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[font-size-monospace-adjust.html]
expected: TIMEOUT

View file

@ -1,2 +1,2 @@
[first-line-inherited-with-transition.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +0,0 @@
[animation-part.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[rotate-animation-with-will-change-transform-001.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[backface-visibility-hidden-animated-001.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[backface-visibility-hidden-animated-002.html]
expected: TIMEOUT

View file

@ -1,2 +1,2 @@
[individual-transform-combine.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[individual-transform-ordering.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +1,2 @@
[stacking-context-001.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +0,0 @@
[allow-discrete-auto-inset.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[vh-interpolate-pct.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[vh-interpolate-px.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[vh-interpolate-vh.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[broken-reference-crash-001.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[appearance-animation-001.html]
expected: TIMEOUT

View file

@ -1,2 +1,2 @@
[appearance-animation-002.html]
expected: TIMEOUT
expected: FAIL

View file

@ -1,2 +0,0 @@
[appearance-transition-001.html]
expected: TIMEOUT

View file

@ -1,2 +0,0 @@
[appearance-transition-002.html]
expected: TIMEOUT

View file

@ -1,2 +1,2 @@
[appearance-transition-003.html]
expected: TIMEOUT
expected: FAIL

View file

@ -2887,7 +2887,7 @@
]
],
"incremental_trailing_whitespace_a.html": [
"f59bd91d9ea23effec2a888649e345937cf0addd",
"eca05c4f79fb786492e81aa7881aaa0d75899811",
[
null,
[
@ -3186,7 +3186,7 @@
]
],
"inline_block_opacity_change.html": [
"aa51ab444cddb381b6ca76615a30573f49f6f6c3",
"6df5d7466d6569a7d1969d5c49a83a7a3564ef7b",
[
null,
[

View file

@ -1,5 +1,5 @@
<!doctype html>
<html>
<html class="reftest-wait">
<head>
<meta charset="utf-8">
<title>incremental trailing whitespace test</title>
@ -19,9 +19,13 @@
<div id="a" style="transition: all .1s ease-out;">Hello</div>
</div>
<script>
let transitioningDiv = document.querySelector('#a');
transitioningDiv.addEventListener('transitionend', () => {
document.documentElement.classList.remove("reftest-wait");
});
document.body.offsetWidth; // force layout
document.querySelector('#a').classList.add('go');
// FIXME (#10245): Wait for the "transitionend" event.
transitioningDiv.classList.add('go');
</script>
</body>
</html>

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html class="reftest-wait">
<head>
<link rel="match" href="inline_block_opacity_change_ref.html">
<style>
@ -19,8 +19,13 @@
<body>
<span style="transition: opacity .1s ease-out;" id="a">a</span>
<script>
let transitioningSpan = document.querySelector('#a');
transitioningSpan.addEventListener("transitionend", () => {
document.documentElement.classList.remove("reftest-wait");
});
document.body.offsetWidth; // force layout
document.querySelector('#a').classList.add('go');
transitioningSpan.classList.add('go');
</script>
</body>
</html>