From a64821b151100aaa4eb208d829b2525786c33f93 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 19 Feb 2013 18:42:16 -0800 Subject: [PATCH] Update for language changes --- src/rust-mozjs | 2 +- src/servo/content/content_task.rs | 64 +++++++++++------------ src/servo/css/matching.rs | 10 ++-- src/servo/css/node_style.rs | 2 +- src/servo/css/node_util.rs | 2 +- src/servo/css/node_void_ptr.rs | 2 +- src/servo/css/select.rs | 6 +-- src/servo/css/select_handler.rs | 2 +- src/servo/dom/bindings/document.rs | 5 ++ src/servo/dom/bindings/element.rs | 18 +++++-- src/servo/dom/bindings/node.rs | 6 +++ src/servo/dom/bindings/utils.rs | 15 +++--- src/servo/dom/cow.rs | 6 +-- src/servo/dom/element.rs | 10 ++-- src/servo/dom/node.rs | 18 +++---- src/servo/dom/window.rs | 11 ++-- src/servo/engine.rs | 16 +++--- src/servo/html/cssparse.rs | 24 ++++----- src/servo/html/hubbub_html_parser.rs | 44 ++++++++-------- src/servo/layout/aux.rs | 4 +- src/servo/layout/block.rs | 3 +- src/servo/layout/box.rs | 8 +-- src/servo/layout/box_builder.rs | 22 ++++---- src/servo/layout/flow.rs | 9 ++-- src/servo/layout/inline.rs | 14 ++--- src/servo/layout/layout_task.rs | 26 ++++----- src/servo/layout/root.rs | 3 +- src/servo/layout/text.rs | 4 +- src/servo/layout/traverse.rs | 2 +- src/servo/macros.rs | 2 +- src/servo/platform/osmain.rs | 44 ++++++++-------- src/servo/platform/resize_rate_limiter.rs | 6 +-- src/servo/servo.rc | 19 ++++--- src/servo/util/tree.rs | 6 +-- 34 files changed, 229 insertions(+), 206 deletions(-) diff --git a/src/rust-mozjs b/src/rust-mozjs index f060d17c2e7..474721fb867 160000 --- a/src/rust-mozjs +++ b/src/rust-mozjs @@ -1 +1 @@ -Subproject commit f060d17c2e738f0136a3a1a57eb6363eddf9ca78 +Subproject commit 474721fb86731c37f8c56a8dee28f96f22fe30b9 diff --git a/src/servo/content/content_task.rs b/src/servo/content/content_task.rs index d26ab67083a..3981eb0e589 100644 --- a/src/servo/content/content_task.rs +++ b/src/servo/content/content_task.rs @@ -76,7 +76,7 @@ pub fn ContentTask(layout_task: LayoutTask, content.start(); } - return move control_chan; + return control_chan; } pub struct Content { @@ -126,27 +126,27 @@ pub fn Content(layout_task: LayoutTask, }; let content = @Content { - layout_task : move layout_task, - layout_join_port : None, - image_cache_task : move img_cache_task, - control_port : move control_port, - control_chan : move control_chan, - event_port : move event_port, - event_chan : move event_chan, + layout_task: layout_task, + layout_join_port: None, + image_cache_task: img_cache_task, + control_port: control_port, + control_chan: control_chan, + event_port: event_port, + event_chan: event_chan, - scope : NodeScope(), - jsrt : jsrt, - cx : cx, + scope: NodeScope(), + jsrt: jsrt, + cx: cx, - document : None, - window : None, - doc_url : None, - window_size : Size2D(800u, 600u), + document: None, + window: None, + doc_url: None, + window_size: Size2D(800u, 600u), - resource_task : resource_task, - compartment : compartment, + resource_task: resource_task, + compartment: compartment, - damage : MatchSelectorsDamage, + damage: MatchSelectorsDamage, }; cx.set_cx_private(ptr::to_unsafe_ptr(&*content) as *()); @@ -176,8 +176,8 @@ impl Content { } fn handle_control_msg(control_msg: ControlMsg) -> bool { - match move control_msg { - ParseMsg(move url) => { + match control_msg { + ParseMsg(url) => { debug!("content: Received url `%s` to parse", url_to_str(&url)); // Note: we can parse the next document in parallel @@ -195,8 +195,8 @@ impl Content { // and do not need to stop here in the content task loop { match result.style_port.recv() { - Some(move sheet) => { - self.layout_task.send(AddStylesheet(move sheet)); + Some(sheet) => { + self.layout_task.send(AddStylesheet(sheet)); } None => break } @@ -211,9 +211,9 @@ impl Content { self.damage.add(MatchSelectorsDamage); self.relayout(&document, &url); - self.document = Some(@move document); - self.window = Some(@move window); - self.doc_url = Some(move url); + self.document = Some(@document); + self.window = Some(@window); + self.doc_url = Some(url); let compartment = option::expect(self.compartment, ~"TODO error checking"); compartment.define_functions(debug_fns); @@ -221,8 +221,8 @@ impl Content { option::get(self.document), option::get(self.window)); - do vec::consume(move js_scripts) |_i, bytes| { - self.cx.evaluate_script(compartment.global_obj, move bytes, ~"???", 1u); + do vec::consume(js_scripts) |_i, bytes| { + self.cx.evaluate_script(compartment.global_obj, bytes, ~"???", 1u); } return true; @@ -251,10 +251,10 @@ impl Content { Err(msg) => { println(fmt!("Error opening %s: %s", url_to_str(&url), msg)); } - Ok(move bytes) => { + Ok(bytes) => { let compartment = option::expect(self.compartment, ~"TODO error checking"); compartment.define_functions(debug_fns); - self.cx.evaluate_script(compartment.global_obj, move bytes, copy url.path, 1u); + self.cx.evaluate_script(compartment.global_obj, bytes, copy url.path, 1u); } } return true; @@ -307,7 +307,7 @@ impl Content { // Layout will let us know when it's done let (join_port, join_chan) = pipes::stream(); - self.layout_join_port = move Some(move join_port); + self.layout_join_port = Some(join_port); // Send new document and relevant styles to layout @@ -316,11 +316,11 @@ impl Content { url: copy *doc_url, dom_event_chan: self.event_chan.clone(), window_size: self.window_size, - content_join_chan: move join_chan, + content_join_chan: join_chan, damage: replace(&mut self.damage, NoDamage), }; - self.layout_task.send(BuildMsg(move data)); + self.layout_task.send(BuildMsg(data)); // Indicate that reader was forked so any further // changes will be isolated. diff --git a/src/servo/css/matching.rs b/src/servo/css/matching.rs index 17f12af613c..25e5a530973 100644 --- a/src/servo/css/matching.rs +++ b/src/servo/css/matching.rs @@ -13,7 +13,7 @@ pub trait MatchMethods { fn restyle_subtree(select_ctx: &SelectCtx); } -impl Node : MatchMethods { +impl MatchMethods for Node { /** * Performs CSS selector matching on a subtree. @@ -30,8 +30,8 @@ impl Node : MatchMethods { }; let incomplete_results = select_ctx.select_style(&self, &select_handler); // Combine this node's results with its parent's to resolve all inherited values - let complete_results = compose_results(&self, move incomplete_results); - self.set_css_select_results(move complete_results); + let complete_results = compose_results(&self, incomplete_results); + self.set_css_select_results(complete_results); } let mut i = 0u; @@ -45,10 +45,10 @@ impl Node : MatchMethods { fn compose_results(node: &Node, results: SelectResults) -> CompleteSelectResults { match find_parent_element_node(node) { - None => CompleteSelectResults::new_root(move results), + None => CompleteSelectResults::new_root(results), Some(parent_node) => { let parent_results = parent_node.get_css_select_results(); - CompleteSelectResults::new_from_parent(parent_results, move results) + CompleteSelectResults::new_from_parent(parent_results, results) } } } diff --git a/src/servo/css/node_style.rs b/src/servo/css/node_style.rs index b15af92117e..1ca324c1967 100644 --- a/src/servo/css/node_style.rs +++ b/src/servo/css/node_style.rs @@ -9,7 +9,7 @@ pub trait StyledNode { fn style(&self) -> CompleteStyle/&self; } -impl Node: StyledNode { +impl StyledNode for Node { fn style(&self) -> CompleteStyle/&self { assert self.is_element(); // Only elements can have styles let results = self.get_css_select_results(); diff --git a/src/servo/css/node_util.rs b/src/servo/css/node_util.rs index 46456497cb5..acc32027377 100644 --- a/src/servo/css/node_util.rs +++ b/src/servo/css/node_util.rs @@ -31,7 +31,7 @@ impl NodeUtil for Node { Update the computed style of an HTML element with a style specified by CSS. */ fn set_css_select_results(decl : CompleteSelectResults) { - let decl = Cell(move decl); + let decl = Cell(decl); do self.aux |data| { data.style = Some(decl.take()) } diff --git a/src/servo/css/node_void_ptr.rs b/src/servo/css/node_void_ptr.rs index f78aff7d5d2..686265e5cd6 100644 --- a/src/servo/css/node_void_ptr.rs +++ b/src/servo/css/node_void_ptr.rs @@ -6,7 +6,7 @@ use dom::node::Node; extern mod netsurfcss; use css::node_void_ptr::netsurfcss::util::VoidPtrLike; -impl Node: VoidPtrLike { +impl VoidPtrLike for Node { static fn from_void_ptr(node: *libc::c_void) -> Node { assert node.is_not_null(); unsafe { cast::reinterpret_cast(&node) } diff --git a/src/servo/css/select.rs b/src/servo/css/select.rs index 9f79d6a0159..1f58694d0e4 100644 --- a/src/servo/css/select.rs +++ b/src/servo/css/select.rs @@ -10,7 +10,7 @@ pub fn new_css_select_ctx() -> SelectCtx { let mut ctx = SelectCtx::new(); ctx.append_sheet(html4_default_style(), OriginUA); ctx.append_sheet(servo_default_style(), OriginUA); - return move ctx; + return ctx; } fn html4_default_style() -> Stylesheet { @@ -29,7 +29,7 @@ fn default_url(name: &str) -> Url { fn style_stream(style: &str) -> DataStream { let style = Cell(str::to_bytes(style)); - let d: DataStream = |move style| if !style.is_empty() { + let d: DataStream = || if !style.is_empty() { Some(style.take()) } else { None @@ -123,4 +123,4 @@ ul, ol, dl { page-break-before: avoid } fn servo_default_style_str() -> ~str { // libcss want's this to default to 2px.. ~"* { border-width: 0px; }" -} \ No newline at end of file +} diff --git a/src/servo/css/select_handler.rs b/src/servo/css/select_handler.rs index c307de498b8..39cbe4a9b89 100644 --- a/src/servo/css/select_handler.rs +++ b/src/servo/css/select_handler.rs @@ -13,7 +13,7 @@ fn with_node_name(data: &NodeData, f: &fn(&str) -> R) -> R { } } -impl NodeSelectHandler: SelectHandler { +impl SelectHandler for NodeSelectHandler { fn with_node_name(node: &Node, f: &fn(&str) -> R) -> R { do node.read |data| { with_node_name(data, f) diff --git a/src/servo/dom/bindings/document.rs b/src/servo/dom/bindings/document.rs index 79678d0d911..7ad1c65e9f9 100644 --- a/src/servo/dom/bindings/document.rs +++ b/src/servo/dom/bindings/document.rs @@ -99,6 +99,11 @@ pub fn init(compartment: @mut Compartment, doc: @Document) { tinyid: 0, flags: (JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_NATIVE_ACCESSORS) as u8, getter: {op: getDocumentElement, info: null()}, + setter: {op: null(), info: null()}}, + {name: null(), + tinyid: 0, + flags: (JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_NATIVE_ACCESSORS) as u8, + getter: {op: null(), info: null()}, setter: {op: null(), info: null()}}]; vec::push(&mut compartment.global_props, attrs); vec::as_imm_buf(*attrs, |specs, _len| { diff --git a/src/servo/dom/bindings/element.rs b/src/servo/dom/bindings/element.rs index ef9de28cf01..93f1ef0a76f 100644 --- a/src/servo/dom/bindings/element.rs +++ b/src/servo/dom/bindings/element.rs @@ -36,6 +36,11 @@ pub fn init(compartment: @mut Compartment) { tinyid: 0, flags: (JSPROP_ENUMERATE | JSPROP_SHARED | JSPROP_NATIVE_ACCESSORS) as u8, getter: {op: getTagName, info: null()}, + setter: {op: null(), info: null()}}, + {name: null(), + tinyid: 0, + flags: (JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_NATIVE_ACCESSORS) as u8, + getter: {op: null(), info: null()}, setter: {op: null(), info: null()}}]; vec::push(&mut compartment.global_props, attrs); vec::as_imm_buf(*attrs, |specs, _len| { @@ -56,7 +61,12 @@ pub fn init(compartment: @mut Compartment) { tinyid: 0, flags: (JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_NATIVE_ACCESSORS) as u8, getter: {op: HTMLImageElement_getWidth, info: null()}, - setter: {op: HTMLImageElement_setWidth, info: null()}}]; + setter: {op: HTMLImageElement_setWidth, info: null()}}, + {name: null(), + tinyid: 0, + flags: (JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_NATIVE_ACCESSORS) as u8, + getter: {op: null(), info: null()}, + setter: {op: null(), info: null()}}]; vec::push(&mut compartment.global_props, attrs); vec::as_imm_buf(*attrs, |specs, _len| { JS_DefineProperties(compartment.cx.ptr, obj.ptr, specs); @@ -173,9 +183,9 @@ pub fn create(cx: *JSContext, node: Node, scope: NodeScope) -> jsobj { //XXXjdm the parent should probably be the node parent instead of the global //TODO error checking let compartment = utils::get_compartment(cx); - let obj = result::unwrap( - compartment.new_object_with_proto(~"GenericElementInstance", move proto, - compartment.global_obj.ptr)); + let obj = result::unwrap(compartment.new_object_with_proto(~"GenericElementInstance", + proto, + compartment.global_obj.ptr)); unsafe { let raw_ptr: *libc::c_void = diff --git a/src/servo/dom/bindings/node.rs b/src/servo/dom/bindings/node.rs index 83ab43f41b3..1a8f05c5b20 100644 --- a/src/servo/dom/bindings/node.rs +++ b/src/servo/dom/bindings/node.rs @@ -38,6 +38,12 @@ pub fn init(compartment: @mut Compartment) { tinyid: 0, flags: (JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_NATIVE_ACCESSORS) as u8, getter: {op: getNodeType, info: null()}, + setter: {op: null(), info: null()}}, + + {name: null(), + tinyid: 0, + flags: (JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_NATIVE_ACCESSORS) as u8, + getter: {op: null(), info: null()}, setter: {op: null(), info: null()}}]; vec::push(&mut compartment.global_props, attrs); vec::as_imm_buf(*attrs, |specs, _len| { diff --git a/src/servo/dom/bindings/utils.rs b/src/servo/dom/bindings/utils.rs index dab235ec028..f177f344571 100644 --- a/src/servo/dom/bindings/utils.rs +++ b/src/servo/dom/bindings/utils.rs @@ -28,7 +28,7 @@ pub unsafe fn squirrel_away(x: @T) -> *rust_box { pub unsafe fn squirrel_away_unique(x: ~T) -> *rust_box { let y: *rust_box = cast::reinterpret_cast(&x); - cast::forget(move x); + cast::forget(x); y } @@ -97,7 +97,7 @@ extern fn has_instance(_cx: *JSContext, obj: **JSObject, v: *JSVal, bp: *mut JSB } pub fn prototype_jsclass(name: ~str) -> @fn(compartment: @mut Compartment) -> JSClass { - let f: @fn(@mut Compartment) -> JSClass = |compartment: @mut Compartment, move name| { + let f: @fn(@mut Compartment) -> JSClass = |compartment: @mut Compartment| { JSClass { name: compartment.add_name(copy name), flags: 0, @@ -129,7 +129,7 @@ pub fn prototype_jsclass(name: ~str) -> @fn(compartment: @mut Compartment) -> JS pub fn instance_jsclass(name: ~str, finalize: *u8) -> @fn(compartment: @mut Compartment) -> JSClass { - let f: @fn(@mut Compartment) -> JSClass = |compartment: @mut Compartment, move name| { + let f: @fn(@mut Compartment) -> JSClass = |compartment: @mut Compartment| { JSClass { name: compartment.add_name(copy name), flags: JSCLASS_HAS_RESERVED_SLOTS(1), @@ -166,9 +166,10 @@ pub fn define_empty_prototype(name: ~str, proto: Option<~str>, compartment: @mut //TODO error checking let obj = result::unwrap( - match move proto { - Some(move s) => compartment.new_object_with_proto(copy name, move s, - compartment.global_obj.ptr), + match proto { + Some(s) => compartment.new_object_with_proto(copy name, + s, + compartment.global_obj.ptr), None => compartment.new_object(copy name, null(), compartment.global_obj.ptr) }); @@ -176,6 +177,6 @@ pub fn define_empty_prototype(name: ~str, proto: Option<~str>, compartment: @mut GetJSClassHookStubPointer(PROPERTY_STUB) as *u8, GetJSClassHookStubPointer(STRICT_PROPERTY_STUB) as *u8, JSPROP_ENUMERATE); - compartment.stash_global_proto(move name, obj); + compartment.stash_global_proto(name, obj); return obj; } diff --git a/src/servo/dom/cow.rs b/src/servo/dom/cow.rs index 63c74bf25b5..9568402214e 100644 --- a/src/servo/dom/cow.rs +++ b/src/servo/dom/cow.rs @@ -80,7 +80,7 @@ struct ScopeResource { } fn ScopeResource(d : ScopeData) -> ScopeResource { - ScopeResource { d: move d } + ScopeResource { d: d } } pub type Scope = @ScopeResource; @@ -143,7 +143,7 @@ impl Handle { } } -impl Handle : cmp::Eq { +impl cmp::Eq for Handle { pure fn eq(&self, other: &Handle) -> bool { **self == **other } pure fn ne(&self, other: &Handle) -> bool { **self != **other } } @@ -166,7 +166,7 @@ impl Scope { } unsafe fn free(t: *T) { - let _x = move *cast::reinterpret_cast::<*T,*mut T>(&t); + let _x = *cast::reinterpret_cast::<*T,*mut T>(&t); libc::free(cast::reinterpret_cast(&t)); } diff --git a/src/servo/dom/element.rs b/src/servo/dom/element.rs index c7932f5f733..af88a367fdd 100644 --- a/src/servo/dom/element.rs +++ b/src/servo/dom/element.rs @@ -35,7 +35,7 @@ impl ElementData { fn set_attr(name: &str, value: ~str) { let idx = do self.attrs.position |attr| { name == attr.name }; match idx { - Some(idx) => self.attrs.set_elt(idx, ~Attr(name.to_str(), move value)), + Some(idx) => self.attrs.set_elt(idx, ~Attr(name.to_str(), value)), None => {} } } @@ -43,8 +43,8 @@ impl ElementData { pub fn ElementData(tag_name: ~str, kind: ~ElementKind) -> ElementData { ElementData { - tag_name : move tag_name, - kind : move kind, + tag_name : tag_name, + kind : kind, attrs : DVec(), } } @@ -56,8 +56,8 @@ pub struct Attr { pub fn Attr(name: ~str, value: ~str) -> Attr { Attr { - name : move name, - value : move value, + name : name, + value : value, } } diff --git a/src/servo/dom/node.rs b/src/servo/dom/node.rs index 19c36cb92e7..60e1fda7cd4 100644 --- a/src/servo/dom/node.rs +++ b/src/servo/dom/node.rs @@ -35,7 +35,7 @@ impl NodeTree { } } -impl NodeTree : tree::ReadMethods { +impl tree::ReadMethods for NodeTree { fn with_tree_fields(n: &Node, f: fn(&tree::Tree) -> R) -> R { n.read(|n| f(&n.tree)) } @@ -53,7 +53,7 @@ impl Node { } } -impl Node : DebugMethods { +impl DebugMethods for Node { /* Dumps the subtree rooted at this node, for debugging. */ pure fn dump(&self) { self.dump_indent(0u); @@ -106,9 +106,9 @@ pub struct DoctypeData { pub fn DoctypeData(name: ~str, public_id: Option<~str>, system_id: Option<~str>, force_quirks: bool) -> DoctypeData { DoctypeData { - name : move name, - public_id : move public_id, - system_id : move system_id, + name : name, + public_id : public_id, + system_id : system_id, force_quirks : force_quirks, } } @@ -146,9 +146,9 @@ pub trait NodeScopeExtensions { } #[allow(non_implicitly_copyable_typarams)] -impl NodeScope : NodeScopeExtensions { +impl NodeScopeExtensions for NodeScope { fn new_node(k: NodeKind) -> Node { - self.handle(&NodeData({tree: tree::empty(), kind: ~move k})) + self.handle(&NodeData({tree: tree::empty(), kind: ~k})) } } @@ -163,7 +163,7 @@ impl NodeScope { } #[allow(non_implicitly_copyable_typarams)] -impl NodeScope : tree::ReadMethods { +impl tree::ReadMethods for NodeScope { fn with_tree_fields(node: &Node, f: fn(&tree::Tree) -> R) -> R { self.read(node, |n| f(&n.tree)) } @@ -176,7 +176,7 @@ impl NodeScope { } #[allow(non_implicitly_copyable_typarams)] -impl NodeScope : tree::WriteMethods { +impl tree::WriteMethods for NodeScope { pure fn tree_eq(a: &Node, b: &Node) -> bool { a == b } fn with_tree_fields(node: &Node, f: fn(&tree::Tree) -> R) -> R { diff --git a/src/servo/dom/window.rs b/src/servo/dom/window.rs index 9aff98d0075..c4dad24844c 100644 --- a/src/servo/dom/window.rs +++ b/src/servo/dom/window.rs @@ -41,7 +41,7 @@ pub fn TimerData(argc: libc::c_uint, argv: *JSVal) -> TimerData { i += 1; }; - move data + data } } @@ -72,13 +72,12 @@ impl Window { pub fn Window(content_chan: pipes::SharedChan) -> Window { Window { - timer_chan: do spawn_listener |timer_port: Port, - move content_chan| { + timer_chan: do spawn_listener |timer_port: Port| { loop { - match move timer_port.recv() { + match timer_port.recv() { TimerMessage_Close => break, - TimerMessage_Fire(move td) => { - content_chan.send(Timer(move td)); + TimerMessage_Fire(td) => { + content_chan.send(Timer(td)); } TimerMessage_TriggerExit => content_chan.send(ExitMsg) } diff --git a/src/servo/engine.rs b/src/servo/engine.rs index cb516d57275..bf3897fdcf7 100644 --- a/src/servo/engine.rs +++ b/src/servo/engine.rs @@ -59,8 +59,8 @@ pub fn Engine(compositor: C, render_task: render_task, resource_task: resource_task.clone(), image_cache_task: image_cache_task.clone(), - layout_task: move layout_task, - content_task: move content_task + layout_task: layout_task, + content_task: content_task }.run(); } } @@ -73,23 +73,23 @@ impl Engine { } fn handle_request(request: Msg) -> bool { - match move request { - LoadURLMsg(move url) => { + match request { + LoadURLMsg(url) => { if url.path.ends_with(".js") { - self.content_task.send(ExecuteMsg(move url)) + self.content_task.send(ExecuteMsg(url)) } else { - self.content_task.send(ParseMsg(move url)) + self.content_task.send(ParseMsg(url)) } return true; } - ExitMsg(move sender) => { + ExitMsg(sender) => { self.content_task.send(content_task::ExitMsg); self.layout_task.send(layout_task::ExitMsg); let (response_port, response_chan) = pipes::stream(); - self.render_task.send(render_task::ExitMsg(move response_chan)); + self.render_task.send(render_task::ExitMsg(response_chan)); response_port.recv(); self.image_cache_task.exit(); diff --git a/src/servo/html/cssparse.rs b/src/servo/html/cssparse.rs index 6d08bb2f509..028c9be5fcf 100644 --- a/src/servo/html/cssparse.rs +++ b/src/servo/html/cssparse.rs @@ -24,12 +24,12 @@ pub fn spawn_css_parser(provenance: StylesheetProvenance, -> Port { let (result_port, result_chan) = pipes::stream(); - let provenance_cell = Cell(move provenance); - do task::spawn |move provenance_cell, copy resource_task| { + let provenance_cell = Cell(provenance); + do task::spawn |copy resource_task| { let url = do provenance_cell.with_ref |p| { match *p { - UrlProvenance(copy the_url) => move the_url, - InlineProvenance(copy the_url, _) => move the_url + UrlProvenance(copy the_url) => the_url, + InlineProvenance(copy the_url, _) => the_url } }; @@ -42,14 +42,14 @@ pub fn spawn_css_parser(provenance: StylesheetProvenance, } fn data_stream(provenance: StylesheetProvenance, resource_task: ResourceTask) -> DataStream { - match move provenance { - UrlProvenance(move url) => { + match provenance { + UrlProvenance(url) => { let (input_port, input_chan) = pipes::stream(); - resource_task.send(Load(move url, input_chan)); + resource_task.send(Load(url, input_chan)); resource_port_to_data_stream(input_port) } - InlineProvenance(_, move data) => { - data_to_data_stream(move data) + InlineProvenance(_, data) => { + data_to_data_stream(data) } } } @@ -57,15 +57,15 @@ fn data_stream(provenance: StylesheetProvenance, resource_task: ResourceTask) -> fn resource_port_to_data_stream(input_port: Port) -> DataStream { return || { match input_port.recv() { - Payload(move data) => Some(move data), + Payload(data) => Some(data), Done(*) => None } } } fn data_to_data_stream(data: ~str) -> DataStream { - let data_cell = Cell(move data); - return |move data_cell| { + let data_cell = Cell(data); + return || { if data_cell.is_empty() { None } else { diff --git a/src/servo/html/hubbub_html_parser.rs b/src/servo/html/hubbub_html_parser.rs index 8302cb262e6..c797969d8ee 100644 --- a/src/servo/html/hubbub_html_parser.rs +++ b/src/servo/html/hubbub_html_parser.rs @@ -70,7 +70,7 @@ fn css_link_listener(to_parent: Chan>, // 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| { + do vec::consume(result_vec) |_i, port| { to_parent.send(Some(port.recv())); } to_parent.send(None); @@ -83,7 +83,7 @@ fn js_script_listener(to_parent: Chan<~[~[u8]]>, loop { match from_parent.recv() { - JSTaskNewFile(move url) => { + JSTaskNewFile(url) => { let (result_port, result_chan) = pipes::stream(); let resource_task = resource_task.clone(); do task::spawn { @@ -94,11 +94,11 @@ fn js_script_listener(to_parent: Chan<~[~[u8]]>, let mut buf = ~[]; loop { match input_port.recv() { - Payload(move data) => { + Payload(data) => { buf += data; } Done(Ok(*)) => { - result_chan.send(move buf); + result_chan.send(buf); break; } Done(Err(*)) => { @@ -116,7 +116,7 @@ fn js_script_listener(to_parent: Chan<~[~[u8]]>, } let js_scripts = vec::map(result_vec, |result_port| result_port.recv()); - to_parent.send(move js_scripts); + to_parent.send(js_scripts); } fn build_element_kind(tag: &str) -> ~ElementKind { @@ -185,7 +185,7 @@ pub fn parse_html(scope: NodeScope, }; let js_chan = SharedChan(js_chan); - let (scope, url) = (@copy scope, @move url); + let (scope, url) = (@copy scope, @url); unsafe { // Build the root node. @@ -208,9 +208,9 @@ pub fn parse_html(scope: NodeScope, ~HTMLStyleElement => { debug!("found inline CSS stylesheet"); let url = url::from_str("http://example.com/"); // FIXME - let provenance = InlineProvenance(result::unwrap(move url), + let provenance = InlineProvenance(result::unwrap(url), copy *data); - css_chan2.send(CSSTaskNewFile(move provenance)); + css_chan2.send(CSSTaskNewFile(provenance)); } _ => {} // Nothing to do. } @@ -225,7 +225,7 @@ pub fn parse_html(scope: NodeScope, parser.set_tree_handler(@hubbub::TreeHandler { create_comment: |data: ~str| { debug!("create comment"); - let new_node = scope.new_node(Comment(move data)); + let new_node = scope.new_node(Comment(data)); unsafe { cast::transmute(cow::unwrap(new_node)) } }, create_doctype: |doctype: ~hubbub::Doctype| { @@ -240,17 +240,19 @@ pub fn parse_html(scope: NodeScope, &None => None, &Some(ref id) => Some(copy *id) }; - let data = DoctypeData(copy doctype.name, move public_id, move system_id, + let data = DoctypeData(copy doctype.name, + public_id, + system_id, copy doctype.force_quirks); - let new_node = scope.new_node(Doctype(move data)); + let new_node = scope.new_node(Doctype(data)); unsafe { cast::transmute(cow::unwrap(new_node)) } }, - create_element: |tag: ~hubbub::Tag, move image_cache_task| { + create_element: |tag: ~hubbub::Tag| { debug!("create element"); // TODO: remove copying here by using struct pattern matching to // move all ~strs at once (blocked on Rust #3845, #3846, #3847) let elem_kind = build_element_kind(tag.name); - let elem = ElementData(copy tag.name, move elem_kind); + let elem = ElementData(copy tag.name, elem_kind); debug!("-- attach attrs"); for tag.attributes.each |attr| { @@ -262,7 +264,7 @@ pub fn parse_html(scope: NodeScope, //Handle CSS style sheets from elements ~HTMLLinkElement => { match (elem.get_attr(~"rel"), elem.get_attr(~"href")) { - (Some(move rel), Some(move href)) => { + (Some(rel), Some(href)) => { if rel == ~"stylesheet" { debug!("found CSS stylesheet: %s", href); css_chan2.send(CSSTaskNewFile(UrlProvenance(make_url( @@ -278,18 +280,18 @@ pub fn parse_html(scope: NodeScope, d.image = Some(copy img_url); // inform the image cache to load this, but don't store a handle. // TODO (Issue #84): don't prefetch if we are within a