diff options
author | Connor Brewster <connor.brewster@eagles.oc.edu> | 2017-06-21 14:40:34 -0600 |
---|---|---|
committer | Connor Brewster <connor.brewster@eagles.oc.edu> | 2017-07-17 22:23:45 -0600 |
commit | 46659915036bb44e73e7ef2696ea9f35105f1659 (patch) | |
tree | 7713715250a9ff9f695062fdceec0acf40f10488 /components/script/script_thread.rs | |
parent | 596ed557d2a44174572eec28b9945f317f1310de (diff) | |
download | servo-46659915036bb44e73e7ef2696ea9f35105f1659.tar.gz servo-46659915036bb44e73e7ef2696ea9f35105f1659.zip |
Support custom element callback reactions
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 641d761b373..1953f5691bd 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -39,6 +39,7 @@ use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; use dom::bindings::trace::JSTraceable; use dom::bindings::utils::WRAP_CALLBACKS; +use dom::customelementregistry::{CallbackReaction, CustomElementReactionStack}; use dom::document::{Document, DocumentSource, FocusType, HasBrowsingContext, IsHTMLDocument, TouchEventResult}; use dom::element::Element; use dom::event::{Event, EventBubbles, EventCancelable}; @@ -510,6 +511,9 @@ pub struct ScriptThread { /// A list of nodes with in-progress CSS transitions, which roots them for the duration /// of the transition. transitioning_nodes: DOMRefCell<Vec<JS<Node>>>, + + /// https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack + custom_element_reaction_stack: CustomElementReactionStack, } /// In the event of thread panic, all data on the stack runs its destructor. However, there @@ -742,6 +746,15 @@ impl ScriptThread { let _ = window.layout_chan().send(msg); } + pub fn enqueue_callback_reaction(element:&Element, reaction: CallbackReaction) { + SCRIPT_THREAD_ROOT.with(|root| { + if let Some(script_thread) = root.get() { + let script_thread = unsafe { &*script_thread }; + script_thread.custom_element_reaction_stack.enqueue_callback_reaction(element, reaction); + } + }) + } + /// Creates a new script thread. pub fn new(state: InitialScriptState, port: Receiver<MainThreadScriptMsg>, @@ -827,6 +840,8 @@ impl ScriptThread { docs_with_no_blocking_loads: Default::default(), transitioning_nodes: Default::default(), + + custom_element_reaction_stack: CustomElementReactionStack::new(), } } |