mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update for language changes
This commit is contained in:
parent
2483797f48
commit
a64821b151
34 changed files with 229 additions and 206 deletions
|
@ -1 +1 @@
|
|||
Subproject commit f060d17c2e738f0136a3a1a57eb6363eddf9ca78
|
||||
Subproject commit 474721fb86731c37f8c56a8dee28f96f22fe30b9
|
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
|
|
|
@ -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) }
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -13,7 +13,7 @@ fn with_node_name<R>(data: &NodeData, f: &fn(&str) -> R) -> R {
|
|||
}
|
||||
}
|
||||
|
||||
impl NodeSelectHandler: SelectHandler<Node> {
|
||||
impl SelectHandler<Node> for NodeSelectHandler {
|
||||
fn with_node_name<R>(node: &Node, f: &fn(&str) -> R) -> R {
|
||||
do node.read |data| {
|
||||
with_node_name(data, f)
|
||||
|
|
|
@ -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| {
|
||||
|
|
|
@ -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,8 +183,8 @@ 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,
|
||||
let obj = result::unwrap(compartment.new_object_with_proto(~"GenericElementInstance",
|
||||
proto,
|
||||
compartment.global_obj.ptr));
|
||||
|
||||
unsafe {
|
||||
|
|
|
@ -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| {
|
||||
|
|
|
@ -28,7 +28,7 @@ pub unsafe fn squirrel_away<T>(x: @T) -> *rust_box<T> {
|
|||
|
||||
pub unsafe fn squirrel_away_unique<T>(x: ~T) -> *rust_box<T> {
|
||||
let y: *rust_box<T> = 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,8 +166,9 @@ 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,
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ struct ScopeResource<T,A> {
|
|||
}
|
||||
|
||||
fn ScopeResource<T:Owned,A>(d : ScopeData<T,A>) -> ScopeResource<T,A> {
|
||||
ScopeResource { d: move d }
|
||||
ScopeResource { d: d }
|
||||
}
|
||||
|
||||
pub type Scope<T,A> = @ScopeResource<T,A>;
|
||||
|
@ -143,7 +143,7 @@ impl<T:Owned,A> Handle<T,A> {
|
|||
}
|
||||
}
|
||||
|
||||
impl <T: Owned,A> Handle<T,A> : cmp::Eq {
|
||||
impl<T:Owned,A> cmp::Eq for Handle<T,A> {
|
||||
pure fn eq(&self, other: &Handle<T,A>) -> bool { **self == **other }
|
||||
pure fn ne(&self, other: &Handle<T,A>) -> bool { **self != **other }
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ impl<T: Copy Owned,A> Scope<T,A> {
|
|||
}
|
||||
|
||||
unsafe fn free<T>(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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ impl NodeTree {
|
|||
}
|
||||
}
|
||||
|
||||
impl NodeTree : tree::ReadMethods<Node> {
|
||||
impl tree::ReadMethods<Node> for NodeTree {
|
||||
fn with_tree_fields<R>(n: &Node, f: fn(&tree::Tree<Node>) -> 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<Node> {
|
||||
impl tree::ReadMethods<Node> for NodeScope {
|
||||
fn with_tree_fields<R>(node: &Node, f: fn(&tree::Tree<Node>) -> R) -> R {
|
||||
self.read(node, |n| f(&n.tree))
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ impl NodeScope {
|
|||
}
|
||||
|
||||
#[allow(non_implicitly_copyable_typarams)]
|
||||
impl NodeScope : tree::WriteMethods<Node> {
|
||||
impl tree::WriteMethods<Node> for NodeScope {
|
||||
pure fn tree_eq(a: &Node, b: &Node) -> bool { a == b }
|
||||
|
||||
fn with_tree_fields<R>(node: &Node, f: fn(&tree::Tree<Node>) -> R) -> R {
|
||||
|
|
|
@ -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<ControlMsg>) -> Window {
|
||||
|
||||
Window {
|
||||
timer_chan: do spawn_listener |timer_port: Port<TimerControlMsg>,
|
||||
move content_chan| {
|
||||
timer_chan: do spawn_listener |timer_port: Port<TimerControlMsg>| {
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -59,8 +59,8 @@ pub fn Engine<C:Compositor + Owned + Clone>(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<C:Compositor + Owned + Clone> Engine<C> {
|
|||
}
|
||||
|
||||
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();
|
||||
|
|
|
@ -24,12 +24,12 @@ pub fn spawn_css_parser(provenance: StylesheetProvenance,
|
|||
-> Port<Stylesheet> {
|
||||
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<ProgressMsg>) -> 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 {
|
||||
|
|
|
@ -70,7 +70,7 @@ fn css_link_listener(to_parent: Chan<Option<Stylesheet>>,
|
|||
|
||||
// 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 <link> 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 <noscript> tag.
|
||||
image_cache_task.send(image_cache_task::Prefetch(move img_url));
|
||||
image_cache_task.send(image_cache_task::Prefetch(img_url));
|
||||
}
|
||||
}
|
||||
//TODO (Issue #86): handle inline styles ('style' attr)
|
||||
_ => {}
|
||||
}
|
||||
let node = scope.new_node(Element(move elem));
|
||||
let node = scope.new_node(Element(elem));
|
||||
unsafe { cast::transmute(cow::unwrap(node)) }
|
||||
},
|
||||
create_text: |data: ~str| {
|
||||
debug!("create text");
|
||||
let new_node = scope.new_node(Text(move data));
|
||||
let new_node = scope.new_node(Text(data));
|
||||
unsafe { cast::transmute(cow::unwrap(new_node)) }
|
||||
},
|
||||
ref_node: |_node| {},
|
||||
|
@ -318,7 +320,7 @@ pub fn parse_html(scope: NodeScope,
|
|||
if deep { error!("-- deep clone unimplemented"); }
|
||||
let n: Node = cow::wrap(cast::transmute(node));
|
||||
let data = n.read(|read_data| copy *read_data.kind);
|
||||
let new_node = scope.new_node(move data);
|
||||
let new_node = scope.new_node(data);
|
||||
cast::transmute(cow::unwrap(new_node))
|
||||
}
|
||||
},
|
||||
|
@ -358,10 +360,10 @@ pub fn parse_html(scope: NodeScope,
|
|||
match *node_contents.kind {
|
||||
Element(ref element) if element.tag_name == ~"script" => {
|
||||
match element.get_attr(~"src") {
|
||||
Some(move src) => {
|
||||
Some(src) => {
|
||||
debug!("found script: %s", src);
|
||||
let new_url = make_url(move src, Some(copy *url));
|
||||
js_chan.send(JSTaskNewFile(move new_url));
|
||||
let new_url = make_url(src, Some(copy *url));
|
||||
js_chan.send(JSTaskNewFile(new_url));
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ pub trait LayoutAuxMethods {
|
|||
fn initialize_style_for_subtree(refs: &DVec<@LayoutData>);
|
||||
}
|
||||
|
||||
impl Node : LayoutAuxMethods {
|
||||
impl LayoutAuxMethods for Node {
|
||||
/** If none exists, creates empty layout data for the node (the reader-auxiliary
|
||||
* box in the COW model) and populates it with an empty style object.
|
||||
*/
|
||||
|
|
|
@ -40,8 +40,7 @@ pub trait BlockLayout {
|
|||
d: &Mut<DisplayList>);
|
||||
}
|
||||
|
||||
impl FlowContext : BlockLayout {
|
||||
|
||||
impl BlockLayout for FlowContext {
|
||||
pure fn starts_block_flow() -> bool {
|
||||
match self {
|
||||
RootFlow(*) | BlockFlow(*) | InlineBlockFlow(*) => true,
|
||||
|
|
|
@ -560,7 +560,7 @@ impl RenderBox {
|
|||
weight: FontWeight300,
|
||||
italic: italic,
|
||||
oblique: oblique,
|
||||
families: move font_families,
|
||||
families: font_families,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -573,7 +573,7 @@ impl RenderBox {
|
|||
}
|
||||
}
|
||||
|
||||
impl RenderBox : BoxedDebugMethods {
|
||||
impl BoxedDebugMethods for RenderBox {
|
||||
pure fn dump(@self) {
|
||||
self.dump_indent(0u);
|
||||
}
|
||||
|
@ -609,7 +609,7 @@ impl RenderBox {
|
|||
while !node.is_element() {
|
||||
match NodeTree.get_parent(&node) {
|
||||
None => fail!(~"no nearest element?!"),
|
||||
Some(move parent) => node = move parent,
|
||||
Some(parent) => node = parent,
|
||||
}
|
||||
}
|
||||
node
|
||||
|
@ -621,7 +621,7 @@ trait ToGfxColor {
|
|||
fn to_gfx_color(&self) -> gfx::color::Color;
|
||||
}
|
||||
|
||||
impl Color: ToGfxColor {
|
||||
impl ToGfxColor for Color {
|
||||
fn to_gfx_color(&self) -> gfx::color::Color {
|
||||
gfx::color::rgba(self.red,
|
||||
self.green,
|
||||
|
|
|
@ -270,7 +270,7 @@ impl BuilderContext {
|
|||
_ => self.clone()
|
||||
};
|
||||
|
||||
Some(move containing_context)
|
||||
Some(containing_context)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,8 +284,8 @@ impl LayoutTreeBuilder {
|
|||
fn construct_recursively(layout_ctx: &LayoutContext, cur_node: Node, parent_ctx: &BuilderContext) {
|
||||
debug!("Considering node: %s", cur_node.debug_str());
|
||||
|
||||
let this_ctx = match move parent_ctx.containing_context_for_node(cur_node, &self) {
|
||||
Some(move ctx) => move ctx,
|
||||
let this_ctx = match parent_ctx.containing_context_for_node(cur_node, &self) {
|
||||
Some(ctx) => ctx,
|
||||
None => { return; } // no context because of display: none. Stop building subtree.
|
||||
};
|
||||
debug!("point a: %s", cur_node.debug_str());
|
||||
|
@ -389,13 +389,13 @@ impl LayoutTreeBuilder {
|
|||
fn make_flow(ty : FlowContextType) -> @FlowContext {
|
||||
let data = FlowData(self.next_flow_id());
|
||||
let ret = match ty {
|
||||
Flow_Absolute => @AbsoluteFlow(move data),
|
||||
Flow_Block => @BlockFlow(move data, BlockFlowData()),
|
||||
Flow_Float => @FloatFlow(move data),
|
||||
Flow_InlineBlock => @InlineBlockFlow(move data),
|
||||
Flow_Inline => @InlineFlow(move data, InlineFlowData()),
|
||||
Flow_Root => @RootFlow(move data, RootFlowData()),
|
||||
Flow_Table => @TableFlow(move data)
|
||||
Flow_Absolute => @AbsoluteFlow(data),
|
||||
Flow_Block => @BlockFlow(data, BlockFlowData()),
|
||||
Flow_Float => @FloatFlow(data),
|
||||
Flow_InlineBlock => @InlineBlockFlow(data),
|
||||
Flow_Inline => @InlineFlow(data, InlineFlowData()),
|
||||
Flow_Root => @RootFlow(data, RootFlowData()),
|
||||
Flow_Table => @TableFlow(data)
|
||||
};
|
||||
debug!("LayoutTreeBuilder: created flow: %s", ret.debug_str());
|
||||
ret
|
||||
|
@ -430,7 +430,7 @@ impl LayoutTreeBuilder {
|
|||
let holder = ImageHolder::new({copy *d.image.get_ref()},
|
||||
layout_ctx.image_cache);
|
||||
|
||||
@ImageBox(RenderBoxData(node, ctx, self.next_box_id()), move holder)
|
||||
@ImageBox(RenderBoxData(node, ctx, self.next_box_id()), holder)
|
||||
} else {
|
||||
info!("Tried to make image box, but couldn't find image. Made generic box instead.");
|
||||
self.make_generic_box(layout_ctx, node, ctx)
|
||||
|
|
|
@ -211,7 +211,7 @@ impl FlowTree {
|
|||
}
|
||||
}
|
||||
|
||||
impl FlowTree : tree::ReadMethods<@FlowContext> {
|
||||
impl tree::ReadMethods<@FlowContext> for FlowTree {
|
||||
fn with_tree_fields<R>(box: &@FlowContext, f: fn(&tree::Tree<@FlowContext>) -> R) -> R {
|
||||
f(&box.d().tree)
|
||||
}
|
||||
|
@ -223,8 +223,7 @@ impl FlowTree {
|
|||
}
|
||||
}
|
||||
|
||||
impl FlowTree : tree::WriteMethods<@FlowContext> {
|
||||
|
||||
impl tree::WriteMethods<@FlowContext> for FlowTree {
|
||||
pure fn tree_eq(a: &@FlowContext, b: &@FlowContext) -> bool { core::managed::ptr_eq(*a, *b) }
|
||||
|
||||
fn with_tree_fields<R>(box: &@FlowContext, f: fn(&tree::Tree<@FlowContext>) -> R) -> R {
|
||||
|
@ -233,7 +232,7 @@ impl FlowTree : tree::WriteMethods<@FlowContext> {
|
|||
}
|
||||
|
||||
|
||||
impl FlowContext : BoxedDebugMethods {
|
||||
impl BoxedDebugMethods for FlowContext {
|
||||
pure fn dump(@self) {
|
||||
self.dump_indent(0u);
|
||||
}
|
||||
|
@ -263,7 +262,7 @@ impl FlowContext : BoxedDebugMethods {
|
|||
fmt!("%s b%d", *s, box.d().id)
|
||||
});
|
||||
s += ~")";
|
||||
move s
|
||||
s
|
||||
},
|
||||
BlockFlow(*) => {
|
||||
match self.block().box {
|
||||
|
|
|
@ -183,7 +183,7 @@ priv impl TextRunScanner {
|
|||
debug!("TextRunScanner: swapping out boxes.");
|
||||
// swap out old and new box list of flow, by supplying
|
||||
// temp boxes as return value to boxes.swap |...|
|
||||
dvec::unwrap(move out_boxes)
|
||||
dvec::unwrap(out_boxes)
|
||||
}
|
||||
|
||||
// helper functions
|
||||
|
@ -245,7 +245,7 @@ priv impl TextRunScanner {
|
|||
// this is probably achieved by creating fontgroup above, and then letting FontGroup decide
|
||||
// which Font to stick into the TextRun.
|
||||
let fontgroup = ctx.font_ctx.get_resolved_font_for_style(&font_style);
|
||||
let run = @fontgroup.create_textrun(move transformed_text);
|
||||
let run = @fontgroup.create_textrun(transformed_text);
|
||||
debug!("TextRunScanner: pushing single text box in range: %?", self.clump);
|
||||
let new_box = layout::text::adapt_textbox_with_range(old_box.d(),
|
||||
run,
|
||||
|
@ -284,7 +284,7 @@ priv impl TextRunScanner {
|
|||
// which Font to stick into the TextRun.
|
||||
let font_style = in_boxes[self.clump.begin()].font_style();
|
||||
let fontgroup = ctx.font_ctx.get_resolved_font_for_style(&font_style);
|
||||
let run = @TextRun::new(fontgroup.fonts[0], move run_str);
|
||||
let run = @TextRun::new(fontgroup.fonts[0], run_str);
|
||||
debug!("TextRunScanner: pushing box(es) in range: %?", self.clump);
|
||||
let clump = self.clump;
|
||||
for clump.eachi |i| {
|
||||
|
@ -401,11 +401,11 @@ impl LineboxScanner {
|
|||
self.line_spans.len(), self.flow.d().id);
|
||||
|
||||
do self.new_boxes.swap |boxes| {
|
||||
self.flow.inline().boxes.set(move boxes);
|
||||
self.flow.inline().boxes.set(boxes);
|
||||
~[]
|
||||
};
|
||||
do self.line_spans.swap |boxes| {
|
||||
self.flow.inline().lines.set(move boxes);
|
||||
self.flow.inline().lines.set(boxes);
|
||||
~[]
|
||||
};
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ impl LineboxScanner {
|
|||
}
|
||||
// clear line and add line mapping
|
||||
debug!("LineboxScanner: Saving information for flushed line %u.", self.line_spans.len());
|
||||
self.line_spans.push(move line_range);
|
||||
self.line_spans.push(line_range);
|
||||
self.reset_linebox();
|
||||
}
|
||||
|
||||
|
@ -591,7 +591,7 @@ pub trait InlineLayout {
|
|||
d: &Mut<DisplayList>);
|
||||
}
|
||||
|
||||
impl FlowContext : InlineLayout {
|
||||
impl InlineLayout for FlowContext {
|
||||
pure fn starts_inline_flow() -> bool { match self { InlineFlow(*) => true, _ => false } }
|
||||
|
||||
fn bubble_widths_inline(@self, ctx: &LayoutContext) {
|
||||
|
|
|
@ -115,7 +115,7 @@ fn Layout(render_task: RenderTask,
|
|||
Layout {
|
||||
render_task: render_task,
|
||||
image_cache_task: image_cache_task.clone(),
|
||||
local_image_cache: @LocalImageCache(move image_cache_task),
|
||||
local_image_cache: @LocalImageCache(image_cache_task),
|
||||
from_content: from_content,
|
||||
font_ctx: fctx,
|
||||
layout_refs: DVec(),
|
||||
|
@ -134,11 +134,11 @@ impl Layout {
|
|||
fn handle_request() -> bool {
|
||||
|
||||
match self.from_content.recv() {
|
||||
AddStylesheet(move sheet) => {
|
||||
self.handle_add_stylesheet(move sheet);
|
||||
AddStylesheet(sheet) => {
|
||||
self.handle_add_stylesheet(sheet);
|
||||
}
|
||||
BuildMsg(move data) => {
|
||||
let data = Cell(move data);
|
||||
BuildMsg(data) => {
|
||||
let data = Cell(data);
|
||||
|
||||
do time("layout: performing layout") {
|
||||
self.handle_build(data.take());
|
||||
|
@ -161,7 +161,7 @@ impl Layout {
|
|||
}
|
||||
|
||||
fn handle_add_stylesheet(sheet: Stylesheet) {
|
||||
let sheet = Cell(move sheet);
|
||||
let sheet = Cell(sheet);
|
||||
do self.css_select_ctx.borrow_mut |ctx| {
|
||||
ctx.append_sheet(sheet.take(), OriginAuthor);
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ impl Layout {
|
|||
debug!("%?", node.dump());
|
||||
|
||||
// Reset the image cache
|
||||
self.local_image_cache.next_round(self.make_on_image_available_cb(move dom_event_chan));
|
||||
self.local_image_cache.next_round(self.make_on_image_available_cb(dom_event_chan));
|
||||
|
||||
let screen_size = Size2D(Au::from_px(data.window_size.width as int),
|
||||
Au::from_px(data.window_size.height as int));
|
||||
|
@ -188,7 +188,7 @@ impl Layout {
|
|||
let layout_ctx = LayoutContext {
|
||||
image_cache: self.local_image_cache,
|
||||
font_ctx: self.font_ctx,
|
||||
doc_url: move doc_url,
|
||||
doc_url: doc_url,
|
||||
screen_size: Rect(Point2D(Au(0), Au(0)), screen_size)
|
||||
};
|
||||
|
||||
|
@ -249,7 +249,7 @@ impl Layout {
|
|||
screen_size.height.to_px() as uint)
|
||||
};
|
||||
|
||||
self.render_task.send(RenderMsg(move render_layer));
|
||||
self.render_task.send(RenderMsg(render_layer));
|
||||
} // time(layout: display list building)
|
||||
|
||||
// Tell content we're done
|
||||
|
@ -278,7 +278,7 @@ impl Layout {
|
|||
Some(rect) => {
|
||||
let size = Size2D(rect.size.width.to_px(),
|
||||
rect.size.height.to_px());
|
||||
Ok(ContentSize(move size))
|
||||
Ok(ContentSize(size))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -300,12 +300,12 @@ impl Layout {
|
|||
// make multiple copies of the callback, and the dom event
|
||||
// channel is not a copyable type, so this is actually a
|
||||
// little factory to produce callbacks
|
||||
let f: @fn() -> ~fn(ImageResponseMsg) = |move dom_event_chan| {
|
||||
let f: @fn() -> ~fn(ImageResponseMsg) = || {
|
||||
let dom_event_chan = dom_event_chan.clone();
|
||||
let f: ~fn(ImageResponseMsg) = |_msg, move dom_event_chan| {
|
||||
let f: ~fn(ImageResponseMsg) = |_| {
|
||||
dom_event_chan.send(ReflowEvent)
|
||||
};
|
||||
move f
|
||||
f
|
||||
};
|
||||
return f;
|
||||
}
|
||||
|
|
|
@ -32,8 +32,7 @@ pub trait RootLayout {
|
|||
c: &Point2D<Au>, d: &Mut<DisplayList>);
|
||||
}
|
||||
|
||||
impl FlowContext : RootLayout {
|
||||
|
||||
impl RootLayout for FlowContext {
|
||||
pure fn starts_root_flow() -> bool {
|
||||
match self {
|
||||
RootFlow(*) => true,
|
||||
|
|
|
@ -29,14 +29,14 @@ pub fn adapt_textbox_with_range(box_data: &RenderBoxData, run: @TextRun,
|
|||
let new_text_data = TextBoxData(run, range);
|
||||
let metrics = run.metrics_for_range(range);
|
||||
new_box_data.position.size = metrics.bounding_box.size;
|
||||
@TextBox(move new_box_data, move new_text_data)
|
||||
@TextBox(new_box_data, new_text_data)
|
||||
}
|
||||
|
||||
pub trait UnscannedMethods {
|
||||
pure fn raw_text(&self) -> ~str;
|
||||
}
|
||||
|
||||
impl RenderBox : UnscannedMethods {
|
||||
impl UnscannedMethods for RenderBox {
|
||||
pure fn raw_text(&self) -> ~str {
|
||||
match self {
|
||||
&UnscannedTextBox(_, ref s) => copy *s,
|
||||
|
|
|
@ -6,7 +6,7 @@ trait FlowContextTraversals {
|
|||
fn traverse_postorder(postorder_cb: &fn(@FlowContext));
|
||||
}
|
||||
|
||||
impl @FlowContext : FlowContextTraversals {
|
||||
impl FlowContextTraversals for @FlowContext {
|
||||
fn traverse_preorder(preorder_cb: &fn(@FlowContext)) {
|
||||
preorder_cb(self);
|
||||
do FlowTree.each_child(self) |child| { child.traverse_preorder(preorder_cb); true }
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
] )*
|
||||
} => {
|
||||
if $index == $count {
|
||||
match move pipes::try_recv($port) {
|
||||
match pipes::try_recv($port) {
|
||||
$(Some($message($($(ref $x,)+)* ref next)) => {
|
||||
// FIXME (#2329) we really want move out of enum here.
|
||||
let $next = move_ref!(next);
|
||||
|
|
|
@ -55,7 +55,7 @@ pub enum Msg {
|
|||
pub fn OSMain(dom_event_chan: pipes::SharedChan<Event>, opts: Opts) -> OSMain {
|
||||
let dom_event_chan = Cell(dom_event_chan);
|
||||
OSMain {
|
||||
chan: SharedChan(on_osmain::<Msg>(|po, move dom_event_chan, move opts| {
|
||||
chan: SharedChan(on_osmain::<Msg>(|po| {
|
||||
let po = Cell(po);
|
||||
do platform::runmain {
|
||||
debug!("preparing to enter main loop");
|
||||
|
@ -80,7 +80,7 @@ struct AzureDrawTargetImageData {
|
|||
size: Size2D<uint>
|
||||
}
|
||||
|
||||
impl AzureDrawTargetImageData : layers::layers::ImageData {
|
||||
impl layers::layers::ImageData for AzureDrawTargetImageData {
|
||||
fn size() -> Size2D<uint> { self.size }
|
||||
fn stride() -> uint { self.data_source_surface.get_size().width as uint }
|
||||
fn format() -> layers::layers::Format {
|
||||
|
@ -107,13 +107,13 @@ fn mainloop(mode: Mode,
|
|||
glut::init_display_mode(glut::DOUBLE);
|
||||
let glut_window = glut::create_window(~"Servo");
|
||||
glut::reshape_window(glut_window, 800, 600);
|
||||
window = GlutWindow(move glut_window);
|
||||
window = GlutWindow(glut_window);
|
||||
}
|
||||
ShareMode => {
|
||||
let size = Size2D(800, 600);
|
||||
let share_context: ShareGlContext = sharegl::base::ShareContext::new(size);
|
||||
io::println(fmt!("Sharing ID is %d", share_context.id()));
|
||||
window = ShareWindow(move share_context);
|
||||
window = ShareWindow(share_context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ fn mainloop(mode: Mode,
|
|||
identity());
|
||||
|
||||
let done = @mut false;
|
||||
let resize_rate_limiter = @ResizeRateLimiter(move dom_event_chan);
|
||||
let resize_rate_limiter = @ResizeRateLimiter(dom_event_chan);
|
||||
let check_for_messages = fn@() {
|
||||
|
||||
// Periodically check if content responded to our last resize event
|
||||
|
@ -151,12 +151,12 @@ fn mainloop(mode: Mode,
|
|||
//#debug("osmain: peeking");
|
||||
while po.peek() {
|
||||
match po.recv() {
|
||||
AddKeyHandler(move key_ch) => key_handlers.push(move key_ch),
|
||||
BeginDrawing(move sender) => lend_surface(surfaces, move sender),
|
||||
Draw(move sender, move draw_target) => {
|
||||
AddKeyHandler(key_ch) => key_handlers.push(key_ch),
|
||||
BeginDrawing(sender) => lend_surface(surfaces, sender),
|
||||
Draw(sender, draw_target) => {
|
||||
debug!("osmain: received new frame");
|
||||
return_surface(surfaces, move draw_target);
|
||||
lend_surface(surfaces, move sender);
|
||||
return_surface(surfaces, draw_target);
|
||||
lend_surface(surfaces, sender);
|
||||
|
||||
// Iterate over the children of the container layer.
|
||||
let mut current_layer_child = root_layer.first_child;
|
||||
|
@ -207,7 +207,7 @@ fn mainloop(mode: Mode,
|
|||
original_layer_transform.translate(x, y, 0.0)
|
||||
.scale(width as f32, height as f32, 1.0));
|
||||
}
|
||||
surfaces.front.layer_buffer_set.buffers = move buffers;
|
||||
surfaces.front.layer_buffer_set.buffers = buffers;
|
||||
}
|
||||
Exit => {
|
||||
*done = true;
|
||||
|
@ -277,10 +277,10 @@ compositor for the renderer
|
|||
*/
|
||||
impl Compositor for OSMain {
|
||||
fn begin_drawing(next_dt: pipes::Chan<LayerBufferSet>) {
|
||||
self.chan.send(BeginDrawing(move next_dt))
|
||||
self.chan.send(BeginDrawing(next_dt))
|
||||
}
|
||||
fn draw(next_dt: pipes::Chan<LayerBufferSet>, draw_me: LayerBufferSet) {
|
||||
self.chan.send(Draw(move next_dt, move draw_me))
|
||||
self.chan.send(Draw(next_dt, draw_me))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -302,12 +302,12 @@ fn lend_surface(surfaces: &SurfaceSet, receiver: pipes::Chan<LayerBufferSet>) {
|
|||
stride: layer_buffer.stride
|
||||
};
|
||||
debug!("osmain: lending surface %?", layer_buffer);
|
||||
move layer_buffer
|
||||
layer_buffer
|
||||
};
|
||||
surfaces.front.layer_buffer_set.buffers = move old_layer_buffers;
|
||||
surfaces.front.layer_buffer_set.buffers = old_layer_buffers;
|
||||
|
||||
let new_layer_buffer_set = LayerBufferSet { buffers: move new_layer_buffers };
|
||||
receiver.send(move new_layer_buffer_set);
|
||||
let new_layer_buffer_set = LayerBufferSet { buffers: new_layer_buffers };
|
||||
receiver.send(new_layer_buffer_set);
|
||||
// Now we don't have it
|
||||
surfaces.front.have = false;
|
||||
// But we (hopefully) have another!
|
||||
|
@ -322,7 +322,7 @@ fn return_surface(surfaces: &SurfaceSet, layer_buffer_set: LayerBufferSet) {
|
|||
assert surfaces.front.have;
|
||||
assert !surfaces.back.have;
|
||||
|
||||
surfaces.back.layer_buffer_set = move layer_buffer_set;
|
||||
surfaces.back.layer_buffer_set = layer_buffer_set;
|
||||
|
||||
// Now we have it again
|
||||
surfaces.back.have = true;
|
||||
|
@ -343,17 +343,17 @@ fn Surface(backend: BackendType) -> Surface {
|
|||
rect: Rect(Point2D(0u, 0u), Size2D(800u, 600u)),
|
||||
stride: 800
|
||||
};
|
||||
let layer_buffer_set = LayerBufferSet { buffers: ~[ move layer_buffer ] };
|
||||
Surface { layer_buffer_set: move layer_buffer_set, have: true }
|
||||
let layer_buffer_set = LayerBufferSet { buffers: ~[ layer_buffer ] };
|
||||
Surface { layer_buffer_set: layer_buffer_set, have: true }
|
||||
}
|
||||
|
||||
/// A function for spawning into the platform's main thread
|
||||
fn on_osmain<T: Owned>(f: fn~(po: Port<T>)) -> Chan<T> {
|
||||
let (setup_po, setup_ch) = pipes::stream();
|
||||
do task::task().sched_mode(task::PlatformThread).spawn |move f| {
|
||||
do task::task().sched_mode(task::PlatformThread).spawn {
|
||||
let (po, ch) = pipes::stream();
|
||||
setup_ch.send(ch);
|
||||
f(move po);
|
||||
f(po);
|
||||
}
|
||||
setup_po.recv()
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ pub struct ResizeRateLimiter {
|
|||
|
||||
pub fn ResizeRateLimiter(dom_event_chan: pipes::SharedChan<Event>) -> ResizeRateLimiter {
|
||||
ResizeRateLimiter {
|
||||
dom_event_chan: move dom_event_chan,
|
||||
dom_event_chan: dom_event_chan,
|
||||
last_response_port: None,
|
||||
next_resize_event: None
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ impl ResizeRateLimiter {
|
|||
|
||||
priv fn send_event(width: uint, height: uint) {
|
||||
let (port, chan) = pipes::stream();
|
||||
self.dom_event_chan.send(ResizeEvent(width, height, move chan));
|
||||
self.last_response_port = Some(move port);
|
||||
self.dom_event_chan.send(ResizeEvent(width, height, chan));
|
||||
self.last_response_port = Some(port);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,14 +127,14 @@ fn run(opts: &Opts) {
|
|||
|
||||
fn run_pipeline_screen(opts: &Opts) {
|
||||
let (dom_event_port, dom_event_chan) = pipes::stream();
|
||||
let dom_event_chan = pipes::SharedChan(move dom_event_chan);
|
||||
let dom_event_chan = pipes::SharedChan(dom_event_chan);
|
||||
|
||||
// The platform event handler thread
|
||||
let osmain = OSMain(dom_event_chan.clone(), copy *opts);
|
||||
|
||||
// Send each file to render then wait for keypress
|
||||
let (keypress_from_osmain, keypress_to_engine) = pipes::stream();
|
||||
osmain.chan.send(AddKeyHandler(move keypress_to_engine));
|
||||
osmain.chan.send(AddKeyHandler(keypress_to_engine));
|
||||
|
||||
// Create a servo instance
|
||||
let resource_task = ResourceTask();
|
||||
|
@ -149,7 +149,7 @@ fn run_pipeline_screen(opts: &Opts) {
|
|||
for opts.urls.each |filename| {
|
||||
let url = make_url(copy *filename, None);
|
||||
debug!("master: Sending url `%s`", url.to_str());
|
||||
engine_task.send(LoadURLMsg(move url));
|
||||
engine_task.send(LoadURLMsg(url));
|
||||
debug!("master: Waiting for keypress");
|
||||
|
||||
match keypress_from_osmain.try_recv() {
|
||||
|
@ -161,7 +161,7 @@ fn run_pipeline_screen(opts: &Opts) {
|
|||
// Shut everything down
|
||||
debug!("master: Shut down");
|
||||
let (exit_response_from_engine, exit_chan) = pipes::stream();
|
||||
engine_task.send(engine::ExitMsg(move exit_chan));
|
||||
engine_task.send(engine::ExitMsg(exit_chan));
|
||||
exit_response_from_engine.recv();
|
||||
|
||||
osmain.chan.send(platform::osmain::Exit);
|
||||
|
@ -182,15 +182,18 @@ fn run_pipeline_png(url: ~str, outfile: &str) {
|
|||
|
||||
listen(|pngdata_from_compositor| {
|
||||
let (dom_event_port, dom_event_chan) = pipes::stream();
|
||||
let dom_event_chan = pipes::SharedChan(move dom_event_chan);
|
||||
let dom_event_chan = pipes::SharedChan(dom_event_chan);
|
||||
|
||||
let compositor = PngCompositor(pngdata_from_compositor);
|
||||
let resource_task = ResourceTask();
|
||||
// For the PNG pipeline we are using a synchronous image task so that all images will be
|
||||
// fulfilled before the first paint.
|
||||
let image_cache_task = SyncImageCacheTask(resource_task);
|
||||
let engine_task = Engine(copy compositor, move dom_event_port, move dom_event_chan,
|
||||
move resource_task, move image_cache_task);
|
||||
let engine_task = Engine(copy compositor,
|
||||
dom_event_port,
|
||||
dom_event_chan,
|
||||
resource_task,
|
||||
image_cache_task);
|
||||
engine_task.send(LoadURLMsg(make_url(copy url, None)));
|
||||
|
||||
match buffered_file_writer(&Path(outfile)) {
|
||||
|
@ -199,7 +202,7 @@ fn run_pipeline_png(url: ~str, outfile: &str) {
|
|||
}
|
||||
|
||||
let (exit_chan, exit_response_from_engine) = pipes::stream();
|
||||
engine_task.send(engine::ExitMsg(move exit_chan));
|
||||
engine_task.send(engine::ExitMsg(exit_chan));
|
||||
exit_response_from_engine.recv();
|
||||
compositor.send(png_compositor::Exit);
|
||||
})
|
||||
|
|
|
@ -166,13 +166,13 @@ mod test {
|
|||
|
||||
enum dtree { dtree }
|
||||
|
||||
impl dtree : ReadMethods<@dummy> {
|
||||
impl ReadMethods<@dummy> for dtree {
|
||||
fn with_tree_fields<R>(d: &@dummy, f: fn(&Tree<@dummy>) -> R) -> R {
|
||||
f(&d.fields)
|
||||
}
|
||||
}
|
||||
|
||||
impl dtree : WriteMethods<@dummy> {
|
||||
impl WriteMethods<@dummy> for dtree {
|
||||
fn with_tree_fields<R>(d: &@dummy, f: fn(&Tree<@dummy>) -> R) -> R {
|
||||
f(&d.fields)
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ mod test {
|
|||
add_child(&dtree, p, *c);
|
||||
}
|
||||
|
||||
return {p: p, children: move children};
|
||||
return {p: p, children: children};
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue