diff --git a/components/compositing/compositor_layer.rs b/components/compositing/compositor_layer.rs index 470f70e7acfd..9c7d567c43aa 100644 --- a/components/compositing/compositor_layer.rs +++ b/components/compositing/compositor_layer.rs @@ -12,10 +12,11 @@ use gfx_traits::{Epoch, LayerId, LayerProperties, ScrollPolicy}; use layers::color::Color; use layers::geometry::LayerPixel; use layers::layers::{Layer, LayerBufferSet}; -use msg::constellation_msg::{MouseEventType, PipelineId}; +use msg::constellation_msg::PipelineId; use script_traits::CompositorEvent; use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent}; use script_traits::ConstellationControlMsg; +use script_traits::MouseEventType; use std::rc::Rc; use windowing::{MouseWindowEvent, WindowMethods}; @@ -519,4 +520,3 @@ impl RcCompositorLayer for Rc> { None); } } - diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index c6d2f65378cb..922785b7e254 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -200,13 +200,6 @@ bitflags! { } } -#[derive(Deserialize, HeapSizeOf, Serialize)] -pub enum MouseEventType { - Click, - MouseDown, - MouseUp, -} - /// The mouse button involved in the event. #[derive(Clone, Copy, Debug, Deserialize, Serialize)] pub enum MouseButton { diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 8a3b0c3a7762..604c09a3b2c0 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -83,12 +83,13 @@ use layout_interface::{LayoutChan, Msg, ReflowQueryType}; use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER}; use msg::constellation_msg::{AnimationState, PipelineId}; use msg::constellation_msg::{ConstellationChan, Key, KeyModifiers, KeyState}; -use msg::constellation_msg::{MouseButton, MouseEventType, MozBrowserEvent, SubpageId}; +use msg::constellation_msg::{MouseButton, MozBrowserEvent, SubpageId}; use net_traits::ControlMsg::{GetCookiesForUrl, SetCookiesForUrl}; use net_traits::CookieSource::NonHTTP; use net_traits::{AsyncResponseTarget, PendingAsyncLoad}; use num::ToPrimitive; use script_thread::{MainThreadScriptMsg, Runnable}; +use script_traits::MouseEventType; use script_traits::{ScriptMsg as ConstellationMsg, ScriptToCompositorMsg}; use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress}; use std::ascii::AsciiExt; diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 29793e1383a0..3e397f2b5f9e 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -64,7 +64,7 @@ use layout_interface::{self, LayoutChan, NewLayoutThreadInfo, ScriptLayoutChan}; use libc; use mem::heap_size_of_self_and_children; use msg::constellation_msg::{ConstellationChan, LoadData}; -use msg::constellation_msg::{MouseButton, MouseEventType, MozBrowserEvent, PipelineId}; +use msg::constellation_msg::{MouseButton, MozBrowserEvent, PipelineId}; use msg::constellation_msg::{PipelineNamespace}; use msg::constellation_msg::{SubpageId, WindowSizeData}; use msg::webdriver_msg::WebDriverScriptCommand; @@ -80,7 +80,8 @@ use profile_traits::mem::{self, OpaqueSender, Report, ReportKind, ReportsChan}; use profile_traits::time::{self, ProfilerCategory, profile}; use script_traits::CompositorEvent::{KeyEvent, MouseButtonEvent, MouseMoveEvent, ResizeEvent}; use script_traits::CompositorEvent::{TouchEvent}; -use script_traits::{CompositorEvent, ConstellationControlMsg, EventResult, InitialScriptState, NewLayoutInfo}; +use script_traits::{CompositorEvent, ConstellationControlMsg, EventResult}; +use script_traits::{InitialScriptState, MouseEventType, NewLayoutInfo}; use script_traits::{LayoutMsg, OpaqueScriptLayoutChannel, ScriptMsg as ConstellationMsg}; use script_traits::{ScriptThreadFactory, ScriptToCompositorMsg, TimerEvent, TimerEventRequest, TimerSource}; use script_traits::{TouchEventType, TouchId}; diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 4a84c7b71f37..fa27f37bd23d 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -40,9 +40,8 @@ use gfx_traits::LayerId; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use libc::c_void; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId, WindowSizeData}; -use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, SubpageId}; -use msg::constellation_msg::{MouseButton, MouseEventType}; -use msg::constellation_msg::{MozBrowserEvent, PipelineNamespaceId}; +use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, MouseButton}; +use msg::constellation_msg::{MozBrowserEvent, PipelineNamespaceId, SubpageId}; use msg::webdriver_msg::WebDriverScriptCommand; use net_traits::ResourceThread; use net_traits::image_cache_thread::ImageCacheThread; @@ -167,6 +166,17 @@ pub enum TouchEventType { #[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)] pub struct TouchId(pub i32); +/// The types of mouse events +#[derive(Deserialize, HeapSizeOf, Serialize)] +pub enum MouseEventType { + /// Mouse button clicked + Click, + /// Mouse button down + MouseDown, + /// Mouse button up + MouseUp, +} + /// Events from the compositor that the script thread needs to know about #[derive(Deserialize, Serialize)] pub enum CompositorEvent { diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs index e88605e66ea5..5d392f016c8f 100644 --- a/components/script_traits/script_msg.rs +++ b/components/script_traits/script_msg.rs @@ -3,14 +3,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use IFrameLoadInfo; +use MouseEventType; use canvas_traits::CanvasMsg; use euclid::point::Point2D; use euclid::size::Size2D; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::{AnimationState, DocumentState, NavigationDirection}; use msg::constellation_msg::{Failure, MozBrowserEvent, PipelineId}; -use msg::constellation_msg::{LoadData, SubpageId}; -use msg::constellation_msg::{MouseButton, MouseEventType}; +use msg::constellation_msg::{LoadData, MouseButton, SubpageId}; use offscreen_gl_context::GLContextAttributes; use style_traits::viewport::ViewportConstraints; use url::Url;