mirror of
https://github.com/servo/servo.git
synced 2025-07-30 18:50:36 +01:00
Replace (String, Option<String>) with MozBrowserEvent in uses of MozBrowserEventMsg.
This commit is contained in:
parent
644dc40586
commit
cb9cfe2b22
7 changed files with 102 additions and 49 deletions
|
@ -20,7 +20,7 @@ use msg::constellation_msg::{self, ConstellationChan, Failure};
|
||||||
use msg::constellation_msg::{IFrameSandboxState, NavigationDirection};
|
use msg::constellation_msg::{IFrameSandboxState, NavigationDirection};
|
||||||
use msg::constellation_msg::{Key, KeyState, KeyModifiers, LoadData};
|
use msg::constellation_msg::{Key, KeyState, KeyModifiers, LoadData};
|
||||||
use msg::constellation_msg::{FrameId, PipelineExitType, PipelineId};
|
use msg::constellation_msg::{FrameId, PipelineExitType, PipelineId};
|
||||||
use msg::constellation_msg::{SubpageId, WindowSizeData};
|
use msg::constellation_msg::{SubpageId, WindowSizeData, MozBrowserEvent};
|
||||||
use msg::constellation_msg::Msg as ConstellationMsg;
|
use msg::constellation_msg::Msg as ConstellationMsg;
|
||||||
use net::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
|
use net::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
|
||||||
use net::resource_task::{self, ResourceTask};
|
use net::resource_task::{self, ResourceTask};
|
||||||
|
@ -364,15 +364,13 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
debug!("constellation got get-pipeline-title message");
|
debug!("constellation got get-pipeline-title message");
|
||||||
self.handle_get_pipeline_title_msg(pipeline_id);
|
self.handle_get_pipeline_title_msg(pipeline_id);
|
||||||
}
|
}
|
||||||
ConstellationMsg::MozBrowserEvent(pipeline_id,
|
ConstellationMsg::MozBrowserEventMsg(pipeline_id,
|
||||||
subpage_id,
|
subpage_id,
|
||||||
event_name,
|
event) => {
|
||||||
event_detail) => {
|
|
||||||
debug!("constellation got mozbrowser event message");
|
debug!("constellation got mozbrowser event message");
|
||||||
self.handle_mozbrowser_event_msg(pipeline_id,
|
self.handle_mozbrowser_event_msg(pipeline_id,
|
||||||
subpage_id,
|
subpage_id,
|
||||||
event_name,
|
event);
|
||||||
event_detail);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
|
@ -643,14 +641,13 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
fn handle_mozbrowser_event_msg(&mut self,
|
fn handle_mozbrowser_event_msg(&mut self,
|
||||||
containing_pipeline_id: PipelineId,
|
containing_pipeline_id: PipelineId,
|
||||||
subpage_id: SubpageId,
|
subpage_id: SubpageId,
|
||||||
event_name: String,
|
event: MozBrowserEvent) {
|
||||||
event_detail: Option<String>) {
|
|
||||||
assert!(opts::experimental_enabled());
|
assert!(opts::experimental_enabled());
|
||||||
|
|
||||||
// Find the script channel for the given parent pipeline,
|
// Find the script channel for the given parent pipeline,
|
||||||
// and pass the event to that script task.
|
// and pass the event to that script task.
|
||||||
let pipeline = self.pipeline(containing_pipeline_id);
|
let pipeline = self.pipeline(containing_pipeline_id);
|
||||||
pipeline.trigger_mozbrowser_event(subpage_id, event_name, event_detail);
|
pipeline.trigger_mozbrowser_event(subpage_id, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_or_replace_pipeline_in_frame_tree(&mut self, frame_change: FrameChange) {
|
fn add_or_replace_pipeline_in_frame_tree(&mut self, frame_change: FrameChange) {
|
||||||
|
@ -880,9 +877,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
// If this is an iframe, then send the event with new url
|
// If this is an iframe, then send the event with new url
|
||||||
if let Some((containing_pipeline_id, subpage_id, url)) = event_info {
|
if let Some((containing_pipeline_id, subpage_id, url)) = event_info {
|
||||||
let parent_pipeline = self.pipeline(containing_pipeline_id);
|
let parent_pipeline = self.pipeline(containing_pipeline_id);
|
||||||
parent_pipeline.trigger_mozbrowser_event(subpage_id,
|
parent_pipeline.trigger_mozbrowser_event(subpage_id, MozBrowserEvent::LocationChange(url));
|
||||||
"mozbrowserlocationchange".to_owned(),
|
|
||||||
Some(url));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ use gfx::paint_task::{PaintChan, PaintTask};
|
||||||
use gfx::font_cache_task::FontCacheTask;
|
use gfx::font_cache_task::FontCacheTask;
|
||||||
use layers::geometry::DevicePixel;
|
use layers::geometry::DevicePixel;
|
||||||
use msg::constellation_msg::{ConstellationChan, Failure, FrameId, PipelineId, SubpageId};
|
use msg::constellation_msg::{ConstellationChan, Failure, FrameId, PipelineId, SubpageId};
|
||||||
use msg::constellation_msg::{LoadData, WindowSizeData, PipelineExitType};
|
use msg::constellation_msg::{LoadData, WindowSizeData, PipelineExitType, MozBrowserEvent};
|
||||||
use net::image_cache_task::ImageCacheTask;
|
use net::image_cache_task::ImageCacheTask;
|
||||||
use net::resource_task::ResourceTask;
|
use net::resource_task::ResourceTask;
|
||||||
use net::storage_task::StorageTask;
|
use net::storage_task::StorageTask;
|
||||||
|
@ -248,15 +248,13 @@ impl Pipeline {
|
||||||
|
|
||||||
pub fn trigger_mozbrowser_event(&self,
|
pub fn trigger_mozbrowser_event(&self,
|
||||||
subpage_id: SubpageId,
|
subpage_id: SubpageId,
|
||||||
event_name: String,
|
event: MozBrowserEvent) {
|
||||||
event_detail: Option<String>) {
|
|
||||||
assert!(opts::experimental_enabled());
|
assert!(opts::experimental_enabled());
|
||||||
|
|
||||||
let ScriptControlChan(ref script_channel) = self.script_chan;
|
let ScriptControlChan(ref script_channel) = self.script_chan;
|
||||||
let event = ConstellationControlMsg::MozBrowserEvent(self.id,
|
let event = ConstellationControlMsg::MozBrowserEventMsg(self.id,
|
||||||
subpage_id,
|
subpage_id,
|
||||||
event_name,
|
event);
|
||||||
event_detail);
|
|
||||||
script_channel.send(event).unwrap();
|
script_channel.send(event).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,9 +213,73 @@ pub enum Msg {
|
||||||
/// Requests that the constellation inform the compositor of the a cursor change.
|
/// Requests that the constellation inform the compositor of the a cursor change.
|
||||||
SetCursor(Cursor),
|
SetCursor(Cursor),
|
||||||
/// Dispatch a mozbrowser event to a given iframe. Only available in experimental mode.
|
/// Dispatch a mozbrowser event to a given iframe. Only available in experimental mode.
|
||||||
MozBrowserEvent(PipelineId, SubpageId, String, Option<String>),
|
MozBrowserEventMsg(PipelineId, SubpageId, MozBrowserEvent),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/Using_the_Browser_API#Events
|
||||||
|
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,
|
||||||
|
/// 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,
|
||||||
|
/// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub fn detail(&self) -> Option<String> {
|
||||||
|
match *self {
|
||||||
|
MozBrowserEvent::AsyncScroll | MozBrowserEvent::Close | MozBrowserEvent::ContextMenu |
|
||||||
|
MozBrowserEvent::Error | MozBrowserEvent::IconChange | MozBrowserEvent::LoadEnd |
|
||||||
|
MozBrowserEvent::LoadStart | MozBrowserEvent::OpenWindow | MozBrowserEvent::SecurityChange |
|
||||||
|
MozBrowserEvent::ShowModalPrompt | MozBrowserEvent::UsernameAndPasswordRequired | MozBrowserEvent::OpenSearch => None,
|
||||||
|
MozBrowserEvent::LocationChange(ref new_location) => Some(new_location.clone()),
|
||||||
|
MozBrowserEvent::TitleChange(ref new_title) => Some(new_title.clone()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Similar to net::resource_task::LoadData
|
/// Similar to net::resource_task::LoadData
|
||||||
/// can be passed to LoadUrl to load a page with GET/POST
|
/// can be passed to LoadUrl to load a page with GET/POST
|
||||||
/// parameters or headers
|
/// parameters or headers
|
||||||
|
|
|
@ -61,7 +61,7 @@ use dom::window::{Window, WindowHelpers, ReflowReason};
|
||||||
use layout_interface::{HitTestResponse, MouseOverResponse};
|
use layout_interface::{HitTestResponse, MouseOverResponse};
|
||||||
use msg::compositor_msg::ScriptListener;
|
use msg::compositor_msg::ScriptListener;
|
||||||
use msg::constellation_msg::Msg as ConstellationMsg;
|
use msg::constellation_msg::Msg as ConstellationMsg;
|
||||||
use msg::constellation_msg::{ConstellationChan, Key, KeyState, KeyModifiers};
|
use msg::constellation_msg::{ConstellationChan, Key, KeyState, KeyModifiers, MozBrowserEvent};
|
||||||
use msg::constellation_msg::{SUPER, ALT, SHIFT, CONTROL};
|
use msg::constellation_msg::{SUPER, ALT, SHIFT, CONTROL};
|
||||||
use net::resource_task::ControlMsg::{SetCookiesForUrl, GetCookiesForUrl};
|
use net::resource_task::ControlMsg::{SetCookiesForUrl, GetCookiesForUrl};
|
||||||
use net::cookie_storage::CookieSource::NonHTTP;
|
use net::cookie_storage::CookieSource::NonHTTP;
|
||||||
|
@ -223,7 +223,7 @@ pub trait DocumentHelpers<'a> {
|
||||||
fn handle_mouse_move_event(self, js_runtime: *mut JSRuntime, point: Point2D<f32>,
|
fn handle_mouse_move_event(self, js_runtime: *mut JSRuntime, point: Point2D<f32>,
|
||||||
prev_mouse_over_targets: &mut Vec<JS<Node>>) -> bool;
|
prev_mouse_over_targets: &mut Vec<JS<Node>>) -> bool;
|
||||||
fn set_current_script(self, script: Option<JSRef<HTMLScriptElement>>);
|
fn set_current_script(self, script: Option<JSRef<HTMLScriptElement>>);
|
||||||
fn trigger_mozbrowser_event(self, event_name: String, event_detail: Option<String>);
|
fn trigger_mozbrowser_event(self, event: MozBrowserEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
|
impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
|
||||||
|
@ -458,7 +458,7 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
|
||||||
/// Handles any updates when the document's title has changed.
|
/// Handles any updates when the document's title has changed.
|
||||||
fn title_changed(self) {
|
fn title_changed(self) {
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsertitlechange
|
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsertitlechange
|
||||||
self.trigger_mozbrowser_event("mozbrowsertitlechange".to_owned(), Some(self.Title()));
|
self.trigger_mozbrowser_event(MozBrowserEvent::TitleChange(self.Title()));
|
||||||
|
|
||||||
self.send_title_to_compositor();
|
self.send_title_to_compositor();
|
||||||
}
|
}
|
||||||
|
@ -683,16 +683,15 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
|
||||||
self.current_script.assign(script);
|
self.current_script.assign(script);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn trigger_mozbrowser_event(self, event_name: String, event_detail: Option<String>) {
|
fn trigger_mozbrowser_event(self, event: MozBrowserEvent) {
|
||||||
if opts::experimental_enabled() {
|
if opts::experimental_enabled() {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
|
|
||||||
if let Some((containing_pipeline_id, subpage_id)) = window.r().parent_info() {
|
if let Some((containing_pipeline_id, subpage_id)) = window.r().parent_info() {
|
||||||
let ConstellationChan(ref chan) = window.r().constellation_chan();
|
let ConstellationChan(ref chan) = window.r().constellation_chan();
|
||||||
let event = ConstellationMsg::MozBrowserEvent(containing_pipeline_id,
|
let event = ConstellationMsg::MozBrowserEventMsg(containing_pipeline_id,
|
||||||
subpage_id,
|
subpage_id,
|
||||||
event_name,
|
event);
|
||||||
event_detail);
|
|
||||||
chan.send(event).unwrap();
|
chan.send(event).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1464,7 +1463,7 @@ impl DocumentProgressHandler {
|
||||||
});
|
});
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadend
|
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadend
|
||||||
document.r().trigger_mozbrowser_event("mozbrowserloadend".to_owned(), None);
|
document.r().trigger_mozbrowser_event(MozBrowserEvent::LoadEnd);
|
||||||
|
|
||||||
window_ref.reflow(ReflowGoal::ForDisplay,
|
window_ref.reflow(ReflowGoal::ForDisplay,
|
||||||
ReflowQueryType::NoQuery,
|
ReflowQueryType::NoQuery,
|
||||||
|
|
|
@ -29,7 +29,7 @@ use dom::virtualmethods::VirtualMethods;
|
||||||
use dom::window::{Window, WindowHelpers};
|
use dom::window::{Window, WindowHelpers};
|
||||||
use page::IterablePage;
|
use page::IterablePage;
|
||||||
|
|
||||||
use msg::constellation_msg::{PipelineId, SubpageId, ConstellationChan, NavigationDirection};
|
use msg::constellation_msg::{PipelineId, SubpageId, ConstellationChan, MozBrowserEvent, NavigationDirection};
|
||||||
use msg::constellation_msg::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
|
use msg::constellation_msg::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
|
||||||
use msg::constellation_msg::Msg as ConstellationMsg;
|
use msg::constellation_msg::Msg as ConstellationMsg;
|
||||||
use util::opts;
|
use util::opts;
|
||||||
|
@ -72,7 +72,7 @@ pub trait HTMLIFrameElementHelpers {
|
||||||
fn process_the_iframe_attributes(self);
|
fn process_the_iframe_attributes(self);
|
||||||
fn generate_new_subpage_id(self) -> (SubpageId, Option<SubpageId>);
|
fn generate_new_subpage_id(self) -> (SubpageId, Option<SubpageId>);
|
||||||
fn navigate_child_browsing_context(self, url: Url);
|
fn navigate_child_browsing_context(self, url: Url);
|
||||||
fn dispatch_mozbrowser_event(self, event_name: String, event_detail: Option<String>);
|
fn dispatch_mozbrowser_event(self, event: MozBrowserEvent);
|
||||||
fn update_subpage_id(self, new_subpage_id: SubpageId);
|
fn update_subpage_id(self, new_subpage_id: SubpageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ impl<'a> HTMLIFrameElementHelpers for JSRef<'a, HTMLIFrameElement> {
|
||||||
|
|
||||||
if opts::experimental_enabled() {
|
if opts::experimental_enabled() {
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadstart
|
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadstart
|
||||||
self.dispatch_mozbrowser_event("mozbrowserloadstart".to_owned(), None);
|
self.dispatch_mozbrowser_event(MozBrowserEvent::LoadStart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ impl<'a> HTMLIFrameElementHelpers for JSRef<'a, HTMLIFrameElement> {
|
||||||
self.navigate_child_browsing_context(url);
|
self.navigate_child_browsing_context(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dispatch_mozbrowser_event(self, event_name: String, event_detail: Option<String>) {
|
fn dispatch_mozbrowser_event(self, event: MozBrowserEvent) {
|
||||||
// TODO(gw): Support mozbrowser event types that have detail which is not a string.
|
// TODO(gw): Support mozbrowser event types that have detail which is not a string.
|
||||||
// See https://developer.mozilla.org/en-US/docs/Web/API/Using_the_Browser_API
|
// See https://developer.mozilla.org/en-US/docs/Web/API/Using_the_Browser_API
|
||||||
// for a list of mozbrowser events.
|
// for a list of mozbrowser events.
|
||||||
|
@ -148,10 +148,10 @@ impl<'a> HTMLIFrameElementHelpers for JSRef<'a, HTMLIFrameElement> {
|
||||||
let window = window_from_node(self).root();
|
let window = window_from_node(self).root();
|
||||||
let cx = window.r().get_cx();
|
let cx = window.r().get_cx();
|
||||||
let custom_event = CustomEvent::new(GlobalRef::Window(window.r()),
|
let custom_event = CustomEvent::new(GlobalRef::Window(window.r()),
|
||||||
event_name.to_owned(),
|
event.name().to_owned(),
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
event_detail.to_jsval(cx)).root();
|
event.detail().to_jsval(cx)).root();
|
||||||
let target: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
let target: JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
let event: JSRef<Event> = EventCast::from_ref(custom_event.r());
|
let event: JSRef<Event> = EventCast::from_ref(custom_event.r());
|
||||||
event.fire(target);
|
event.fire(target);
|
||||||
|
|
|
@ -57,8 +57,8 @@ use script_traits::ScriptTaskFactory;
|
||||||
use msg::compositor_msg::ReadyState::{FinishedLoading, Loading, PerformingLayout};
|
use msg::compositor_msg::ReadyState::{FinishedLoading, Loading, PerformingLayout};
|
||||||
use msg::compositor_msg::{LayerId, ScriptListener};
|
use msg::compositor_msg::{LayerId, ScriptListener};
|
||||||
use msg::constellation_msg::{ConstellationChan};
|
use msg::constellation_msg::{ConstellationChan};
|
||||||
use msg::constellation_msg::{LoadData, PipelineId, SubpageId};
|
use msg::constellation_msg::{LoadData, PipelineId, SubpageId, MozBrowserEvent};
|
||||||
use msg::constellation_msg::{Failure, Msg, WindowSizeData, PipelineExitType};
|
use msg::constellation_msg::{Failure, WindowSizeData, PipelineExitType};
|
||||||
use msg::constellation_msg::Msg as ConstellationMsg;
|
use msg::constellation_msg::Msg as ConstellationMsg;
|
||||||
use net::image_cache_task::ImageCacheTask;
|
use net::image_cache_task::ImageCacheTask;
|
||||||
use net::resource_task::{ResourceTask, ControlMsg, LoadResponse};
|
use net::resource_task::{ResourceTask, ControlMsg, LoadResponse};
|
||||||
|
@ -644,14 +644,12 @@ impl ScriptTask {
|
||||||
self.handle_freeze_msg(pipeline_id),
|
self.handle_freeze_msg(pipeline_id),
|
||||||
ConstellationControlMsg::Thaw(pipeline_id) =>
|
ConstellationControlMsg::Thaw(pipeline_id) =>
|
||||||
self.handle_thaw_msg(pipeline_id),
|
self.handle_thaw_msg(pipeline_id),
|
||||||
ConstellationControlMsg::MozBrowserEvent(parent_pipeline_id,
|
ConstellationControlMsg::MozBrowserEventMsg(parent_pipeline_id,
|
||||||
subpage_id,
|
subpage_id,
|
||||||
event_name,
|
event) =>
|
||||||
event_detail) =>
|
|
||||||
self.handle_mozbrowser_event_msg(parent_pipeline_id,
|
self.handle_mozbrowser_event_msg(parent_pipeline_id,
|
||||||
subpage_id,
|
subpage_id,
|
||||||
event_name,
|
event),
|
||||||
event_detail),
|
|
||||||
ConstellationControlMsg::UpdateSubpageId(containing_pipeline_id,
|
ConstellationControlMsg::UpdateSubpageId(containing_pipeline_id,
|
||||||
old_subpage_id,
|
old_subpage_id,
|
||||||
new_subpage_id) =>
|
new_subpage_id) =>
|
||||||
|
@ -802,8 +800,7 @@ impl ScriptTask {
|
||||||
fn handle_mozbrowser_event_msg(&self,
|
fn handle_mozbrowser_event_msg(&self,
|
||||||
parent_pipeline_id: PipelineId,
|
parent_pipeline_id: PipelineId,
|
||||||
subpage_id: SubpageId,
|
subpage_id: SubpageId,
|
||||||
event_name: String,
|
event: MozBrowserEvent) {
|
||||||
event_detail: Option<String>) {
|
|
||||||
let borrowed_page = self.root_page();
|
let borrowed_page = self.root_page();
|
||||||
|
|
||||||
let frame_element = borrowed_page.find(parent_pipeline_id).and_then(|page| {
|
let frame_element = borrowed_page.find(parent_pipeline_id).and_then(|page| {
|
||||||
|
@ -817,7 +814,7 @@ impl ScriptTask {
|
||||||
}).root();
|
}).root();
|
||||||
|
|
||||||
if let Some(frame_element) = frame_element {
|
if let Some(frame_element) = frame_element {
|
||||||
frame_element.r().dispatch_mozbrowser_event(event_name, event_detail);
|
frame_element.r().dispatch_mozbrowser_event(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ use devtools_traits::DevtoolsControlChan;
|
||||||
use libc::c_void;
|
use libc::c_void;
|
||||||
use msg::constellation_msg::{ConstellationChan, PipelineId, Failure, WindowSizeData};
|
use msg::constellation_msg::{ConstellationChan, PipelineId, Failure, WindowSizeData};
|
||||||
use msg::constellation_msg::{LoadData, SubpageId, Key, KeyState, KeyModifiers};
|
use msg::constellation_msg::{LoadData, SubpageId, Key, KeyState, KeyModifiers};
|
||||||
use msg::constellation_msg::PipelineExitType;
|
use msg::constellation_msg::{MozBrowserEvent, PipelineExitType};
|
||||||
use msg::compositor_msg::ScriptListener;
|
use msg::compositor_msg::ScriptListener;
|
||||||
use net::image_cache_task::ImageCacheTask;
|
use net::image_cache_task::ImageCacheTask;
|
||||||
use net::resource_task::ResourceTask;
|
use net::resource_task::ResourceTask;
|
||||||
|
@ -73,7 +73,7 @@ pub enum ConstellationControlMsg {
|
||||||
/// Notifies script task that a url should be loaded in this iframe.
|
/// Notifies script task that a url should be loaded in this iframe.
|
||||||
Navigate(PipelineId, SubpageId, LoadData),
|
Navigate(PipelineId, SubpageId, LoadData),
|
||||||
/// Requests the script task forward a mozbrowser event to an iframe it owns
|
/// Requests the script task forward a mozbrowser event to an iframe it owns
|
||||||
MozBrowserEvent(PipelineId, SubpageId, String, Option<String>),
|
MozBrowserEventMsg(PipelineId, SubpageId, MozBrowserEvent),
|
||||||
/// Updates the current subpage id of a given iframe
|
/// Updates the current subpage id of a given iframe
|
||||||
UpdateSubpageId(PipelineId, SubpageId, SubpageId),
|
UpdateSubpageId(PipelineId, SubpageId, SubpageId),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue