mirror of
https://github.com/servo/servo.git
synced 2025-06-17 12:54: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,
|
||||
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| {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue