diff options
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 7a23867fc8b..8a7fc82f52e 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -65,8 +65,7 @@ use js::jsval::UndefinedValue; use js::rust::Runtime; use mem::heap_size_of_self_and_children; use msg::constellation_msg::{FrameType, LoadData, PanicMsg, PipelineId, PipelineNamespace}; -use msg::constellation_msg::{SubpageId, WindowSizeData, WindowSizeType}; -use msg::webdriver_msg::WebDriverScriptCommand; +use msg::constellation_msg::{SubpageId, WindowSizeType}; use net_traits::LoadData as NetLoadData; use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheResult, ImageCacheThread}; @@ -83,11 +82,12 @@ use script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; use script_runtime::{ScriptPort, StackRootTLS, new_rt_and_cx, get_reports}; use script_traits::CompositorEvent::{KeyEvent, MouseButtonEvent, MouseMoveEvent, ResizeEvent}; use script_traits::CompositorEvent::{TouchEvent, TouchpadPressureEvent}; +use script_traits::webdriver_msg::WebDriverScriptCommand; use script_traits::{CompositorEvent, ConstellationControlMsg, EventResult}; use script_traits::{InitialScriptState, MouseButton, MouseEventType, MozBrowserEvent}; use script_traits::{NewLayoutInfo, ScriptMsg as ConstellationMsg}; use script_traits::{ScriptThreadFactory, TimerEvent, TimerEventRequest, TimerSource}; -use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress}; +use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress, WindowSizeData}; use std::borrow::ToOwned; use std::cell::Cell; use std::collections::{HashMap, HashSet}; @@ -200,11 +200,9 @@ impl<T: Runnable + Send> Runnable for CancellableRunnable<T> { pub trait Runnable { fn is_cancelled(&self) -> bool { false } - fn handler(self: Box<Self>); -} - -pub trait MainThreadRunnable { - fn handler(self: Box<Self>, script_thread: &ScriptThread); + fn name(&self) -> &'static str { "generic runnable" } + fn handler(self: Box<Self>) {} + fn main_thread_handler(self: Box<Self>, _script_thread: &ScriptThread) { self.handler(); } } enum MixedMessage { @@ -1223,7 +1221,7 @@ impl ScriptThread { // https://html.spec.whatwg.org/multipage/#the-end step 7 let handler = box DocumentProgressHandler::new(Trusted::new(doc)); - self.dom_manipulation_task_source.queue(DOMManipulationTask::DocumentProgress(handler)).unwrap(); + self.dom_manipulation_task_source.queue(DOMManipulationTask::Runnable(handler)).unwrap(); self.constellation_chan.send(ConstellationMsg::LoadComplete(pipeline)).unwrap(); } @@ -1937,12 +1935,12 @@ impl ScriptThread { document.r().handle_touchpad_pressure_event(self.js_runtime.rt(), point, pressure, phase); } - KeyEvent(key, state, modifiers) => { + KeyEvent(ch, key, state, modifiers) => { let document = match self.root_browsing_context().find(pipeline_id) { Some(browsing_context) => browsing_context.active_document(), None => return warn!("Message sent to closed pipeline {}.", pipeline_id), }; - document.dispatch_key_event(key, state, modifiers, &self.constellation_chan); + document.dispatch_key_event(ch, key, state, modifiers, &self.constellation_chan); } } } |