diff options
Diffstat (limited to 'components/script_traits/script_msg.rs')
-rw-r--r-- | components/script_traits/script_msg.rs | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs index aee49bac43f..d1f56a6e790 100644 --- a/components/script_traits/script_msg.rs +++ b/components/script_traits/script_msg.rs @@ -11,9 +11,10 @@ use MozBrowserEvent; use canvas_traits::CanvasMsg; use euclid::point::Point2D; use euclid::size::Size2D; +use gfx_traits::LayerId; use ipc_channel::ipc::IpcSender; -use msg::constellation_msg::{LoadData, SubpageId}; -use msg::constellation_msg::{NavigationDirection, PipelineId}; +use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData}; +use msg::constellation_msg::{NavigationDirection, PipelineId, SubpageId}; use offscreen_gl_context::{GLContextAttributes, GLLimits}; use style_traits::cursor::Cursor; use style_traits::viewport::ViewportConstraints; @@ -30,6 +31,15 @@ pub enum LayoutMsg { ViewportConstrained(PipelineId, ViewportConstraints), } +/// Whether a DOM event was prevented by web content +#[derive(Deserialize, Serialize)] +pub enum EventResult { + /// Allowed by web content + DefaultAllowed, + /// Prevented by web content + DefaultPrevented, +} + /// Messages from the script to the constellation. #[derive(Deserialize, Serialize)] pub enum ScriptMsg { @@ -83,4 +93,23 @@ pub enum ScriptMsg { SetFinalUrl(PipelineId, Url), /// Check if an alert dialog box should be presented Alert(PipelineId, String, IpcSender<bool>), + /// Scroll a page in a window + ScrollFragmentPoint(PipelineId, LayerId, Point2D<f32>, bool), + /// Set title of current page + /// https://html.spec.whatwg.org/multipage/#document.title + SetTitle(PipelineId, Option<String>), + /// Send a key event + SendKeyEvent(Key, KeyState, KeyModifiers), + /// Get Window Informations size and position + GetClientWindow(IpcSender<(Size2D<u32>, Point2D<i32>)>), + /// Move the window to a point + MoveTo(Point2D<i32>), + /// Resize the window to size + ResizeTo(Size2D<u32>), + /// Script has handled a touch event, and either prevented or allowed default actions. + TouchEventProcessed(EventResult), + /// Get Scroll Offset + GetScrollOffset(PipelineId, LayerId, IpcSender<Point2D<f32>>), + /// Requests that the compositor shut down. + Exit, } |