Remove usage of FnBox for animation frame callbacks (fixes #14416)

This commit is contained in:
Anthony Ramine 2016-12-06 10:17:42 -10:00
parent 58919f17a6
commit e8c9c12b6e
5 changed files with 39 additions and 32 deletions

View file

@ -6,7 +6,6 @@ use app_units::Au;
use bluetooth_traits::BluetoothRequest;
use cssparser::Parser;
use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarkerType};
use dom::bindings::callback::ExceptionHandling;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState};
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
@ -30,7 +29,7 @@ use dom::bindings::utils::{GlobalStaticData, WindowProxyHandler};
use dom::browsingcontext::BrowsingContext;
use dom::crypto::Crypto;
use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration};
use dom::document::Document;
use dom::document::{AnimationFrameCallback, Document};
use dom::element::Element;
use dom::event::Event;
use dom::globalscope::GlobalScope;
@ -599,15 +598,8 @@ impl WindowMethods for Window {
/// https://html.spec.whatwg.org/multipage/#dom-window-requestanimationframe
fn RequestAnimationFrame(&self, callback: Rc<FrameRequestCallback>) -> u32 {
let doc = self.Document();
let callback = move |now: f64| {
// TODO: @jdm The spec says that any exceptions should be suppressed;
// https://github.com/servo/servo/issues/6928
let _ = callback.Call__(Finite::wrap(now), ExceptionHandling::Report);
};
doc.request_animation_frame(Box::new(callback))
self.Document()
.request_animation_frame(AnimationFrameCallback::FrameRequestCallback { callback })
}
/// https://html.spec.whatwg.org/multipage/#dom-window-cancelanimationframe