Convert to new Stylesheet definition. Break styling temporarily

This commit is contained in:
Brian Anderson 2012-10-30 21:32:48 -07:00
parent 921dd909d7
commit cdd17b5fce
4 changed files with 21 additions and 15 deletions

@ -1 +1 @@
Subproject commit 37cfbe86b6c024de87d1815843c956f4de535e9c
Subproject commit b0f9bd32d9de0e2fb3eca6ed02d58c4709a28693

View file

@ -197,9 +197,14 @@ impl Content {
// Send stylesheets over to layout
// FIXME: Need these should be streamed to layout as they are parsed
// and do not need to stop here in the content task
// FIXME: This currently expects exactly one stylesheet
let sheet = result.style_port.recv();
loop {
match result.style_port.recv() {
Some(move sheet) => {
self.layout_task.send(AddStylesheet(move sheet));
}
None => break
}
}
let js_scripts = result.js_port.recv();
debug!("js_scripts: %?", js_scripts);

View file

@ -210,7 +210,7 @@ impl Node : MatchingMethods {
// the latest rule takes precedence over the others. So we
// just overwrite style information as we go.
for styles.each |sty| {
/*for styles.each |sty| {
let (selectors, decls) = copy **sty;
for selectors.each |sel| {
if self.matches_selector(*sel) {
@ -219,9 +219,7 @@ impl Node : MatchingMethods {
}
}
}
}
self.aux(|a| debug!("Changed the style to: %?", copy *a.style));
}*/
}
}

View file

@ -30,7 +30,7 @@ enum JSMessage {
struct HtmlParserResult {
root: Node,
style_port: comm::Port<Stylesheet>,
style_port: comm::Port<Option<Stylesheet>>,
js_port: comm::Port<JSResult>,
}
@ -49,7 +49,7 @@ spawned, collates them, and sends them to the given result channel.
* `from_parent` - A port on which to receive new links.
*/
fn css_link_listener(to_parent : comm::Chan<Stylesheet>, from_parent : comm::Port<CSSMessage>,
fn css_link_listener(to_parent : comm::Chan<Option<Stylesheet>>, from_parent : comm::Port<CSSMessage>,
resource_task: ResourceTask) {
let mut result_vec = ~[];
@ -64,9 +64,12 @@ fn css_link_listener(to_parent : comm::Chan<Stylesheet>, from_parent : comm::Por
}
}
let css_rules = vec::flat_map(result_vec, |result_port| { result_port.recv() });
to_parent.send(move css_rules);
// Send the sheets back in order
// FIXME: Shouldn't wait until after we've recieved CSSTaskExit to start sending these
do vec::consume(move result_vec) |_i, port| {
to_parent.send(Some(port.recv()));
}
to_parent.send(None);
}
fn js_script_listener(to_parent : comm::Chan<~[~[u8]]>, from_parent : comm::Port<JSMessage>,
@ -159,9 +162,9 @@ pub fn parse_html(scope: NodeScope,
resource_task: ResourceTask,
image_cache_task: ImageCacheTask) -> HtmlParserResult unsafe {
// Spawn a CSS parser to receive links to CSS style sheets.
let (css_port, css_chan): (comm::Port<Stylesheet>, comm::Chan<CSSMessage>) =
let (css_port, css_chan): (comm::Port<Option<Stylesheet>>, comm::Chan<CSSMessage>) =
do task::spawn_conversation |css_port: comm::Port<CSSMessage>,
css_chan: comm::Chan<Stylesheet>| {
css_chan: comm::Chan<Option<Stylesheet>>| {
css_link_listener(css_chan, css_port, resource_task);
};