mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Fixes for Rust language changes
This commit is contained in:
parent
c6766aa18c
commit
8ec11ad525
4 changed files with 26 additions and 23 deletions
|
@ -66,7 +66,7 @@ impl<C: Compositor> Engine<C> {
|
|||
let mut request = request;
|
||||
|
||||
loop {
|
||||
select! {
|
||||
select!(
|
||||
request => {
|
||||
LoadURL(url) -> next {
|
||||
// TODO: change copy to move once we have match move
|
||||
|
@ -94,12 +94,12 @@ impl<C: Compositor> Engine<C> {
|
|||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proto! EngineProto {
|
||||
proto! EngineProto(
|
||||
Running:send {
|
||||
LoadURL(url) -> Running,
|
||||
Exit -> Exiting
|
||||
|
@ -108,4 +108,5 @@ proto! EngineProto {
|
|||
Exiting:recv {
|
||||
Exited -> !
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
{
|
||||
macro_rules! move_ref {
|
||||
macro_rules! move_ref(
|
||||
{ $x:expr } => { unsafe { let y <- *ptr::addr_of(*$x); y } }
|
||||
}
|
||||
)
|
||||
|
||||
macro_rules! move_val {
|
||||
macro_rules! move_val(
|
||||
{ $x:expr } => { unsafe { let y <- *ptr::addr_of(*$x); y } }
|
||||
}
|
||||
)
|
||||
|
||||
// select!
|
||||
macro_rules! select_if {
|
||||
macro_rules! select_if(
|
||||
|
||||
{
|
||||
$index:expr,
|
||||
|
@ -39,19 +39,19 @@
|
|||
_ => fail
|
||||
}
|
||||
} else {
|
||||
select_if!{
|
||||
select_if!(
|
||||
$index,
|
||||
$count + 1
|
||||
$(, $ports => [
|
||||
$(type_this $messages$(($(x $xs),+))dont_type_this*
|
||||
-> $nexts => { $es }),+
|
||||
])*
|
||||
}
|
||||
)
|
||||
}
|
||||
};
|
||||
}
|
||||
)
|
||||
|
||||
macro_rules! select {
|
||||
macro_rules! select(
|
||||
{
|
||||
$( $port:path => {
|
||||
$($message:path$(($($x: ident),+))dont_type_this*
|
||||
|
@ -59,10 +59,10 @@
|
|||
} )+
|
||||
} => {
|
||||
let index = pipes::selecti([$(($port).header()),+]/_);
|
||||
select_if!{index, 0 $(, $port => [
|
||||
select_if!(index, 0 $(, $port => [
|
||||
$(type_this $message$(($(x $x),+))dont_type_this* -> $next => { $e }),+
|
||||
])+}
|
||||
])+)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
}
|
||||
|
|
|
@ -259,7 +259,7 @@ fn spawn_css_lexer_from_string(-content : ~str) -> pipes::port<Token> {
|
|||
|
||||
do task::spawn {
|
||||
let input_port = comm::port();
|
||||
input_port.send(Payload(str::bytes(content)));
|
||||
input_port.send(Payload(str::to_bytes(content)));
|
||||
input_port.send(Done(ok(())));
|
||||
|
||||
lex_css_from_bytes(input_port, result_chan);
|
||||
|
|
|
@ -145,6 +145,8 @@ fn parse_html(scope: NodeScope, url: Url, resource_task: ResourceTask) -> HtmlPa
|
|||
js_script_listener(js_chan, js_port, resource_task);
|
||||
};
|
||||
|
||||
let (scope, url) = (@copy scope, @copy url);
|
||||
|
||||
// Build the root node.
|
||||
let root = scope.new_node(Element(ElementData(~"html", ~HTMLDivElement)));
|
||||
debug!("created new node");
|
||||
|
@ -153,11 +155,11 @@ fn parse_html(scope: NodeScope, url: Url, resource_task: ResourceTask) -> HtmlPa
|
|||
parser.set_document_node(reinterpret_cast(root));
|
||||
parser.enable_scripting(true);
|
||||
parser.set_tree_handler(@hubbub::TreeHandler {
|
||||
create_comment: |data| {
|
||||
create_comment: |_data| {
|
||||
debug!("create comment");
|
||||
0u
|
||||
0u // FIXME: causes segfaults
|
||||
},
|
||||
create_doctype: |doctype| {
|
||||
create_doctype: |_doctype| {
|
||||
debug!("create doctype");
|
||||
let new_node = scope.new_node(Element(ElementData(~"doctype", ~UnknownElement)));
|
||||
reinterpret_cast(new_node)
|
||||
|
@ -202,7 +204,7 @@ fn parse_html(scope: NodeScope, url: Url, resource_task: ResourceTask) -> HtmlPa
|
|||
match (element.get_attr(~"rel"), element.get_attr(~"href")) {
|
||||
(some(rel), some(href)) if rel == ~"stylesheet" => {
|
||||
debug!("found CSS stylesheet: %s", href);
|
||||
css_chan.send(CSSFileMessage(make_url(href, some(copy url))));
|
||||
css_chan.send(CSSFileMessage(make_url(href, some(copy *url))));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
@ -268,7 +270,7 @@ fn parse_html(scope: NodeScope, url: Url, resource_task: ResourceTask) -> HtmlPa
|
|||
match element.get_attr(~"src") {
|
||||
some(src) => {
|
||||
debug!("found script: %s", src);
|
||||
let new_url = make_url(src, some(copy url));
|
||||
let new_url = make_url(src, some(copy *url));
|
||||
js_chan.send(JSFileMessage(new_url));
|
||||
}
|
||||
none => {}
|
||||
|
@ -283,7 +285,7 @@ fn parse_html(scope: NodeScope, url: Url, resource_task: ResourceTask) -> HtmlPa
|
|||
debug!("set tree handler");
|
||||
|
||||
let input_port = port();
|
||||
resource_task.send(Load(copy url, input_port.chan()));
|
||||
resource_task.send(Load(copy *url, input_port.chan()));
|
||||
debug!("loaded page");
|
||||
loop {
|
||||
match input_port.recv() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue