Auto merge of #22389 - jdm:anim-complete, r=emilio,ferjm

Cancel animations that affect nodes that do not participate in layout.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22378
- [x] There are tests for these changes

<!-- 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/22389)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-12-10 18:04:49 -05:00 committed by GitHub
commit eeaca0b26d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 89 additions and 10 deletions

View file

@ -173,3 +173,8 @@ partial interface Window {
readonly attribute TestRunner testRunner;
//readonly attribute EventSender eventSender;
};
partial interface Window {
[Pref="css.animations.testing.enabled"]
readonly attribute unsigned long runningAnimationCount;
};

View file

@ -74,7 +74,7 @@ use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarker
use dom_struct::dom_struct;
use embedder_traits::EmbedderMsg;
use euclid::{Point2D, Rect, Size2D, TypedPoint2D, TypedScale, TypedSize2D, Vector2D};
use ipc_channel::ipc::IpcSender;
use ipc_channel::ipc::{channel, IpcSender};
use ipc_channel::router::ROUTER;
use js::jsapi::JSAutoCompartment;
use js::jsapi::JSContext;
@ -1144,6 +1144,12 @@ impl WindowMethods for Window {
self.test_runner.or_init(|| TestRunner::new(self.upcast()))
}
fn RunningAnimationCount(&self) -> u32 {
let (sender, receiver) = channel().unwrap();
let _ = self.layout_chan.send(Msg::GetRunningAnimations(sender));
receiver.recv().unwrap_or(0) as u32
}
// https://html.spec.whatwg.org/multipage/#dom-name
fn SetName(&self, name: DOMString) {
self.window_proxy().set_name(name);