diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-03-23 23:03:45 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-03-23 23:03:45 -0600 |
commit | 2f85c5bb502c2582d34772db979e27c741ee76e3 (patch) | |
tree | 355586a19161bc12d9336200862d8b653e467b1f /components/script/script_task.rs | |
parent | cad58b3bec03586fd7d81e6fa45831803efd2350 (diff) | |
parent | 06a79243a7e598056c2f6fdb37eb0248f76c258a (diff) | |
download | servo-2f85c5bb502c2582d34772db979e27c741ee76e3.tar.gz servo-2f85c5bb502c2582d34772db979e27c741ee76e3.zip |
auto merge of #5333 : glennw/servo/fix-iframe-subpage, r=jdm
This fixes the case of clicking a link in an iframe, going back, then clicking the link again.
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r-- | components/script/script_task.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs index c66a0a424a3..35e57eacfa3 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -652,6 +652,10 @@ impl ScriptTask { subpage_id, event_name, event_detail), + ConstellationControlMsg::UpdateSubpageId(containing_pipeline_id, + old_subpage_id, + new_subpage_id) => + self.handle_update_subpage_id(containing_pipeline_id, old_subpage_id, new_subpage_id), } } @@ -817,6 +821,25 @@ impl ScriptTask { } } + fn handle_update_subpage_id(&self, + containing_pipeline_id: PipelineId, + old_subpage_id: SubpageId, + new_subpage_id: SubpageId) { + let borrowed_page = self.root_page(); + + let frame_element = borrowed_page.find(containing_pipeline_id).and_then(|page| { + let doc = page.document().root(); + let doc: JSRef<Node> = NodeCast::from_ref(doc.r()); + + doc.traverse_preorder() + .filter_map(HTMLIFrameElementCast::to_ref) + .find(|node| node.subpage_id() == Some(old_subpage_id)) + .map(Temporary::from_rooted) + }).root(); + + frame_element.unwrap().r().update_subpage_id(new_subpage_id); + } + /// Handles a notification that reflow completed. fn handle_reflow_complete_msg(&self, pipeline_id: PipelineId, reflow_id: uint) { debug!("Script: Reflow {:?} complete for {:?}", reflow_id, pipeline_id); |