mirror of
https://github.com/servo/servo.git
synced 2025-06-17 04:44:28 +00:00
add next_subpage_id to Page struct
This commit is contained in:
parent
5d7626fa44
commit
97a60f35e3
2 changed files with 10 additions and 3 deletions
|
@ -241,7 +241,8 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
|
||||||
pub fn parse_html(cx: *JSContext,
|
pub fn parse_html(cx: *JSContext,
|
||||||
url: Url,
|
url: Url,
|
||||||
resource_task: ResourceTask,
|
resource_task: ResourceTask,
|
||||||
image_cache_task: ImageCacheTask) -> HtmlParserResult {
|
image_cache_task: ImageCacheTask,
|
||||||
|
next_subpage_id: SubpageId) -> HtmlParserResult {
|
||||||
debug!("Hubbub: parsing %?", url);
|
debug!("Hubbub: parsing %?", url);
|
||||||
// Spawn a CSS parser to receive links to CSS style sheets.
|
// Spawn a CSS parser to receive links to CSS style sheets.
|
||||||
let resource_task2 = resource_task.clone();
|
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 (css_chan2, css_chan3, js_chan2) = (css_chan.clone(), css_chan.clone(), js_chan.clone());
|
||||||
let (iframe_port, iframe_chan) = comm::stream();
|
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 {
|
parser.set_tree_handler(~hubbub::TreeHandler {
|
||||||
create_comment: |data: ~str| {
|
create_comment: |data: ~str| {
|
||||||
|
|
|
@ -128,6 +128,8 @@ pub struct Page {
|
||||||
/// and simply caches pages forever (!). The bool indicates if reflow is required
|
/// and simply caches pages forever (!). The bool indicates if reflow is required
|
||||||
/// when reloading.
|
/// when reloading.
|
||||||
url: Option<(Url, bool)>,
|
url: Option<(Url, bool)>,
|
||||||
|
|
||||||
|
next_subpage_id: SubpageId,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct PageTree {
|
pub struct PageTree {
|
||||||
|
@ -151,6 +153,7 @@ impl PageTree {
|
||||||
window_size: size_future,
|
window_size: size_future,
|
||||||
js_info: None,
|
js_info: None,
|
||||||
url: None,
|
url: None,
|
||||||
|
next_subpage_id: SubpageId(0),
|
||||||
},
|
},
|
||||||
inner: ~[],
|
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,
|
let html_parsing_result = hubbub_html_parser::parse_html(page.js_info.get_ref().js_compartment.cx.ptr,
|
||||||
url.clone(),
|
url.clone(),
|
||||||
self.resource_task.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;
|
let HtmlParserResult {root, js_port, style_port, iframe_port} = html_parsing_result;
|
||||||
|
|
||||||
|
@ -628,6 +632,7 @@ impl ScriptTask {
|
||||||
match iframe_port.try_recv() {
|
match iframe_port.try_recv() {
|
||||||
None => break,
|
None => break,
|
||||||
Some((iframe_url, subpage_id, size_future)) => {
|
Some((iframe_url, subpage_id, size_future)) => {
|
||||||
|
page.next_subpage_id = SubpageId(*subpage_id + 1);
|
||||||
self.constellation_chan.send(LoadIframeUrlMsg(iframe_url,
|
self.constellation_chan.send(LoadIframeUrlMsg(iframe_url,
|
||||||
pipeline_id,
|
pipeline_id,
|
||||||
subpage_id,
|
subpage_id,
|
||||||
|
@ -654,6 +659,7 @@ impl ScriptTask {
|
||||||
page.layout_chan.send(AddStylesheetMsg(sheet));
|
page.layout_chan.send(AddStylesheetMsg(sheet));
|
||||||
}
|
}
|
||||||
Right(Some((iframe_url, subpage_id, size_future))) => {
|
Right(Some((iframe_url, subpage_id, size_future))) => {
|
||||||
|
page.next_subpage_id = SubpageId(*subpage_id + 1);
|
||||||
self.constellation_chan.send(LoadIframeUrlMsg(iframe_url,
|
self.constellation_chan.send(LoadIframeUrlMsg(iframe_url,
|
||||||
pipeline_id,
|
pipeline_id,
|
||||||
subpage_id,
|
subpage_id,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue