diff options
author | Tim Kuehn <tkuehn@cmu.edu> | 2013-07-30 22:59:44 -0700 |
---|---|---|
committer | Tim Kuehn <tkuehn@cmu.edu> | 2013-07-31 13:12:33 -0700 |
commit | 97a60f35e3bdaacdf5972d926ef36c8bca195373 (patch) | |
tree | 0d7decf55b4883e02b0803ca65eecefe49d18a8a /src/components/script | |
parent | 5d7626fa44846c54ec0735f543fc0a427dac413a (diff) | |
download | servo-97a60f35e3bdaacdf5972d926ef36c8bca195373.tar.gz servo-97a60f35e3bdaacdf5972d926ef36c8bca195373.zip |
add next_subpage_id to Page struct
Diffstat (limited to 'src/components/script')
-rw-r--r-- | src/components/script/html/hubbub_html_parser.rs | 5 | ||||
-rw-r--r-- | src/components/script/script_task.rs | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 2ecf58dcb45..8bb6afd22b2 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -241,7 +241,8 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView> pub fn parse_html(cx: *JSContext, url: Url, resource_task: ResourceTask, - image_cache_task: ImageCacheTask) -> HtmlParserResult { + image_cache_task: ImageCacheTask, + next_subpage_id: SubpageId) -> HtmlParserResult { debug!("Hubbub: parsing %?", url); // Spawn a CSS parser to receive links to CSS style sheets. let resource_task2 = resource_task.clone(); @@ -282,7 +283,7 @@ pub fn parse_html(cx: *JSContext, let (css_chan2, css_chan3, js_chan2) = (css_chan.clone(), css_chan.clone(), js_chan.clone()); let (iframe_port, iframe_chan) = comm::stream(); - let next_subpage_id = Cell::new(SubpageId(0)); + let next_subpage_id = Cell::new(next_subpage_id); parser.set_tree_handler(~hubbub::TreeHandler { create_comment: |data: ~str| { diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs index 203cbf0c55b..f769e4b282a 100644 --- a/src/components/script/script_task.rs +++ b/src/components/script/script_task.rs @@ -128,6 +128,8 @@ pub struct Page { /// and simply caches pages forever (!). The bool indicates if reflow is required /// when reloading. url: Option<(Url, bool)>, + + next_subpage_id: SubpageId, } pub struct PageTree { @@ -151,6 +153,7 @@ impl PageTree { window_size: size_future, js_info: None, url: None, + next_subpage_id: SubpageId(0), }, inner: ~[], } @@ -599,7 +602,8 @@ impl ScriptTask { let html_parsing_result = hubbub_html_parser::parse_html(page.js_info.get_ref().js_compartment.cx.ptr, url.clone(), self.resource_task.clone(), - self.image_cache_task.clone()); + self.image_cache_task.clone(), + page.next_subpage_id.clone()); let HtmlParserResult {root, js_port, style_port, iframe_port} = html_parsing_result; @@ -628,6 +632,7 @@ impl ScriptTask { match iframe_port.try_recv() { None => break, Some((iframe_url, subpage_id, size_future)) => { + page.next_subpage_id = SubpageId(*subpage_id + 1); self.constellation_chan.send(LoadIframeUrlMsg(iframe_url, pipeline_id, subpage_id, @@ -654,6 +659,7 @@ impl ScriptTask { page.layout_chan.send(AddStylesheetMsg(sheet)); } Right(Some((iframe_url, subpage_id, size_future))) => { + page.next_subpage_id = SubpageId(*subpage_id + 1); self.constellation_chan.send(LoadIframeUrlMsg(iframe_url, pipeline_id, subpage_id, |