Auto merge of #17410 - asajeffrey:compositor-nested-rAF-with-reftest-wait, r=jdm

Support nested requestAnimationFrame in the presence of reftest-wait

<!-- Please describe your changes on the following line: -->

Currently, nested rAF callbacks don't get called in the presence of reftest-wait. This PR fixes that.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #17408
- [X] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17410)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-06-19 13:25:36 -07:00 committed by GitHub
commit 5f10a25ead
4 changed files with 49 additions and 13 deletions

View file

@ -1491,19 +1491,15 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}; };
if wait_for_stable_image { if wait_for_stable_image {
match self.is_ready_to_paint_image_output() { // The current image may be ready to output. However, if there are animations active,
Ok(()) => { // tick those instead and continue waiting for the image output to be stable AND
// The current image is ready to output. However, if there are animations active, // all active animations to complete.
// tick those instead and continue waiting for the image output to be stable AND if self.animations_active() {
// all active animations to complete. self.process_animations();
if self.animations_active() { return Err(UnableToComposite::NotReadyToPaintImage(NotReadyToPaint::AnimationsActive));
self.process_animations(); }
return Err(UnableToComposite::NotReadyToPaintImage(NotReadyToPaint::AnimationsActive)); if let Err(result) = self.is_ready_to_paint_image_output() {
} return Err(UnableToComposite::NotReadyToPaintImage(result))
}
Err(result) => {
return Err(UnableToComposite::NotReadyToPaintImage(result))
}
} }
} }

View file

@ -6533,6 +6533,18 @@
{} {}
] ]
], ],
"mozilla/request_animation_frame_reftest_wait.html": [
[
"/_mozilla/mozilla/request_animation_frame_reftest_wait.html",
[
[
"/_mozilla/mozilla/request_animation_frame_reftest_wait_ref.html",
"=="
]
],
{}
]
],
"mozilla/restyle-out-of-document.html": [ "mozilla/restyle-out-of-document.html": [
[ [
"/_mozilla/mozilla/restyle-out-of-document.html", "/_mozilla/mozilla/restyle-out-of-document.html",
@ -11037,6 +11049,11 @@
{} {}
] ]
], ],
"mozilla/request_animation_frame_reftest_wait_ref.html": [
[
{}
]
],
"mozilla/resources/background-green.css": [ "mozilla/resources/background-green.css": [
[ [
{} {}
@ -31446,6 +31463,14 @@
"df273cf90396cc2d3d3159ce72176122ab9518e5", "df273cf90396cc2d3d3159ce72176122ab9518e5",
"support" "support"
], ],
"mozilla/request_animation_frame_reftest_wait.html": [
"9c5ce337c92c9954475309f3865a9b47b59fbe4d",
"reftest"
],
"mozilla/request_animation_frame_reftest_wait_ref.html": [
"585548dfc915e3d53690e68ef07098044df39f1f",
"support"
],
"mozilla/resources/background-green.css": [ "mozilla/resources/background-green.css": [
"bb230110dd1cf4647e020d7172bc375e972c7b41", "bb230110dd1cf4647e020d7172bc375e972c7b41",
"support" "support"

View file

@ -0,0 +1,12 @@
<html class="reftest-wait">
<title>Mix requestAnimationFrame with reftest-wait</title>
<link rel=match href=/_mozilla/mozilla/request_animation_frame_reftest_wait_ref.html>
<script>
// A regression test for https://github.com/servo/servo/issues/17408
requestAnimationFrame(function() {
requestAnimationFrame(function() {
document.documentElement.classList.remove("reftest-wait");
});
});
</script>
</html>

View file

@ -0,0 +1,3 @@
<html>
<title>Mix requestAnimationFrame with reftest-wait</title>
</html>