mirror of
https://github.com/servo/servo.git
synced 2025-07-23 23:33:43 +01:00
Moved ScriptToCompositorMsg enum and EventResult enum to script_traits
Moved ScriptToCompositorMsg enum and EventResult enum to script_traits resolving issue #8835.
This commit is contained in:
parent
2a3a7a73b5
commit
2637d30c2a
8 changed files with 45 additions and 32 deletions
|
@ -30,12 +30,13 @@ mod script_msg;
|
|||
|
||||
use app_units::Au;
|
||||
use devtools_traits::ScriptToDevtoolsControlMsg;
|
||||
use euclid::Size2D;
|
||||
use euclid::length::Length;
|
||||
use euclid::point::Point2D;
|
||||
use euclid::rect::Rect;
|
||||
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
||||
use libc::c_void;
|
||||
use msg::compositor_msg::{Epoch, LayerId, ScriptToCompositorMsg};
|
||||
use msg::compositor_msg::{Epoch, LayerId};
|
||||
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId, WindowSizeData};
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, SubpageId};
|
||||
use msg::constellation_msg::{MouseButton, MouseEventType};
|
||||
|
@ -289,3 +290,34 @@ pub trait ScriptTaskFactory {
|
|||
fn clone_layout_channel(_phantom: Option<&mut Self>, pair: &OpaqueScriptLayoutChannel)
|
||||
-> Box<Any + Send>;
|
||||
}
|
||||
|
||||
/// Messages sent from the script thread to the compositor
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub enum ScriptToCompositorMsg {
|
||||
/// 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),
|
||||
/// Requests that the compositor shut down.
|
||||
Exit,
|
||||
}
|
||||
|
||||
/// 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,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue