Emit TransitionEnd events in the layout thread and process it in the script thread

This commit is contained in:
Keith Yeung 2016-09-03 07:27:39 -07:00
parent 752c6e6019
commit 668163ec5c
21 changed files with 103 additions and 62 deletions

View file

@ -444,6 +444,14 @@ impl<T: Reflectable> LayoutJS<T> {
debug_assert!(thread_state::get().is_layout());
*self.ptr
}
/// Returns a reference to the interior of this JS object. This method is
/// safe to call because it originates from the layout thread, and it cannot
/// mutate DOM nodes.
pub fn get_for_script(&self) -> &T {
debug_assert!(thread_state::get().is_script());
unsafe { &**self.ptr }
}
}
/// Get an `&T` out of a `Rc<T>`

View file

@ -472,6 +472,7 @@ macro_rules! global_event_handlers(
event_handler!(suspend, GetOnsuspend, SetOnsuspend);
event_handler!(timeupdate, GetOntimeupdate, SetOntimeupdate);
event_handler!(toggle, GetOntoggle, SetOntoggle);
event_handler!(transitionend, GetOntransitionend, SetOntransitionend);
event_handler!(volumechange, GetOnvolumechange, SetOnvolumechange);
event_handler!(waiting, GetOnwaiting, SetOnwaiting);
)

View file

@ -89,6 +89,11 @@ interface GlobalEventHandlers {
attribute EventHandler onwaiting;
};
// https://drafts.csswg.org/css-transitions/#interface-globaleventhandlers-idl
partial interface GlobalEventHandlers {
attribute EventHandler ontransitionend;
};
// https://html.spec.whatwg.org/multipage/#windoweventhandlers
[NoInterfaceObject, Exposed=(Window,Worker)]
interface WindowEventHandlers {

View file

@ -6,7 +6,8 @@
* https://dom.spec.whatwg.org/#event
*/
[Constructor(DOMString type, optional TransitionEventInit transitionEventInitDict)]
[Constructor(DOMString type, optional TransitionEventInit transitionEventInitDict),
Exposed=Window]
interface TransitionEvent : Event {
readonly attribute DOMString propertyName;
readonly attribute float elapsedTime;