mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Consistently use parent_pipeline_id
Instead of containing_pipeline_id, use parent_pipeline_id because it is more clear that it refers to the immediate parent.
This commit is contained in:
parent
9d097e7d15
commit
b9b25b6f82
6 changed files with 56 additions and 56 deletions
|
@ -825,7 +825,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
}
|
||||
FromScriptMsg::ScriptLoadedURLInIFrame(load_info) => {
|
||||
debug!("constellation got iframe URL load message {:?} {:?} {:?}",
|
||||
load_info.containing_pipeline_id,
|
||||
load_info.parent_pipeline_id,
|
||||
load_info.old_subpage_id,
|
||||
load_info.new_subpage_id);
|
||||
self.handle_script_loaded_url_in_iframe_msg(load_info);
|
||||
|
@ -1227,20 +1227,20 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
|
||||
// The script thread associated with pipeline_id has loaded a URL in an iframe via script. This
|
||||
// will result in a new pipeline being spawned and a frame tree being added to
|
||||
// containing_page_pipeline_id's frame tree's children. This message is never the result of a
|
||||
// parent_pipeline_id's frame tree's children. This message is never the result of a
|
||||
// page navigation.
|
||||
fn handle_script_loaded_url_in_iframe_msg(&mut self, load_info: IFrameLoadInfo) {
|
||||
let old_pipeline_id = load_info.old_subpage_id
|
||||
.and_then(|old_subpage_id| self.subpage_map.get(&(load_info.containing_pipeline_id, old_subpage_id)))
|
||||
.and_then(|old_subpage_id| self.subpage_map.get(&(load_info.parent_pipeline_id, old_subpage_id)))
|
||||
.cloned();
|
||||
|
||||
let (load_data, script_chan, window_size, is_private) = {
|
||||
let old_pipeline = old_pipeline_id
|
||||
.and_then(|old_pipeline_id| self.pipelines.get(&old_pipeline_id));
|
||||
|
||||
let source_pipeline = match self.pipelines.get(&load_info.containing_pipeline_id) {
|
||||
let source_pipeline = match self.pipelines.get(&load_info.parent_pipeline_id) {
|
||||
Some(source_pipeline) => source_pipeline,
|
||||
None => return warn!("Script loaded url in closed iframe {}.", load_info.containing_pipeline_id),
|
||||
None => return warn!("Script loaded url in closed iframe {}.", load_info.parent_pipeline_id),
|
||||
};
|
||||
|
||||
// If no url is specified, reload.
|
||||
|
@ -1290,13 +1290,13 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
|
||||
// Create the new pipeline, attached to the parent and push to pending frames
|
||||
self.new_pipeline(load_info.new_pipeline_id,
|
||||
Some((load_info.containing_pipeline_id, load_info.new_subpage_id, load_info.frame_type)),
|
||||
Some((load_info.parent_pipeline_id, load_info.new_subpage_id, load_info.frame_type)),
|
||||
window_size,
|
||||
script_chan,
|
||||
load_data,
|
||||
is_private);
|
||||
|
||||
self.subpage_map.insert((load_info.containing_pipeline_id, load_info.new_subpage_id),
|
||||
self.subpage_map.insert((load_info.parent_pipeline_id, load_info.new_subpage_id),
|
||||
load_info.new_pipeline_id);
|
||||
|
||||
self.push_pending_frame(load_info.new_pipeline_id, old_pipeline_id);
|
||||
|
@ -1585,7 +1585,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
}
|
||||
|
||||
fn handle_mozbrowser_event_msg(&mut self,
|
||||
containing_pipeline_id: PipelineId,
|
||||
parent_pipeline_id: PipelineId,
|
||||
subpage_id: Option<SubpageId>,
|
||||
event: MozBrowserEvent) {
|
||||
assert!(PREFS.is_mozbrowser_enabled());
|
||||
|
@ -1594,9 +1594,9 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
// and pass the event to that script thread.
|
||||
// If the pipeline lookup fails, it is because we have torn down the pipeline,
|
||||
// so it is reasonable to silently ignore the event.
|
||||
match self.pipelines.get(&containing_pipeline_id) {
|
||||
match self.pipelines.get(&parent_pipeline_id) {
|
||||
Some(pipeline) => pipeline.trigger_mozbrowser_event(subpage_id, event),
|
||||
None => warn!("Pipeline {:?} handling mozbrowser event after closure.", containing_pipeline_id),
|
||||
None => warn!("Pipeline {:?} handling mozbrowser event after closure.", parent_pipeline_id),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1630,22 +1630,22 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
Some(pipeline) => pipeline.parent_info,
|
||||
None => return warn!("Pipeline {:?} focus parent after closure.", pipeline_id),
|
||||
};
|
||||
let (containing_pipeline_id, subpage_id, _) = match parent_info {
|
||||
let (parent_pipeline_id, subpage_id, _) = match parent_info {
|
||||
Some(info) => info,
|
||||
None => return debug!("Pipeline {:?} focus has no parent.", pipeline_id),
|
||||
};
|
||||
|
||||
// Send a message to the parent of the provided pipeline (if it exists)
|
||||
// telling it to mark the iframe element as focused.
|
||||
let msg = ConstellationControlMsg::FocusIFrame(containing_pipeline_id, subpage_id);
|
||||
let result = match self.pipelines.get(&containing_pipeline_id) {
|
||||
let msg = ConstellationControlMsg::FocusIFrame(parent_pipeline_id, subpage_id);
|
||||
let result = match self.pipelines.get(&parent_pipeline_id) {
|
||||
Some(pipeline) => pipeline.script_chan.send(msg),
|
||||
None => return warn!("Pipeline {:?} focus after closure.", containing_pipeline_id),
|
||||
None => return warn!("Pipeline {:?} focus after closure.", parent_pipeline_id),
|
||||
};
|
||||
if let Err(e) = result {
|
||||
self.handle_send_error(containing_pipeline_id, e);
|
||||
self.handle_send_error(parent_pipeline_id, e);
|
||||
}
|
||||
self.focus_parent_pipeline(containing_pipeline_id);
|
||||
self.focus_parent_pipeline(parent_pipeline_id);
|
||||
}
|
||||
|
||||
fn handle_focus_msg(&mut self, pipeline_id: PipelineId) {
|
||||
|
@ -2415,9 +2415,9 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
};
|
||||
|
||||
// If this is a mozbrowser iframe, then send the event with new url
|
||||
if let Some((containing_pipeline_id, subpage_id)) = self.get_mozbrowser_ancestor_info(pipeline_id) {
|
||||
if let Some(parent_pipeline) = self.pipelines.get(&containing_pipeline_id) {
|
||||
let pipeline_id = self.subpage_map.get(&(containing_pipeline_id, subpage_id));
|
||||
if let Some((parent_pipeline_id, subpage_id)) = self.get_mozbrowser_ancestor_info(pipeline_id) {
|
||||
if let Some(parent_pipeline) = self.pipelines.get(&parent_pipeline_id) {
|
||||
let pipeline_id = self.subpage_map.get(&(parent_pipeline_id, subpage_id));
|
||||
if let Some(pipeline) = pipeline_id.and_then(|pipeline_id| self.pipelines.get(pipeline_id)) {
|
||||
if let Some(frame_id) = pipeline.frame {
|
||||
let can_go_forward = !self.joint_session_future(frame_id).is_empty();
|
||||
|
|
|
@ -150,10 +150,10 @@ impl Pipeline {
|
|||
|
||||
let (script_chan, content_ports) = match state.script_chan {
|
||||
Some(script_chan) => {
|
||||
let (containing_pipeline_id, subpage_id, frame_type) =
|
||||
let (parent_pipeline_id, subpage_id, frame_type) =
|
||||
state.parent_info.expect("script_pipeline != None but subpage_id == None");
|
||||
let new_layout_info = NewLayoutInfo {
|
||||
containing_pipeline_id: containing_pipeline_id,
|
||||
parent_pipeline_id: parent_pipeline_id,
|
||||
new_pipeline_id: state.id,
|
||||
subpage_id: subpage_id,
|
||||
frame_type: frame_type,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue