Experimental implementation of (a small subset of) mozbrowser APIs.

This commit is contained in:
Glenn Watson 2015-03-19 15:40:04 +10:00
parent fef439726a
commit bf9b8f7050
10 changed files with 393 additions and 40 deletions

View file

@ -379,6 +379,16 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
debug!("constellation got get-pipeline-title message");
self.handle_get_pipeline_title_msg(pipeline_id);
}
ConstellationMsg::MozBrowserEvent(pipeline_id,
subpage_id,
event_name,
event_detail) => {
debug!("constellation got mozbrowser event message");
self.handle_mozbrowser_event_msg(pipeline_id,
subpage_id,
event_name,
event_detail);
}
}
true
}
@ -640,6 +650,24 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
}
}
fn handle_mozbrowser_event_msg(&mut self,
pipeline_id: PipelineId,
subpage_id: SubpageId,
event_name: String,
event_detail: Option<String>) {
assert!(opts::experimental_enabled());
// Find the script channel for the given parent pipeline,
// and pass the event to that script task.
let pipeline = self.pipeline(pipeline_id);
let ScriptControlChan(ref script_channel) = pipeline.script_chan;
let event = ConstellationControlMsg::MozBrowserEvent(pipeline_id,
subpage_id,
event_name,
event_detail);
script_channel.send(event).unwrap();
}
fn add_or_replace_pipeline_in_frame_tree(&mut self, frame_change: FrameChange) {
let evicted_frames = match frame_change.old_pipeline_id {
Some(old_pipeline_id) => {

View file

@ -84,6 +84,7 @@ impl Pipeline {
let (script_chan, script_port) = channel();
ScriptTaskFactory::create(None::<&mut STF>,
id,
parent_info,
compositor_proxy.clone_compositor_proxy(),
&layout_pair,
ScriptControlChan(script_chan.clone()),