зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #9271 - Move `MozBrowserEvent` to `script_traits` (from apopiak:moveMozBrowserEvent_9225); r=KiChjang
close #9225 Source-Repo: https://github.com/servo/servo Source-Revision: 897007f13447f6b34e220042e5cfd31f7686cfec
This commit is contained in:
Родитель
643caf9158
Коммит
cb076cb7bf
|
@ -30,8 +30,7 @@ use msg::constellation_msg::AnimationState;
|
|||
use msg::constellation_msg::WebDriverCommandMsg;
|
||||
use msg::constellation_msg::{FrameId, PipelineId};
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
|
||||
use msg::constellation_msg::{MozBrowserEvent, NavigationDirection};
|
||||
use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId};
|
||||
use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, NavigationDirection};
|
||||
use msg::constellation_msg::{SubpageId, WindowSizeData};
|
||||
use msg::constellation_msg::{self, ConstellationChan, Failure};
|
||||
use msg::webdriver_msg;
|
||||
|
@ -44,9 +43,8 @@ use profile_traits::mem;
|
|||
use profile_traits::time;
|
||||
use sandboxing;
|
||||
use script_traits::{CompositorEvent, ConstellationControlMsg, DocumentState, LayoutControlMsg};
|
||||
use script_traits::{IFrameLoadInfo, IFrameSandboxState};
|
||||
use script_traits::{IFrameLoadInfo, IFrameSandboxState, MozBrowserEvent, TimerEventRequest};
|
||||
use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, ScriptThreadFactory};
|
||||
use script_traits::{TimerEventRequest};
|
||||
use std::borrow::ToOwned;
|
||||
use std::collections::HashMap;
|
||||
use std::env;
|
||||
|
|
|
@ -16,14 +16,14 @@ use ipc_channel::router::ROUTER;
|
|||
use layers::geometry::DevicePixel;
|
||||
use layout_traits::{LayoutControlChan, LayoutThreadFactory};
|
||||
use msg::constellation_msg::{ConstellationChan, Failure, FrameId, PipelineId, SubpageId};
|
||||
use msg::constellation_msg::{LoadData, MozBrowserEvent, WindowSizeData};
|
||||
use msg::constellation_msg::{LoadData, WindowSizeData};
|
||||
use msg::constellation_msg::{PipelineNamespaceId};
|
||||
use net_traits::ResourceThread;
|
||||
use net_traits::image_cache_thread::ImageCacheThread;
|
||||
use net_traits::storage_thread::StorageThread;
|
||||
use profile_traits::mem as profile_mem;
|
||||
use profile_traits::time;
|
||||
use script_traits::{ConstellationControlMsg, InitialScriptState};
|
||||
use script_traits::{ConstellationControlMsg, InitialScriptState, MozBrowserEvent};
|
||||
use script_traits::{LayoutControlMsg, LayoutMsg, NewLayoutInfo, ScriptMsg};
|
||||
use script_traits::{ScriptToCompositorMsg, ScriptThreadFactory, TimerEventRequest};
|
||||
use std::mem;
|
||||
|
|
|
@ -219,61 +219,6 @@ pub enum AnimationState {
|
|||
NoAnimationCallbacksPresent,
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Using_the_Browser_API#Events
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub enum MozBrowserEvent {
|
||||
/// Sent when the scroll position within a browser `<iframe>` changes.
|
||||
AsyncScroll,
|
||||
/// Sent when window.close() is called within a browser `<iframe>`.
|
||||
Close,
|
||||
/// Sent when a browser `<iframe>` tries to open a context menu. This allows
|
||||
/// handling `<menuitem>` element available within the browser `<iframe>`'s content.
|
||||
ContextMenu,
|
||||
/// Sent when an error occurred while trying to load content within a browser `<iframe>`.
|
||||
Error,
|
||||
/// Sent when the favicon of a browser `<iframe>` changes.
|
||||
IconChange(String, String, String),
|
||||
/// Sent when the browser `<iframe>` has finished loading all its assets.
|
||||
LoadEnd,
|
||||
/// Sent when the browser `<iframe>` starts to load a new page.
|
||||
LoadStart,
|
||||
/// Sent when a browser `<iframe>`'s location changes.
|
||||
LocationChange(String),
|
||||
/// Sent when window.open() is called within a browser `<iframe>`.
|
||||
OpenWindow,
|
||||
/// Sent when the SSL state changes within a browser `<iframe>`.
|
||||
SecurityChange,
|
||||
/// Sent when alert(), confirm(), or prompt() is called within a browser `<iframe>`.
|
||||
ShowModalPrompt(String, String, String, String), // TODO(simartin): Handle unblock()
|
||||
/// Sent when the document.title changes within a browser `<iframe>`.
|
||||
TitleChange(String),
|
||||
/// Sent when an HTTP authentification is requested.
|
||||
UsernameAndPasswordRequired,
|
||||
/// Sent when a link to a search engine is found.
|
||||
OpenSearch,
|
||||
}
|
||||
|
||||
impl MozBrowserEvent {
|
||||
pub fn name(&self) -> &'static str {
|
||||
match *self {
|
||||
MozBrowserEvent::AsyncScroll => "mozbrowserasyncscroll",
|
||||
MozBrowserEvent::Close => "mozbrowserclose",
|
||||
MozBrowserEvent::ContextMenu => "mozbrowsercontextmenu",
|
||||
MozBrowserEvent::Error => "mozbrowsererror",
|
||||
MozBrowserEvent::IconChange(_, _, _) => "mozbrowsericonchange",
|
||||
MozBrowserEvent::LoadEnd => "mozbrowserloadend",
|
||||
MozBrowserEvent::LoadStart => "mozbrowserloadstart",
|
||||
MozBrowserEvent::LocationChange(_) => "mozbrowserlocationchange",
|
||||
MozBrowserEvent::OpenWindow => "mozbrowseropenwindow",
|
||||
MozBrowserEvent::SecurityChange => "mozbrowsersecuritychange",
|
||||
MozBrowserEvent::ShowModalPrompt(_, _, _, _) => "mozbrowsershowmodalprompt",
|
||||
MozBrowserEvent::TitleChange(_) => "mozbrowsertitlechange",
|
||||
MozBrowserEvent::UsernameAndPasswordRequired => "mozbrowserusernameandpasswordrequired",
|
||||
MozBrowserEvent::OpenSearch => "mozbrowseropensearch"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub enum WebDriverCommandMsg {
|
||||
LoadUrl(PipelineId, LoadData, IpcSender<LoadStatus>),
|
||||
|
|
|
@ -83,13 +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, MozBrowserEvent, SubpageId};
|
||||
use msg::constellation_msg::{MouseButton, 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::{MouseEventType, MozBrowserEvent};
|
||||
use script_traits::{ScriptMsg as ConstellationMsg, ScriptToCompositorMsg};
|
||||
use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress};
|
||||
use std::ascii::AsciiExt;
|
||||
|
|
|
@ -26,12 +26,11 @@ use dom::virtualmethods::VirtualMethods;
|
|||
use dom::window::Window;
|
||||
use js::jsapi::{JSAutoCompartment, JSAutoRequest, RootedValue, JSContext, MutableHandleValue};
|
||||
use js::jsval::{UndefinedValue, NullValue};
|
||||
use msg::constellation_msg::{ConstellationChan, MozBrowserEvent};
|
||||
use msg::constellation_msg::{ConstellationChan};
|
||||
use msg::constellation_msg::{NavigationDirection, PipelineId, SubpageId};
|
||||
use page::IterablePage;
|
||||
use script_traits::IFrameLoadInfo;
|
||||
use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
|
||||
use script_traits::ScriptMsg as ConstellationMsg;
|
||||
use script_traits::{IFrameLoadInfo, MozBrowserEvent, ScriptMsg as ConstellationMsg};
|
||||
use std::ascii::AsciiExt;
|
||||
use std::cell::Cell;
|
||||
use string_cache::Atom;
|
||||
|
|
|
@ -24,10 +24,10 @@ use encoding::all::UTF_8;
|
|||
use ipc_channel::ipc;
|
||||
use ipc_channel::router::ROUTER;
|
||||
use layout_interface::{LayoutChan, Msg};
|
||||
use msg::constellation_msg::{ConstellationChan, MozBrowserEvent};
|
||||
use msg::constellation_msg::ConstellationChan;
|
||||
use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata};
|
||||
use network_listener::{NetworkListener, PreInvoke};
|
||||
use script_traits::ScriptMsg as ConstellationMsg;
|
||||
use script_traits::{MozBrowserEvent, ScriptMsg as ConstellationMsg};
|
||||
use std::ascii::AsciiExt;
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::Cell;
|
||||
|
|
|
@ -43,8 +43,7 @@ use js::rust::Runtime;
|
|||
use layout_interface::{ContentBoxResponse, ContentBoxesResponse, ResolvedStyleResponse, ScriptReflow};
|
||||
use layout_interface::{LayoutChan, LayoutRPC, Msg, Reflow, ReflowQueryType};
|
||||
use libc;
|
||||
use msg::constellation_msg::{ConstellationChan, LoadData};
|
||||
use msg::constellation_msg::{MozBrowserEvent, PipelineId, SubpageId, WindowSizeData};
|
||||
use msg::constellation_msg::{ConstellationChan, LoadData, PipelineId, SubpageId, WindowSizeData};
|
||||
use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
|
||||
use net_traits::ResourceThread;
|
||||
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread};
|
||||
|
@ -57,9 +56,8 @@ use rustc_serialize::base64::{FromBase64, STANDARD, ToBase64};
|
|||
use script_thread::{DOMManipulationThreadSource, UserInteractionThreadSource, NetworkingThreadSource};
|
||||
use script_thread::{HistoryTraversalThreadSource, FileReadingThreadSource, SendableMainThreadScriptChan};
|
||||
use script_thread::{ScriptChan, ScriptPort, MainThreadScriptChan, MainThreadScriptMsg, RunnableWrapper};
|
||||
use script_traits::ScriptMsg as ConstellationMsg;
|
||||
use script_traits::{DocumentState, MsDuration, ScriptToCompositorMsg, TimerEvent, TimerEventId};
|
||||
use script_traits::{TimerEventRequest, TimerSource};
|
||||
use script_traits::{MozBrowserEvent, ScriptMsg as ConstellationMsg, TimerEventRequest, TimerSource};
|
||||
use selectors::parser::PseudoElement;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::borrow::ToOwned;
|
||||
|
|
|
@ -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, MozBrowserEvent, PipelineId};
|
||||
use msg::constellation_msg::{MouseButton, PipelineId};
|
||||
use msg::constellation_msg::{PipelineNamespace};
|
||||
use msg::constellation_msg::{SubpageId, WindowSizeData};
|
||||
use msg::webdriver_msg::WebDriverScriptCommand;
|
||||
|
@ -81,7 +81,7 @@ 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};
|
||||
use script_traits::{InitialScriptState, MouseEventType, NewLayoutInfo};
|
||||
use script_traits::{InitialScriptState, MouseEventType, MozBrowserEvent, NewLayoutInfo};
|
||||
use script_traits::{LayoutMsg, OpaqueScriptLayoutChannel, ScriptMsg as ConstellationMsg};
|
||||
use script_traits::{ScriptThreadFactory, ScriptToCompositorMsg, TimerEvent, TimerEventRequest, TimerSource};
|
||||
use script_traits::{TouchEventType, TouchId};
|
||||
|
|
|
@ -41,7 +41,7 @@ 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, MouseButton};
|
||||
use msg::constellation_msg::{MozBrowserEvent, PipelineNamespaceId, SubpageId};
|
||||
use msg::constellation_msg::{PipelineNamespaceId, SubpageId};
|
||||
use msg::webdriver_msg::WebDriverScriptCommand;
|
||||
use net_traits::ResourceThread;
|
||||
use net_traits::image_cache_thread::ImageCacheThread;
|
||||
|
@ -371,3 +371,60 @@ pub struct IFrameLoadInfo {
|
|||
/// Sandbox type of this iframe
|
||||
pub sandbox: IFrameSandboxState,
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Using_the_Browser_API#Events
|
||||
/// The events fired in a Browser API context (`<iframe mozbrowser>`)
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub enum MozBrowserEvent {
|
||||
/// Sent when the scroll position within a browser `<iframe>` changes.
|
||||
AsyncScroll,
|
||||
/// Sent when window.close() is called within a browser `<iframe>`.
|
||||
Close,
|
||||
/// Sent when a browser `<iframe>` tries to open a context menu. This allows
|
||||
/// handling `<menuitem>` element available within the browser `<iframe>`'s content.
|
||||
ContextMenu,
|
||||
/// Sent when an error occurred while trying to load content within a browser `<iframe>`.
|
||||
Error,
|
||||
/// Sent when the favicon of a browser `<iframe>` changes.
|
||||
IconChange(String, String, String),
|
||||
/// Sent when the browser `<iframe>` has finished loading all its assets.
|
||||
LoadEnd,
|
||||
/// Sent when the browser `<iframe>` starts to load a new page.
|
||||
LoadStart,
|
||||
/// Sent when a browser `<iframe>`'s location changes.
|
||||
LocationChange(String),
|
||||
/// Sent when window.open() is called within a browser `<iframe>`.
|
||||
OpenWindow,
|
||||
/// Sent when the SSL state changes within a browser `<iframe>`.
|
||||
SecurityChange,
|
||||
/// Sent when alert(), confirm(), or prompt() is called within a browser `<iframe>`.
|
||||
ShowModalPrompt(String, String, String, String), // TODO(simartin): Handle unblock()
|
||||
/// Sent when the document.title changes within a browser `<iframe>`.
|
||||
TitleChange(String),
|
||||
/// Sent when an HTTP authentification is requested.
|
||||
UsernameAndPasswordRequired,
|
||||
/// Sent when a link to a search engine is found.
|
||||
OpenSearch,
|
||||
}
|
||||
|
||||
impl MozBrowserEvent {
|
||||
/// Get the name of the event as a `& str`
|
||||
pub fn name(&self) -> &'static str {
|
||||
match *self {
|
||||
MozBrowserEvent::AsyncScroll => "mozbrowserasyncscroll",
|
||||
MozBrowserEvent::Close => "mozbrowserclose",
|
||||
MozBrowserEvent::ContextMenu => "mozbrowsercontextmenu",
|
||||
MozBrowserEvent::Error => "mozbrowsererror",
|
||||
MozBrowserEvent::IconChange(_, _, _) => "mozbrowsericonchange",
|
||||
MozBrowserEvent::LoadEnd => "mozbrowserloadend",
|
||||
MozBrowserEvent::LoadStart => "mozbrowserloadstart",
|
||||
MozBrowserEvent::LocationChange(_) => "mozbrowserlocationchange",
|
||||
MozBrowserEvent::OpenWindow => "mozbrowseropenwindow",
|
||||
MozBrowserEvent::SecurityChange => "mozbrowsersecuritychange",
|
||||
MozBrowserEvent::ShowModalPrompt(_, _, _, _) => "mozbrowsershowmodalprompt",
|
||||
MozBrowserEvent::TitleChange(_) => "mozbrowsertitlechange",
|
||||
MozBrowserEvent::UsernameAndPasswordRequired => "mozbrowserusernameandpasswordrequired",
|
||||
MozBrowserEvent::OpenSearch => "mozbrowseropensearch"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
use DocumentState;
|
||||
use IFrameLoadInfo;
|
||||
use MouseEventType;
|
||||
use MozBrowserEvent;
|
||||
use canvas_traits::CanvasMsg;
|
||||
use euclid::point::Point2D;
|
||||
use euclid::size::Size2D;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::{AnimationState, NavigationDirection};
|
||||
use msg::constellation_msg::{Failure, MozBrowserEvent, PipelineId};
|
||||
use msg::constellation_msg::{AnimationState, NavigationDirection, Failure, PipelineId};
|
||||
use msg::constellation_msg::{LoadData, MouseButton, SubpageId};
|
||||
use offscreen_gl_context::GLContextAttributes;
|
||||
use style_traits::viewport::ViewportConstraints;
|
||||
|
|
Загрузка…
Ссылка в новой задаче