mirror of
https://github.com/servo/servo.git
synced 2025-06-16 20:34:30 +00:00
added subpage ids to map from iframe to all associated pipelines
This commit is contained in:
parent
a2bdab7989
commit
2348fbf46d
6 changed files with 71 additions and 47 deletions
|
@ -42,6 +42,7 @@ use std::str::eq_slice;
|
|||
use std::result;
|
||||
use std::task;
|
||||
use hubbub::hubbub;
|
||||
use servo_msg::constellation_msg::SubpageId;
|
||||
use servo_net::image_cache_task::ImageCacheTask;
|
||||
use servo_net::image_cache_task;
|
||||
use servo_net::resource_task::{Done, Load, Payload, ResourceTask};
|
||||
|
@ -83,7 +84,7 @@ enum JSMessage {
|
|||
pub struct HtmlParserResult {
|
||||
root: AbstractNode<ScriptView>,
|
||||
style_port: Port<Stylesheet>,
|
||||
iframe_port: Port<(Url, Future<Size2D<uint>>)>,
|
||||
iframe_port: Port<(Url, SubpageId, Future<Size2D<uint>>)>,
|
||||
js_port: Port<JSResult>,
|
||||
}
|
||||
|
||||
|
@ -222,7 +223,7 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
|
|||
handle_element!(cx, tag, "ul", HTMLUListElementTypeId, HTMLUListElement, []);
|
||||
|
||||
handle_element!(cx, tag, "img", HTMLImageElementTypeId, HTMLImageElement, [(image: None)]);
|
||||
handle_element!(cx, tag, "iframe", HTMLIframeElementTypeId, HTMLIframeElement, [(frame: None), (size_future_chan: None)]);
|
||||
handle_element!(cx, tag, "iframe", HTMLIframeElementTypeId, HTMLIframeElement, [(frame: None), (size_future_chan: None), (subpage_id: None)]);
|
||||
|
||||
handle_element!(cx, tag, "h1", HTMLHeadingElementTypeId, HTMLHeadingElement, [(level: Heading1)]);
|
||||
handle_element!(cx, tag, "h2", HTMLHeadingElementTypeId, HTMLHeadingElement, [(level: Heading2)]);
|
||||
|
@ -281,6 +282,8 @@ 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));
|
||||
|
||||
parser.set_tree_handler(~hubbub::TreeHandler {
|
||||
create_comment: |data: ~str| {
|
||||
debug!("create comment");
|
||||
|
@ -337,10 +340,18 @@ pub fn parse_html(cx: *JSContext,
|
|||
for src_opt.iter().advance |src| {
|
||||
let iframe_url = make_url(src.clone(), Some(url2.clone()));
|
||||
iframe_element.frame = Some(iframe_url.clone());
|
||||
|
||||
// Size future
|
||||
let (port, chan) = comm::oneshot();
|
||||
iframe_element.size_future_chan = Some(chan);
|
||||
let size_future = from_port(port);
|
||||
iframe_chan.send((iframe_url, size_future));
|
||||
|
||||
// Subpage Id
|
||||
let subpage_id = next_subpage_id.take();
|
||||
iframe_element.subpage_id = Some(subpage_id);
|
||||
next_subpage_id.put_back(SubpageId(*subpage_id + 1));
|
||||
|
||||
iframe_chan.send((iframe_url, subpage_id, size_future));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue