diff options
Diffstat (limited to 'components')
-rw-r--r-- | components/compositing/compositor.rs | 2 | ||||
-rw-r--r-- | components/compositing/constellation.rs | 23 | ||||
-rw-r--r-- | components/msg/constellation_msg.rs | 2 |
3 files changed, 16 insertions, 11 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index af816d5a9c2..164f0f22621 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -946,7 +946,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { windowing::WindowNavigateMsg::Back => NavigationDirection::Back, }; let ConstellationChan(ref chan) = self.constellation_chan; - chan.send(ConstellationMsg::Navigate(direction)).unwrap() + chan.send(ConstellationMsg::Navigate(None, direction)).unwrap() } fn on_key_event(&self, key: Key, state: KeyState, modifiers: KeyModifiers) { diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index df4a448d758..33bd5246414 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -111,6 +111,9 @@ impl Frame { } fn load(&mut self, pipeline_id: PipelineId) -> Vec<PipelineId> { + // TODO(gw): To also allow navigations within subframes + // to affect the parent navigation history, this should bubble + // up the navigation change to each parent. self.prev.push(self.current); self.current = pipeline_id; replace(&mut self.next, vec!()) @@ -339,9 +342,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { self.compositor_proxy.send(CompositorMsg::LoadComplete); } // Handle a forward or back request - ConstellationMsg::Navigate(direction) => { + ConstellationMsg::Navigate(pipeline_info, direction) => { debug!("constellation got navigation message"); - self.handle_navigate_msg(direction); + self.handle_navigate_msg(pipeline_info, direction); } // Notification that painting has finished and is requesting permission to paint. ConstellationMsg::PainterReady(pipeline_id) => { @@ -530,15 +533,17 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { } } - fn handle_navigate_msg(&mut self, direction: constellation_msg::NavigationDirection) { + fn handle_navigate_msg(&mut self, + pipeline_info: Option<(PipelineId, SubpageId)>, + direction: constellation_msg::NavigationDirection) { debug!("received message to navigate {:?}", direction); - // TODO(gw): Extend handle_navigate_msg to allow passing the frame - // id that this navigation should apply to, instead of always referencing - // the frame history in the root frame. To also allow navigations within - // subframes to affect the parent navigation history, this should bubble - // up the navigation items to each parent. - let frame_id = self.root_frame_id.unwrap(); + // Get the frame id associated with the pipeline that sent + // the navigate message, or use root frame id by default. + let frame_id = pipeline_info.map_or(self.root_frame_id, |(containing_pipeline_id, subpage_id)| { + let pipeline_id = self.find_subpage(containing_pipeline_id, subpage_id).id; + self.pipeline_to_frame_map.get(&pipeline_id).map(|id| *id) + }).unwrap(); // Get the ids for the previous and next pipelines. let (prev_pipeline_id, next_pipeline_id) = { diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index d5ccb9efb6e..ce753f3c8d0 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -203,7 +203,7 @@ pub enum Msg { FrameRect(PipelineId, SubpageId, Rect<f32>), LoadUrl(PipelineId, LoadData), ScriptLoadedURLInIFrame(Url, PipelineId, SubpageId, Option<SubpageId>, IFrameSandboxState), - Navigate(NavigationDirection), + Navigate(Option<(PipelineId, SubpageId)>, NavigationDirection), PainterReady(PipelineId), ResizedWindow(WindowSizeData), KeyEvent(Key, KeyState, KeyModifiers), |