diff options
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/bindings/global.rs | 4 | ||||
-rw-r--r-- | components/script/dom/document.rs | 6 | ||||
-rw-r--r-- | components/script/dom/htmldetailselement.rs | 1 | ||||
-rw-r--r-- | components/script/dom/htmlformelement.rs | 1 | ||||
-rw-r--r-- | components/script/dom/htmlmediaelement.rs | 1 | ||||
-rw-r--r-- | components/script/dom/htmlscriptelement.rs | 8 | ||||
-rw-r--r-- | components/script/dom/storage.rs | 1 | ||||
-rw-r--r-- | components/script/dom/window.rs | 2 |
8 files changed, 11 insertions, 13 deletions
diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs index adb94c9d2ca..cd0dbfabaa8 100644 --- a/components/script/dom/bindings/global.rs +++ b/components/script/dom/bindings/global.rs @@ -26,7 +26,7 @@ use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort}; use script_thread::{MainThreadScriptChan, ScriptThread}; use script_traits::{MsDuration, ScriptMsg as ConstellationMsg, TimerEventRequest}; use task_source::TaskSource; -use task_source::dom_manipulation::DOMManipulationTask; +use task_source::dom_manipulation::{DOMManipulationTask, DOMManipulationTaskSource}; use timers::{OneshotTimerCallback, OneshotTimerHandle}; use url::Url; @@ -193,7 +193,7 @@ impl<'a> GlobalRef<'a> { /// `TaskSource` used to queue DOM manipulation messages to the event loop of this global's /// thread. - pub fn dom_manipulation_task_source(&self) -> Box<TaskSource<DOMManipulationTask> + Send> { + pub fn dom_manipulation_task_source(&self) -> DOMManipulationTaskSource { match *self { GlobalRef::Window(ref window) => window.dom_manipulation_task_source(), GlobalRef::Worker(_) => unimplemented!(), diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 7729fe5a29a..56f8e98399f 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -1471,10 +1471,8 @@ impl Document { update_with_current_time_ms(&self.dom_content_loaded_event_start); - let doctarget = Trusted::new(self.upcast::<EventTarget>()); - let task_source = self.window().dom_manipulation_task_source(); - let _ = task_source.queue(DOMManipulationTask::FireEvent( - atom!("DOMContentLoaded"), doctarget, EventBubbles::Bubbles, EventCancelable::NotCancelable)); + self.window().dom_manipulation_task_source().queue_event(self.upcast(), atom!("DOMContentLoaded"), + EventBubbles::Bubbles, EventCancelable::NotCancelable); self.window().reflow(ReflowGoal::ForDisplay, ReflowQueryType::NoQuery, ReflowReason::DOMContentLoaded); diff --git a/components/script/dom/htmldetailselement.rs b/components/script/dom/htmldetailselement.rs index cde3aef6f86..d63e15178aa 100644 --- a/components/script/dom/htmldetailselement.rs +++ b/components/script/dom/htmldetailselement.rs @@ -18,6 +18,7 @@ use dom::virtualmethods::VirtualMethods; use script_thread::Runnable; use std::cell::Cell; use string_cache::Atom; +use task_source::TaskSource; use task_source::dom_manipulation::DOMManipulationTask; #[dom_struct] diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index 7f54fc7842b..30ab440b00e 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -50,6 +50,7 @@ use std::borrow::ToOwned; use std::cell::Cell; use std::sync::mpsc::Sender; use string_cache::Atom; +use task_source::TaskSource; use task_source::dom_manipulation::DOMManipulationTask; use url::form_urlencoded; use util::str::split_html_space_chars; diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index 9532de74677..7256ae1b131 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -32,6 +32,7 @@ use script_thread::{Runnable, ScriptThread}; use std::cell::Cell; use std::sync::{Arc, Mutex}; use string_cache::Atom; +use task_source::TaskSource; use task_source::dom_manipulation::DOMManipulationTask; use time::{self, Timespec, Duration}; use url::Url; diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index edd2152844e..780e5aa064b 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -462,16 +462,12 @@ impl HTMLScriptElement { if external { self.dispatch_load_event(); } else { - let script_element = Trusted::new(self.upcast::<EventTarget>()); - let task_source = window.dom_manipulation_task_source(); - task_source.queue(DOMManipulationTask::FireSimpleEvent(atom!("load"), script_element)).unwrap(); + window.dom_manipulation_task_source().queue_simple_event(self.upcast(), atom!("load")); } } pub fn queue_error_event(&self) { - let task_source = window_from_node(self).dom_manipulation_task_source(); - let script_element = Trusted::new(self.upcast::<EventTarget>()); - task_source.queue(DOMManipulationTask::FireSimpleEvent(atom!("error"), script_element)).unwrap(); + window_from_node(self).dom_manipulation_task_source().queue_simple_event(self.upcast(), atom!("error")); } pub fn dispatch_before_script_execute_event(&self) -> bool { diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs index 001fd19df3b..03747ed5ab6 100644 --- a/components/script/dom/storage.rs +++ b/components/script/dom/storage.rs @@ -18,6 +18,7 @@ use ipc_channel::ipc::{self, IpcSender}; use net_traits::IpcSend; use net_traits::storage_thread::{StorageThreadMsg, StorageType}; use script_thread::{MainThreadRunnable, ScriptThread}; +use task_source::TaskSource; use task_source::dom_manipulation::DOMManipulationTask; use url::Url; diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 475fef1a0ad..0ed85f576d9 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -280,7 +280,7 @@ impl Window { self.js_runtime.borrow().as_ref().unwrap().cx() } - pub fn dom_manipulation_task_source(&self) -> Box<TaskSource<DOMManipulationTask> + Send> { + pub fn dom_manipulation_task_source(&self) -> DOMManipulationTaskSource { self.dom_manipulation_task_source.clone() } |