Update for language changes

This commit is contained in:
Patrick Walton 2012-09-20 15:04:00 -07:00
parent f3a8253bc8
commit ff6cefb798
35 changed files with 132 additions and 130 deletions

@ -1 +1 @@
Subproject commit 7ecba6aa7afd69ad970b2a041367a295d8307998
Subproject commit 0b520a6caf17b05d25db0026431873ae3f86a456

@ -1 +1 @@
Subproject commit ac7115cc7e1dd26b629c289fa527e5d40aa07d2e
Subproject commit be4e26b2c76bf7706f4da479cf06bf46094f0563

@ -1 +1 @@
Subproject commit 01de30b15bfb3ecdfb921b7571ff98e63c0d4483
Subproject commit 5dea272fc5f6a9b3812a845d003724d1bcdaf0bb

@ -1 +1 @@
Subproject commit 402d663658c6f10da2769fa9cbd406160bc89e67
Subproject commit 28857cda6e86d4da58cb0e25206b7def6bd87534

@ -1 +1 @@
Subproject commit 425d4598525f43de331c017f0c8408954dcbd66b
Subproject commit b1184364a73b2269b29897466d984aeb5d6e464f

@ -1 +1 @@
Subproject commit 4ff373b328f646d1ff1c9e67337bd284ff0fddda
Subproject commit 9223fe2a99ec5c76dc98a98ca99a10ff3513a845

@ -1 +1 @@
Subproject commit de66662c301b2c00dacabdf0d82adf22d16232b4
Subproject commit a4ef0a56c990d979fa34fed93293c305a03f67cb

View file

@ -189,7 +189,7 @@ impl<C:Compositor> Content<C> {
option::get(self.window));
for vec::each(js_scripts) |bytes| {
self.cx.evaluate_script(compartment.global_obj, bytes, ~"???", 1u);
self.cx.evaluate_script(compartment.global_obj, *bytes, ~"???", 1u);
}
return true;

View file

@ -192,11 +192,11 @@ impl Node : MatchingMethods {
// information as we go.
for styles.each |sty| {
let (selectors, decls) = copy *sty;
let (selectors, decls) = copy **sty;
for selectors.each |sel| {
if self.matches_selector(sel) {
if self.matches_selector(*sel) {
for decls.each |decl| {
self.update_style(decl);
self.update_style(*decl);
}
}
}

View file

@ -36,15 +36,15 @@ pure fn extract<T : Copy, U>(res: ParseResult<T>, f: fn(CSSValue<T>) -> U) -> Op
}
impl<T: Eq Copy> CSSValue<T> : Eq {
pure fn eq(&&other: CSSValue<T>) -> bool {
match (self, other) {
pure fn eq(other: &CSSValue<T>) -> bool {
match (self, *other) {
(Initial, Initial) => true,
(Inherit, Inherit) => true,
(Specified(a), Specified(b)) => a == b,
_ => false
}
}
pure fn ne(&&other: CSSValue<T>) -> bool {
pure fn ne(other: &CSSValue<T>) -> bool {
return !self.eq(other);
}
}
@ -182,46 +182,46 @@ type Stylesheet = ~[~Rule];
impl Length: cmp::Eq {
pure fn eq(&&other: Length) -> bool {
match (self, other) {
pure fn eq(other: &Length) -> bool {
match (self, *other) {
(Em(a), Em(b)) => a == b,
(Px(a), Px(b)) => a == b,
(_, _) => false
}
}
pure fn ne(&&other: Length) -> bool {
pure fn ne(other: &Length) -> bool {
return !self.eq(other);
}
}
impl BoxSizing: cmp::Eq {
pure fn eq(&&other: BoxSizing) -> bool {
match (self, other) {
pure fn eq(other: &BoxSizing) -> bool {
match (self, *other) {
(BoxLength(a), BoxLength(b)) => a == b,
(BoxPercent(a), BoxPercent(b)) => a == b,
(BoxAuto, BoxAuto) => true,
(_, _) => false
}
}
pure fn ne(&&other: BoxSizing) -> bool {
pure fn ne(other: &BoxSizing) -> bool {
return !self.eq(other);
}
}
impl AbsoluteSize: cmp::Eq {
pure fn eq(&&other: AbsoluteSize) -> bool {
self as uint == other as uint
pure fn eq(other: &AbsoluteSize) -> bool {
self as uint == (*other) as uint
}
pure fn ne(&&other: AbsoluteSize) -> bool {
pure fn ne(other: &AbsoluteSize) -> bool {
return !self.eq(other);
}
}
impl RelativeSize: cmp::Eq {
pure fn eq(&&other: RelativeSize) -> bool {
self as uint == other as uint
pure fn eq(other: &RelativeSize) -> bool {
self as uint == (*other) as uint
}
pure fn ne(&&other: RelativeSize) -> bool {
pure fn ne(other: &RelativeSize) -> bool {
return !self.eq(other);
}
}
@ -229,43 +229,43 @@ impl RelativeSize: cmp::Eq {
impl CSSBackgroundColor: cmp::Eq {
pure fn eq(&&other: CSSBackgroundColor) -> bool {
match (self, other) {
pure fn eq(other: &CSSBackgroundColor) -> bool {
match (self, *other) {
(BgColor(a), BgColor(b)) => a == b,
(BgTransparent, BgTransparent) => true,
(_, _) => false
}
}
pure fn ne(&&other: CSSBackgroundColor) -> bool {
pure fn ne(other: &CSSBackgroundColor) -> bool {
return !self.eq(other);
}
}
impl CSSColor: cmp::Eq {
pure fn eq(&&other: CSSColor) -> bool {
match (self, other) {
pure fn eq(other: &CSSColor) -> bool {
match (self, *other) {
(TextColor(a), TextColor(b)) => a == b
}
}
pure fn ne(&&other: CSSColor) -> bool {
pure fn ne(other: &CSSColor) -> bool {
return !self.eq(other);
}
}
impl CSSDisplay: cmp::Eq {
pure fn eq(&&other: CSSDisplay) -> bool {
self as uint == other as uint
pure fn eq(other: &CSSDisplay) -> bool {
self as uint == (*other) as uint
}
pure fn ne(&&other: CSSDisplay) -> bool {
pure fn ne(other: &CSSDisplay) -> bool {
return !self.eq(other);
}
}
impl CSSFontSize: cmp::Eq {
pure fn eq(&&other: CSSFontSize) -> bool {
match (self, other) {
pure fn eq(other: &CSSFontSize) -> bool {
match (self, *other) {
(AbsoluteSize(a), AbsoluteSize(b)) => a == b,
(RelativeSize(a), RelativeSize(b)) => a == b,
(LengthSize(a), LengthSize(b)) => a == b,
@ -273,7 +273,7 @@ impl CSSFontSize: cmp::Eq {
(_, _) => false
}
}
pure fn ne(&&other: CSSFontSize) -> bool {
pure fn ne(other: &CSSFontSize) -> bool {
return !self.eq(other);
}
}
@ -299,8 +299,8 @@ impl StyleDeclaration: cmp::Eq {
}*/
impl Attr: cmp::Eq {
pure fn eq(&&other: Attr) -> bool {
match (copy self, copy other) {
pure fn eq(other: &Attr) -> bool {
match (copy self, copy *other) {
(Exists(a), Exists(b)) => a == b,
(Exact(a, aa), Exact(b, bb))
@ -313,15 +313,15 @@ impl Attr: cmp::Eq {
| (StartsWith(*), _) => false
}
}
pure fn ne(&&other: Attr) -> bool {
pure fn ne(other: &Attr) -> bool {
return !self.eq(other);
}
}
impl Selector: cmp::Eq {
pure fn eq(&&other: Selector) -> bool {
pure fn eq(other: &Selector) -> bool {
// FIXME: Lots of copying here
match (copy self, copy other) {
match (copy self, copy *other) {
(Element(s_a, attrs_a), Element(s_b, attrs_b)) => s_a == s_b && attrs_a == attrs_b,
(Child(s1a, s2a), Child(s1b, s2b))
@ -336,7 +336,7 @@ impl Selector: cmp::Eq {
(Sibling(*), _) => false
}
}
pure fn ne(&&other: Selector) -> bool {
pure fn ne(other: &Selector) -> bool {
return !self.eq(other);
}
}
}

View file

@ -36,7 +36,7 @@ enum Element = int;
alt jsval_to_str(cx, id) {
ok(s) {
unsafe {
let doc: *Document = unsafe::reinterpret_cast(JS_GetContextPrivate(cx));
let doc: *Document = cast::reinterpret_cast(JS_GetContextPrivate(cx));
let elem = (*doc).getElementById(s);
}
//XXX wrap result
@ -61,7 +61,7 @@ enum Element = int;
extern fn getDocumentElement(cx: *JSContext, _argc: c_uint, vp: *mut jsval)
-> JSBool unsafe {
let obj = JS_THIS_OBJECT(cx, unsafe::reinterpret_cast(&vp));
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
if obj.is_null() {
return 0;
}
@ -76,14 +76,14 @@ extern fn getDocumentElement(cx: *JSContext, _argc: c_uint, vp: *mut jsval)
unsafe fn unwrap(obj: *JSObject) -> *rust_box<Document> {
//TODO: some kind of check if this is a Document object
let val = JS_GetReservedSlot(obj, 0);
unsafe::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val))
cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val))
}
extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {
#debug("document finalize!");
unsafe {
let val = JS_GetReservedSlot(obj, 0);
let _doc: @Document = unsafe::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
let _doc: @Document = cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
}
}
@ -108,7 +108,7 @@ fn init(compartment: bare_compartment, doc: @Document) {
compartment.global_obj.ptr));
unsafe {
let raw_ptr: *libc::c_void = unsafe::reinterpret_cast(&squirrel_away(doc));
let raw_ptr: *libc::c_void = cast::reinterpret_cast(&squirrel_away(doc));
JS_SetReservedSlot(instance.ptr, 0, RUST_PRIVATE_TO_JSVAL(raw_ptr));
}

View file

@ -23,7 +23,7 @@ extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {
#debug("element finalize!");
unsafe {
let val = JS_GetReservedSlot(obj, 0);
let _node: ~NodeBundle = unsafe::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
let _node: ~NodeBundle = cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
}
}
@ -63,7 +63,7 @@ fn init(compartment: bare_compartment) {
extern fn HTMLImageElement_getWidth(cx: *JSContext, _argc: c_uint, vp: *mut jsval)
-> JSBool unsafe {
let obj = JS_THIS_OBJECT(cx, unsafe::reinterpret_cast(&vp));
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
if obj.is_null() {
return 0;
}
@ -87,7 +87,7 @@ extern fn HTMLImageElement_getWidth(cx: *JSContext, _argc: c_uint, vp: *mut jsva
extern fn HTMLImageElement_setWidth(cx: *JSContext, _argc: c_uint, vp: *mut jsval)
-> JSBool unsafe {
let obj = JS_THIS_OBJECT(cx, unsafe::reinterpret_cast(&vp));
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
if obj.is_null() {
return 0;
}
@ -98,7 +98,7 @@ extern fn HTMLImageElement_setWidth(cx: *JSContext, _argc: c_uint, vp: *mut jsva
~Element(ed) => {
match ed.kind {
~HTMLImageElement(img) => {
let arg = ptr::offset(JS_ARGV(cx, unsafe::reinterpret_cast(&vp)), 0);
let arg = ptr::offset(JS_ARGV(cx, cast::reinterpret_cast(&vp)), 0);
img.size.width = au::from_px(RUST_JSVAL_TO_INT(*arg) as int)
},
_ => fail ~"why is this not an image element?"
@ -113,7 +113,7 @@ extern fn HTMLImageElement_setWidth(cx: *JSContext, _argc: c_uint, vp: *mut jsva
extern fn getTagName(cx: *JSContext, _argc: c_uint, vp: *mut jsval)
-> JSBool {
unsafe {
let obj = JS_THIS_OBJECT(cx, unsafe::reinterpret_cast(&vp));
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
if obj.is_null() {
return 0;
}
@ -160,7 +160,7 @@ fn create(cx: *JSContext, node: Node, scope: NodeScope) -> jsobj unsafe {
unsafe {
let raw_ptr: *libc::c_void =
unsafe::reinterpret_cast(&squirrel_away_unique(~NodeBundle(node, scope)));
cast::reinterpret_cast(&squirrel_away_unique(~NodeBundle(node, scope)));
JS_SetReservedSlot(obj.ptr, 0, RUST_PRIVATE_TO_JSVAL(raw_ptr));
}
return obj;

View file

@ -74,12 +74,12 @@ fn NodeBundle(n: Node, s: NodeScope) -> NodeBundle {
unsafe fn unwrap(obj: *JSObject) -> *rust_box<NodeBundle> {
let val = JS_GetReservedSlot(obj, 0);
unsafe::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val))
cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val))
}
extern fn getFirstChild(cx: *JSContext, _argc: c_uint, vp: *mut jsval) -> JSBool {
unsafe {
let obj = JS_THIS_OBJECT(cx, unsafe::reinterpret_cast(&vp));
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
if obj.is_null() {
return 0;
}
@ -102,7 +102,7 @@ extern fn getFirstChild(cx: *JSContext, _argc: c_uint, vp: *mut jsval) -> JSBool
extern fn getNextSibling(cx: *JSContext, _argc: c_uint, vp: *mut jsval) -> JSBool {
unsafe {
let obj = JS_THIS_OBJECT(cx, unsafe::reinterpret_cast(&vp));
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
if obj.is_null() {
return 0;
}
@ -125,7 +125,7 @@ extern fn getNextSibling(cx: *JSContext, _argc: c_uint, vp: *mut jsval) -> JSBoo
extern fn getNodeType(cx: *JSContext, _argc: c_uint, vp: *mut jsval) -> JSBool {
unsafe {
let obj = JS_THIS_OBJECT(cx, unsafe::reinterpret_cast(&vp));
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
if obj.is_null() {
return 0;
}

View file

@ -19,16 +19,16 @@ enum DOMString {
type rust_box<T> = {rc: uint, td: *sys::TypeDesc, next: *(), prev: *(), payload: T};
unsafe fn squirrel_away<T>(+x: @T) -> *rust_box<T> {
let y: *rust_box<T> = unsafe::reinterpret_cast(&x);
unsafe::forget(x);
let y: *rust_box<T> = cast::reinterpret_cast(&x);
cast::forget(x);
y
}
type rust_unique<T> = {payload: T};
unsafe fn squirrel_away_unique<T>(+x: ~T) -> *rust_box<T> {
let y: *rust_box<T> = unsafe::reinterpret_cast(&x);
unsafe::forget(x);
let y: *rust_box<T> = cast::reinterpret_cast(&x);
cast::forget(x);
y
}
@ -63,7 +63,7 @@ unsafe fn domstring_to_jsval(cx: *JSContext, str: DOMString) -> jsval {
}
str(s) => {
str::as_buf(s, |buf, len| {
let cbuf = unsafe::reinterpret_cast(&buf);
let cbuf = cast::reinterpret_cast(&buf);
RUST_STRING_TO_JSVAL(JS_NewStringCopyN(cx, cbuf, len as libc::size_t))
})
}
@ -73,7 +73,7 @@ unsafe fn domstring_to_jsval(cx: *JSContext, str: DOMString) -> jsval {
fn get_compartment(cx: *JSContext) -> *bare_compartment {
unsafe {
let privptr: *libc::c_void = JS_GetContextPrivate(cx);
let compartment: *bare_compartment = unsafe::reinterpret_cast(&privptr);
let compartment: *bare_compartment = cast::reinterpret_cast(&privptr);
assert cx == (*compartment).cx.ptr;
compartment
}
@ -94,8 +94,8 @@ extern fn has_instance(_cx: *JSContext, obj: **JSObject, v: *jsval, bp: *mut JSB
return 1;
}
fn prototype_jsclass(name: ~str) -> fn(bare_compartment) -> JSClass {
|compartment: bare_compartment, copy name| {
fn prototype_jsclass(name: ~str) -> fn(+bare_compartment) -> JSClass {
|+compartment: bare_compartment, copy name| {
{name: compartment.add_name(name),
flags: 0,
addProperty: GetJSClassHookStubPointer(PROPERTY_STUB) as *u8,
@ -123,8 +123,8 @@ fn prototype_jsclass(name: ~str) -> fn(bare_compartment) -> JSClass {
}
fn instance_jsclass(name: ~str, finalize: *u8)
-> fn(bare_compartment) -> JSClass {
|compartment: bare_compartment, copy name| {
-> fn(+bare_compartment) -> JSClass {
|+compartment: bare_compartment, copy name| {
{name: compartment.add_name(name),
flags: JSCLASS_HAS_RESERVED_SLOTS(1),
addProperty: GetJSClassHookStubPointer(PROPERTY_STUB) as *u8,

View file

@ -72,14 +72,14 @@ extern fn setTimeout(cx: *JSContext, argc: c_uint, vp: *jsval) -> JSBool unsafe
unsafe fn unwrap(obj: *JSObject) -> *rust_box<Window> {
let val = JS_GetReservedSlot(obj, 0);
unsafe::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val))
cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val))
}
extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {
#debug("finalize!");
unsafe {
let val = JS_GetReservedSlot(obj, 0);
let _: @Window = unsafe::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
let _: @Window = cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
}
}
@ -108,7 +108,7 @@ fn init(compartment: bare_compartment, win: @Window) {
});
unsafe {
let raw_ptr: *libc::c_void = unsafe::reinterpret_cast(&squirrel_away(win));
let raw_ptr: *libc::c_void = cast::reinterpret_cast(&squirrel_away(win));
JS_SetReservedSlot(obj.ptr, 0, RUST_PRIVATE_TO_JSVAL(raw_ptr));
}

View file

@ -68,7 +68,7 @@ struct ScopeResource<T:Send,A> {
d : ScopeData<T,A>,
drop unsafe {
for self.d.free_list.each |h| { free_handle(h); }
for self.d.free_list.each |h| { free_handle(*h); }
}
}
@ -132,26 +132,26 @@ impl<T:Send,A> Handle<T,A> {
impl<T: Copy Send,A> Scope<T,A> {
fn clone(v: *T) -> *T unsafe {
let n: *mut T =
unsafe::reinterpret_cast(&libc::calloc(sys::size_of::<T>() as size_t, 1u as size_t));
cast::reinterpret_cast(&libc::calloc(sys::size_of::<T>() as size_t, 1u as size_t));
// n.b.: this assignment will run the drop glue for <T,A>. *Hopefully* the fact that
// everything is initialized to NULL by calloc will make this ok. We may have to make the
// take glue be tolerant of this.
*n = unsafe{*v};
return unsafe::reinterpret_cast(&n);
return cast::reinterpret_cast(&n);
}
}
unsafe fn free<T:Send>(t: *T) {
let _x <- *unsafe::reinterpret_cast::<*T,*mut T>(&t);
libc::free(unsafe::reinterpret_cast(&t));
let _x <- *cast::reinterpret_cast::<*T,*mut T>(&t);
libc::free(cast::reinterpret_cast(&t));
}
unsafe fn free_handle<T:Send,A>(h: Handle<T,A>) {
free(h.read_ptr());
if h.write_ptr() != unsafe::reinterpret_cast(&h.read_ptr()) {
free(unsafe::reinterpret_cast::<*mut T,*T>(&h.write_ptr()));
if h.write_ptr() != cast::reinterpret_cast(&h.read_ptr()) {
free(cast::reinterpret_cast::<*mut T,*T>(&h.write_ptr()));
}
}
@ -185,7 +185,7 @@ impl<T:Copy Send,A> Scope<T,A> {
while (*handle).is_not_null() {
free(handle.read_ptr());
handle.set_read_ptr(unsafe::reinterpret_cast(&handle.write_ptr()));
handle.set_read_ptr(cast::reinterpret_cast(&handle.write_ptr()));
let next_handle = handle.next_dirty();
handle.set_next_dirty(null_handle());
handle = next_handle;
@ -207,7 +207,7 @@ impl<T:Copy Send,A> Scope<T,A> {
let const_write_ptr = ptr::const_offset(h.write_ptr(), 0);
if self.d.layout_active && const_read_ptr == const_write_ptr {
#debug["marking handle %? as dirty", h];
h.set_write_ptr(unsafe::reinterpret_cast(&self.clone(h.read_ptr())));
h.set_write_ptr(cast::reinterpret_cast(&self.clone(h.read_ptr())));
h.set_next_dirty(self.d.first_dirty);
self.d.first_dirty = h;
}
@ -217,10 +217,10 @@ impl<T:Copy Send,A> Scope<T,A> {
#[allow(non_implicitly_copyable_typarams)]
fn handle(v: T) -> Handle<T,A> unsafe {
let d: *HandleData<T,A> =
unsafe::reinterpret_cast(
cast::reinterpret_cast(
&libc::malloc(sys::size_of::<HandleData<T,A>>() as size_t));
(*d).read_ptr = self.clone(ptr::addr_of(v));
(*d).write_ptr = unsafe::reinterpret_cast(&(*d).read_ptr);
(*d).write_ptr = cast::reinterpret_cast(&(*d).read_ptr);
(*d).read_aux = ptr::null();
(*d).next_dirty = null_handle();
let h = _Handle(d);

View file

@ -90,8 +90,8 @@ trait DisplayListMethods {
impl DisplayList : DisplayListMethods {
fn draw(ctx: &RenderContext) {
for self.each |item| {
debug!("drawing %?", item);
item.draw(item, ctx);
debug!("drawing %?", *item);
item.draw(*item, ctx);
}
}
}
}

View file

@ -21,15 +21,15 @@ impl au : Num {
}
impl au : cmp::Ord {
pure fn lt(&&other: au) -> bool { *self < *other }
pure fn le(&&other: au) -> bool { *self <= *other }
pure fn ge(&&other: au) -> bool { *self >= *other }
pure fn gt(&&other: au) -> bool { *self > *other }
pure fn lt(other: &au) -> bool { *self < **other }
pure fn le(other: &au) -> bool { *self <= **other }
pure fn ge(other: &au) -> bool { *self >= **other }
pure fn gt(other: &au) -> bool { *self > **other }
}
impl au : cmp::Eq {
pure fn eq(&&other: au) -> bool { *self == *other }
pure fn ne(&&other: au) -> bool { *self != *other }
pure fn eq(other: &au) -> bool { *self == **other }
pure fn ne(other: &au) -> bool { *self != **other }
}
pure fn min(x: au, y: au) -> au { if x < y { x } else { y } }

View file

@ -19,13 +19,14 @@ use compositor::Compositor;
use render_task::{RenderTask, RenderMsg};
use task::spawn_listener;
use comm::{Chan, Port};
use unsafe::reinterpret_cast;
use cast::reinterpret_cast;
use vec_from_buf = vec::raw::from_buf;
use ptr::addr_of;
use dom::event::Event;
use dvec::DVec;
use display_list::DisplayList;
use std::cell::Cell;
use core::io::BytesWriter;
pub type PngCompositor = Chan<Msg>;
@ -72,10 +73,9 @@ fn do_draw(sender: pipes::Chan<DrawTarget>,
+dt: DrawTarget,
output: Chan<~[u8]>,
cairo_surface: ImageSurface) {
let buffer = io::mem_buffer();
let buffer = BytesWriter();
cairo_surface.write_to_png_stream(&buffer);
let @{ buf: buffer, pos: _ } <- buffer;
output.send(dvec::unwrap(move buffer));
output.send(buffer.buf.get());
// Send the next draw target to the renderer
sender.send(move dt);

View file

@ -6,12 +6,12 @@ enum format {
}
impl format: cmp::Eq {
pure fn eq(&&other: format) -> bool {
match (self, other) {
pure fn eq(other: &format) -> bool {
match (self, *other) {
(fo_rgba_8888, fo_rgba_8888) => true,
}
}
pure fn ne(&&other: format) -> bool {
pure fn ne(other: &format) -> bool {
return !self.eq(other);
}
}

View file

@ -14,7 +14,7 @@ use JSMessage = html::dom_builder::js_message;
use comm::{Chan, Port};
use str::from_slice;
use unsafe::reinterpret_cast;
use cast::reinterpret_cast;
use std::net::url::Url;
type JSResult = ~[~[u8]];

View file

@ -12,14 +12,14 @@ enum CharOrEof {
}
impl CharOrEof: cmp::Eq {
pure fn eq(&&other: CharOrEof) -> bool {
match (self, other) {
pure fn eq(other: &CharOrEof) -> bool {
match (self, *other) {
(CoeChar(a), CoeChar(b)) => a == b,
(CoeChar(*), _) | (_, CoeChar(*)) => false,
(CoeEof, CoeEof) => true,
}
}
pure fn ne(&&other: CharOrEof) -> bool {
pure fn ne(other: &CharOrEof) -> bool {
return !self.eq(other);
}
}

View file

@ -137,8 +137,8 @@ fn FlowContext(id: int, kind: FlowContextData, tree: tree::Tree<@FlowContext>) -
}
impl @FlowContext : cmp::Eq {
pure fn eq(&&other: @FlowContext) -> bool { box::ptr_eq(self, other) }
pure fn ne(&&other: @FlowContext) -> bool { !box::ptr_eq(self, other) }
pure fn eq(other: &@FlowContext) -> bool { box::ptr_eq(self, *other) }
pure fn ne(other: &@FlowContext) -> bool { !box::ptr_eq(self, *other) }
}
@ -387,7 +387,7 @@ impl @RenderBox {
bounds.size.height = runs[i].size().height;
let glyph_run = make_glyph_run(&runs[i]);
list.push(~dl::Glyphs(bounds, glyph_run));
bounds.origin.y += bounds.size.height;
bounds.origin.y = bounds.origin.y.add(bounds.size.height);
}
return;

View file

@ -94,8 +94,8 @@ impl @FlowContext : BlockLayout {
/* if not an anonymous block context, add in block box's widths.
these widths will not include child elements, just padding etc. */
do self.with_block_box |box| {
min_width += box.get_min_width();
pref_width += box.get_pref_width();
min_width = min_width.add(box.get_min_width());
pref_width = pref_width.add(box.get_pref_width());
}
self.data.min_width = min_width;
@ -121,7 +121,7 @@ impl @FlowContext : BlockLayout {
do self.with_block_box |box| {
box.data.position.size.width = remaining_width;
let (left_used, right_used) = box.get_used_width();
remaining_width -= (left_used + right_used);
remaining_width = remaining_width.sub(left_used.add(right_used));
}
for FlowTree.each_child(self) |child_ctx| {
@ -138,7 +138,7 @@ impl @FlowContext : BlockLayout {
for FlowTree.each_child(self) |child_ctx| {
child_ctx.data.position.origin.y = cur_y;
cur_y += child_ctx.data.position.size.height;
cur_y = cur_y.add(child_ctx.data.position.size.height);
}
self.data.position.size.height = cur_y;

View file

@ -111,7 +111,7 @@ impl LayoutTreeBuilder {
debug!("Adding child box b%? of b%?", parent_box.id, new_box.id);
RenderBoxTree.add_child(parent_box, new_box);
if (!next_ctx.eq(parent_ctx)) {
if (!next_ctx.eq(&parent_ctx)) {
debug!("Adding child flow f%? of f%?", parent_ctx.id, next_ctx.id);
FlowTree.add_child(parent_ctx, next_ctx);
}

View file

@ -123,7 +123,7 @@ impl @FlowContext : InlineLayout {
};
box.data.position.origin = Point2D(au(0), cur_y);
cur_y += au::max(line_height, box.data.position.size.height);
cur_y = cur_y.add(au::max(line_height, box.data.position.size.height));
} // for boxes.each |box|
}

View file

@ -23,13 +23,13 @@ type shared_box<T> = {
#[doc="Transform and @ into its underlying representation. The reference count stays constant."]
fn unwrap_box(-b : @RenderBox) -> *shared_box<RenderBox> unsafe {
let new_box : *shared_box<RenderBox> = unsafe::transmute(b);
let new_box : *shared_box<RenderBox> = cast::transmute(b);
return new_box;
}
#[doc="Transform an underlying representation back to an @. The reference count stays constant."]
fn rewrap_box(-b : *shared_box<RenderBox>) -> @RenderBox unsafe {
let new_box : @RenderBox = unsafe::transmute(b);
let new_box : @RenderBox = cast::transmute(b);
return new_box;
}

View file

@ -53,7 +53,7 @@ pub enum ImageResponseMsg {
impl ImageResponseMsg {
pure fn clone() -> ImageResponseMsg {
match self {
ImageReady(img) => ImageReady(unchecked { clone_arc(&img) }),
ImageReady(img) => ImageReady(unsafe { clone_arc(&img) }),
ImageNotReady => ImageNotReady,
ImageFailed => ImageFailed
}
@ -61,7 +61,7 @@ impl ImageResponseMsg {
}
impl ImageResponseMsg: cmp::Eq {
pure fn eq(&&other: ImageResponseMsg) -> bool {
pure fn eq(other: &ImageResponseMsg) -> bool {
// FIXME: Bad copies
match (self.clone(), other.clone()) {
(ImageReady(*), ImageReady(*)) => fail ~"unimplemented comparison",
@ -73,7 +73,7 @@ impl ImageResponseMsg: cmp::Eq {
| (ImageFailed, _) => false
}
}
pure fn ne(&&other: ImageResponseMsg) -> bool {
pure fn ne(other: &ImageResponseMsg) -> bool {
return !self.eq(other);
}
}
@ -160,7 +160,7 @@ impl ImageCache {
loop {
let msg = self.from_client.recv();
for msg_handlers.each |handler| { handler(&msg) }
for msg_handlers.each |handler| { (*handler)(&msg) }
#debug("image_cache_task: received: %?", msg);
@ -1093,4 +1093,4 @@ fn sync_cache_should_wait_for_images() {
image_cache_task.exit();
mock_resource_task.send(resource_task::Exit);
}
}

View file

@ -28,8 +28,8 @@ enum ProgressMsg {
}
impl ProgressMsg: cmp::Eq {
pure fn eq(&&other: ProgressMsg) -> bool {
match (copy self, copy other) {
pure fn eq(other: &ProgressMsg) -> bool {
match (copy self, copy *other) {
(Payload(a), Payload(b)) => a == b,
(Done(a), Done(b)) => a == b,
@ -37,7 +37,7 @@ impl ProgressMsg: cmp::Eq {
| (Done(*), _) => false
}
}
pure fn ne(&&other: ProgressMsg) -> bool {
pure fn ne(other: &ProgressMsg) -> bool {
return !self.eq(other);
}
}
@ -115,7 +115,7 @@ impl ResourceManager {
fn get_loader_factory(url: Url) -> Option<LoaderTaskFactory> {
for self.loaders.each |scheme_loader| {
let (scheme, loader_factory) = copy scheme_loader;
let (scheme, loader_factory) = copy *scheme_loader;
if scheme == url.scheme {
return Some(loader_factory);
}

View file

@ -7,6 +7,8 @@
#[license = "MPL"];
#[crate_type = "lib"];
#[legacy_modes];
extern mod std;
extern mod azure;
extern mod js;

View file

@ -41,7 +41,7 @@ fn run_pipeline_screen(urls: ~[~str]) {
let mut engine_task = Some(EngineTask(osmain));
for urls.each |filename| {
let url = make_url(filename, None);
let url = make_url(*filename, None);
#debug["master: Sending url `%s`", url_to_str(copy url)];
engine_task =
Some(EngineProto::client::LoadURL(swap_unwrap(&mut engine_task),

View file

@ -2,7 +2,7 @@ export FreeTypeNativeFont, with_test_native_font, create;
use vec_as_buf = vec::as_imm_buf;
use ptr::{addr_of, null};
use unsafe::reinterpret_cast;
use cast::reinterpret_cast;
use glyph::GlyphIndex;
use font::FontMetrics;
use azure::freetype;

View file

@ -17,7 +17,7 @@ use cocoa::cg::cg::{
CGFontCreateWithDataProvider,
CGFontRelease
};
use unsafe::transmute;
use cast::transmute;
use coretext::CTFontRef;
use coretext::coretext::CFRelease;

View file

@ -12,7 +12,7 @@ use gfx::geometry::au;
use geom::point::Point2D;
use font_cache::FontCache;
use unsafe::reinterpret_cast;
use cast::reinterpret_cast;
use harfbuzz::{HB_MEMORY_MODE_READONLY,
HB_DIRECTION_LTR};
use harfbuzz::{hb_blob_t, hb_face_t, hb_font_t, hb_buffer_t,

View file

@ -12,11 +12,11 @@ use cmp::Eq;
enum Color = {red : u8, green : u8, blue : u8, alpha : float};
impl Color : Eq {
pure fn eq(&&other: Color) -> bool {
pure fn eq(other: &Color) -> bool {
return self.red == other.red && self.green == other.green && self.blue == other.blue &&
self.alpha == other.alpha;
}
pure fn ne(&&other: Color) -> bool {
pure fn ne(other: &Color) -> bool {
!self.eq(other)
}
}