Auto merge of #9263 - DarinM223:move_mousebutton, r=KiChjang

Moved MouseButton from msg to script_traits

Fixes #9250

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9263)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-01-16 19:34:51 +05:30
commit 9118b64b4b
13 changed files with 31 additions and 25 deletions

View file

@ -28,14 +28,14 @@ use layers::rendergl::RenderContext;
use layers::scene::Scene; use layers::scene::Scene;
use layout_traits::LayoutControlChan; use layout_traits::LayoutControlChan;
use msg::constellation_msg::{Image, PixelFormat}; use msg::constellation_msg::{Image, PixelFormat};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, MouseButton}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
use msg::constellation_msg::{NavigationDirection, PipelineId, WindowSizeData}; use msg::constellation_msg::{NavigationDirection, PipelineId, WindowSizeData};
use pipeline::CompositionPipeline; use pipeline::CompositionPipeline;
use profile_traits::mem::{self, ReportKind, Reporter, ReporterRequest}; use profile_traits::mem::{self, ReportKind, Reporter, ReporterRequest};
use profile_traits::time::{self, ProfilerCategory, profile}; use profile_traits::time::{self, ProfilerCategory, profile};
use script_traits::CompositorEvent::{MouseMoveEvent, TouchEvent}; use script_traits::CompositorEvent::{MouseMoveEvent, TouchEvent};
use script_traits::{AnimationState, ConstellationControlMsg, LayoutControlMsg}; use script_traits::{AnimationState, ConstellationControlMsg, LayoutControlMsg};
use script_traits::{TouchEventType, TouchId}; use script_traits::{MouseButton, TouchEventType, TouchId};
use scrolling::ScrollingTimerProxy; use scrolling::ScrollingTimerProxy;
use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};

View file

@ -11,9 +11,9 @@ use euclid::size::TypedSize2D;
use euclid::{Point2D, Size2D}; use euclid::{Point2D, Size2D};
use layers::geometry::DevicePixel; use layers::geometry::DevicePixel;
use layers::platform::surface::NativeDisplay; use layers::platform::surface::NativeDisplay;
use msg::constellation_msg::{Key, KeyModifiers, KeyState, MouseButton}; use msg::constellation_msg::{Key, KeyModifiers, KeyState};
use net_traits::net_error_list::NetError; use net_traits::net_error_list::NetError;
use script_traits::{TouchEventType, TouchId}; use script_traits::{MouseButton, TouchEventType, TouchId};
use std::fmt::{Debug, Error, Formatter}; use std::fmt::{Debug, Error, Formatter};
use std::rc::Rc; use std::rc::Rc;
use url::Url; use url::Url;

View file

@ -200,17 +200,6 @@ bitflags! {
} }
} }
/// The mouse button involved in the event.
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
pub enum MouseButton {
/// The left mouse button.
Left,
/// The middle mouse button.
Middle,
/// The right mouse button.
Right,
}
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
pub enum WebDriverCommandMsg { pub enum WebDriverCommandMsg {
LoadUrl(PipelineId, LoadData, IpcSender<LoadStatus>), LoadUrl(PipelineId, LoadData, IpcSender<LoadStatus>),

View file

@ -82,13 +82,13 @@ use layout_interface::{HitTestResponse, MouseOverResponse};
use layout_interface::{LayoutChan, Msg, ReflowQueryType}; use layout_interface::{LayoutChan, Msg, ReflowQueryType};
use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER}; use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER};
use msg::constellation_msg::{ConstellationChan, Key, KeyModifiers, KeyState}; use msg::constellation_msg::{ConstellationChan, Key, KeyModifiers, KeyState};
use msg::constellation_msg::{MouseButton, PipelineId, SubpageId}; use msg::constellation_msg::{PipelineId, SubpageId};
use net_traits::ControlMsg::{GetCookiesForUrl, SetCookiesForUrl}; use net_traits::ControlMsg::{GetCookiesForUrl, SetCookiesForUrl};
use net_traits::CookieSource::NonHTTP; use net_traits::CookieSource::NonHTTP;
use net_traits::{AsyncResponseTarget, PendingAsyncLoad}; use net_traits::{AsyncResponseTarget, PendingAsyncLoad};
use num::ToPrimitive; use num::ToPrimitive;
use script_thread::{MainThreadScriptMsg, Runnable}; use script_thread::{MainThreadScriptMsg, Runnable};
use script_traits::{AnimationState, MouseEventType, MozBrowserEvent}; use script_traits::{AnimationState, MouseButton, MouseEventType, MozBrowserEvent};
use script_traits::{ScriptMsg as ConstellationMsg, ScriptToCompositorMsg}; use script_traits::{ScriptMsg as ConstellationMsg, ScriptToCompositorMsg};
use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress}; use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress};
use std::ascii::AsciiExt; use std::ascii::AsciiExt;

View file

@ -64,8 +64,7 @@ use layout_interface::{self, LayoutChan, NewLayoutThreadInfo, ScriptLayoutChan};
use libc; use libc;
use mem::heap_size_of_self_and_children; use mem::heap_size_of_self_and_children;
use msg::constellation_msg::{ConstellationChan, LoadData}; use msg::constellation_msg::{ConstellationChan, LoadData};
use msg::constellation_msg::{MouseButton, PipelineId}; use msg::constellation_msg::{PipelineId, PipelineNamespace};
use msg::constellation_msg::{PipelineNamespace};
use msg::constellation_msg::{SubpageId, WindowSizeData}; use msg::constellation_msg::{SubpageId, WindowSizeData};
use msg::webdriver_msg::WebDriverScriptCommand; use msg::webdriver_msg::WebDriverScriptCommand;
use net_traits::LoadData as NetLoadData; use net_traits::LoadData as NetLoadData;
@ -81,7 +80,7 @@ use profile_traits::time::{self, ProfilerCategory, profile};
use script_traits::CompositorEvent::{KeyEvent, MouseButtonEvent, MouseMoveEvent, ResizeEvent}; use script_traits::CompositorEvent::{KeyEvent, MouseButtonEvent, MouseMoveEvent, ResizeEvent};
use script_traits::CompositorEvent::{TouchEvent}; use script_traits::CompositorEvent::{TouchEvent};
use script_traits::{CompositorEvent, ConstellationControlMsg, EventResult}; use script_traits::{CompositorEvent, ConstellationControlMsg, EventResult};
use script_traits::{InitialScriptState, MouseEventType, MozBrowserEvent, NewLayoutInfo}; use script_traits::{InitialScriptState, MouseButton, MouseEventType, MozBrowserEvent, NewLayoutInfo};
use script_traits::{LayoutMsg, OpaqueScriptLayoutChannel, ScriptMsg as ConstellationMsg}; use script_traits::{LayoutMsg, OpaqueScriptLayoutChannel, ScriptMsg as ConstellationMsg};
use script_traits::{ScriptThreadFactory, ScriptToCompositorMsg, TimerEvent, TimerEventRequest, TimerSource}; use script_traits::{ScriptThreadFactory, ScriptToCompositorMsg, TimerEvent, TimerEventRequest, TimerSource};
use script_traits::{TouchEventType, TouchId}; use script_traits::{TouchEventType, TouchId};

View file

@ -40,7 +40,7 @@ use gfx_traits::LayerId;
use ipc_channel::ipc::{IpcReceiver, IpcSender}; use ipc_channel::ipc::{IpcReceiver, IpcSender};
use libc::c_void; use libc::c_void;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId, WindowSizeData}; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId, WindowSizeData};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, MouseButton}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
use msg::constellation_msg::{PipelineNamespaceId, SubpageId}; use msg::constellation_msg::{PipelineNamespaceId, SubpageId};
use msg::webdriver_msg::WebDriverScriptCommand; use msg::webdriver_msg::WebDriverScriptCommand;
use net_traits::ResourceThread; use net_traits::ResourceThread;
@ -189,6 +189,17 @@ pub enum TouchEventType {
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)] #[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct TouchId(pub i32); pub struct TouchId(pub i32);
/// The mouse button involved in the event.
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
pub enum MouseButton {
/// The left mouse button.
Left,
/// The middle mouse button.
Middle,
/// The right mouse button.
Right,
}
/// The types of mouse events /// The types of mouse events
#[derive(Deserialize, HeapSizeOf, Serialize)] #[derive(Deserialize, HeapSizeOf, Serialize)]
pub enum MouseEventType { pub enum MouseEventType {

View file

@ -5,6 +5,7 @@
use AnimationState; use AnimationState;
use DocumentState; use DocumentState;
use IFrameLoadInfo; use IFrameLoadInfo;
use MouseButton;
use MouseEventType; use MouseEventType;
use MozBrowserEvent; use MozBrowserEvent;
use canvas_traits::CanvasMsg; use canvas_traits::CanvasMsg;
@ -12,7 +13,7 @@ use euclid::point::Point2D;
use euclid::size::Size2D; use euclid::size::Size2D;
use ipc_channel::ipc::IpcSender; use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::{Failure, NavigationDirection, PipelineId}; use msg::constellation_msg::{Failure, NavigationDirection, PipelineId};
use msg::constellation_msg::{LoadData, MouseButton, SubpageId}; use msg::constellation_msg::{LoadData, SubpageId};
use offscreen_gl_context::GLContextAttributes; use offscreen_gl_context::GLContextAttributes;
use style_traits::viewport::ViewportConstraints; use style_traits::viewport::ViewportConstraints;
use url::Url; use url::Url;

View file

@ -14,7 +14,8 @@ use compositing::windowing::{WindowEvent, MouseWindowEvent};
use euclid::point::Point2D; use euclid::point::Point2D;
use euclid::size::Size2D; use euclid::size::Size2D;
use libc::{c_double, c_int}; use libc::{c_double, c_int};
use msg::constellation_msg::{self, KeyModifiers, KeyState, MouseButton}; use msg::constellation_msg::{self, KeyModifiers, KeyState};
use script_traits::MouseButton;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
pub struct ServoCefBrowserHost { pub struct ServoCefBrowserHost {

View file

@ -253,7 +253,7 @@ impl Window {
/// Helper function to handle a click /// Helper function to handle a click
fn handle_mouse(&self, button: glutin::MouseButton, action: glutin::ElementState, x: i32, y: i32) { fn handle_mouse(&self, button: glutin::MouseButton, action: glutin::ElementState, x: i32, y: i32) {
use msg::constellation_msg::MouseButton; use script_traits::MouseButton;
// FIXME(tkuehn): max pixel dist should be based on pixel density // FIXME(tkuehn): max pixel dist should be based on pixel density
let max_pixel_dist = 10f64; let max_pixel_dist = 10f64;

1
ports/gonk/Cargo.lock generated
View file

@ -16,6 +16,7 @@ dependencies = [
"net_traits 0.0.1", "net_traits 0.0.1",
"profile 0.0.1", "profile 0.0.1",
"script 0.0.1", "script 0.0.1",
"script_traits 0.0.1",
"servo 0.0.1", "servo 0.0.1",
"servo-egl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "servo-egl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -18,6 +18,9 @@ path = "../../components/msg"
[dependencies.script] [dependencies.script]
path = "../../components/script" path = "../../components/script"
[dependencies.script_traits]
path = "../../components/script_traits"
[dependencies.net_traits] [dependencies.net_traits]
path = "../../components/net_traits" path = "../../components/net_traits"

View file

@ -6,7 +6,7 @@ use compositing::windowing::{WindowEvent, MouseWindowEvent};
use errno::errno; use errno::errno;
use euclid::point::Point2D; use euclid::point::Point2D;
use libc::{c_int, c_long, time_t}; use libc::{c_int, c_long, time_t};
use msg::constellation_msg::MouseButton; use script_traits::MouseButton;
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
use std::mem::{size_of, transmute, zeroed}; use std::mem::{size_of, transmute, zeroed};

View file

@ -33,6 +33,7 @@ extern crate layers;
extern crate libc; extern crate libc;
extern crate msg; extern crate msg;
extern crate net_traits; extern crate net_traits;
extern crate script_traits;
extern crate servo; extern crate servo;
extern crate time; extern crate time;
extern crate url; extern crate url;