mirror of
https://github.com/servo/servo.git
synced 2025-06-24 00:54:32 +01:00
Update for language changes
This commit is contained in:
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
|
|
@ -189,7 +189,7 @@ impl<C:Compositor> Content<C> {
|
||||||
option::get(self.window));
|
option::get(self.window));
|
||||||
|
|
||||||
for vec::each(js_scripts) |bytes| {
|
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;
|
return true;
|
||||||
|
|
|
@ -192,11 +192,11 @@ impl Node : MatchingMethods {
|
||||||
// information as we go.
|
// information as we go.
|
||||||
|
|
||||||
for styles.each |sty| {
|
for styles.each |sty| {
|
||||||
let (selectors, decls) = copy *sty;
|
let (selectors, decls) = copy **sty;
|
||||||
for selectors.each |sel| {
|
for selectors.each |sel| {
|
||||||
if self.matches_selector(sel) {
|
if self.matches_selector(*sel) {
|
||||||
for decls.each |decl| {
|
for decls.each |decl| {
|
||||||
self.update_style(decl);
|
self.update_style(*decl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
impl<T: Eq Copy> CSSValue<T> : Eq {
|
||||||
pure fn eq(&&other: CSSValue<T>) -> bool {
|
pure fn eq(other: &CSSValue<T>) -> bool {
|
||||||
match (self, other) {
|
match (self, *other) {
|
||||||
(Initial, Initial) => true,
|
(Initial, Initial) => true,
|
||||||
(Inherit, Inherit) => true,
|
(Inherit, Inherit) => true,
|
||||||
(Specified(a), Specified(b)) => a == b,
|
(Specified(a), Specified(b)) => a == b,
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pure fn ne(&&other: CSSValue<T>) -> bool {
|
pure fn ne(other: &CSSValue<T>) -> bool {
|
||||||
return !self.eq(other);
|
return !self.eq(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,46 +182,46 @@ type Stylesheet = ~[~Rule];
|
||||||
|
|
||||||
|
|
||||||
impl Length: cmp::Eq {
|
impl Length: cmp::Eq {
|
||||||
pure fn eq(&&other: Length) -> bool {
|
pure fn eq(other: &Length) -> bool {
|
||||||
match (self, other) {
|
match (self, *other) {
|
||||||
(Em(a), Em(b)) => a == b,
|
(Em(a), Em(b)) => a == b,
|
||||||
(Px(a), Px(b)) => a == b,
|
(Px(a), Px(b)) => a == b,
|
||||||
(_, _) => false
|
(_, _) => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pure fn ne(&&other: Length) -> bool {
|
pure fn ne(other: &Length) -> bool {
|
||||||
return !self.eq(other);
|
return !self.eq(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BoxSizing: cmp::Eq {
|
impl BoxSizing: cmp::Eq {
|
||||||
pure fn eq(&&other: BoxSizing) -> bool {
|
pure fn eq(other: &BoxSizing) -> bool {
|
||||||
match (self, other) {
|
match (self, *other) {
|
||||||
(BoxLength(a), BoxLength(b)) => a == b,
|
(BoxLength(a), BoxLength(b)) => a == b,
|
||||||
(BoxPercent(a), BoxPercent(b)) => a == b,
|
(BoxPercent(a), BoxPercent(b)) => a == b,
|
||||||
(BoxAuto, BoxAuto) => true,
|
(BoxAuto, BoxAuto) => true,
|
||||||
(_, _) => false
|
(_, _) => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pure fn ne(&&other: BoxSizing) -> bool {
|
pure fn ne(other: &BoxSizing) -> bool {
|
||||||
return !self.eq(other);
|
return !self.eq(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AbsoluteSize: cmp::Eq {
|
impl AbsoluteSize: cmp::Eq {
|
||||||
pure fn eq(&&other: AbsoluteSize) -> bool {
|
pure fn eq(other: &AbsoluteSize) -> bool {
|
||||||
self as uint == other as uint
|
self as uint == (*other) as uint
|
||||||
}
|
}
|
||||||
pure fn ne(&&other: AbsoluteSize) -> bool {
|
pure fn ne(other: &AbsoluteSize) -> bool {
|
||||||
return !self.eq(other);
|
return !self.eq(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RelativeSize: cmp::Eq {
|
impl RelativeSize: cmp::Eq {
|
||||||
pure fn eq(&&other: RelativeSize) -> bool {
|
pure fn eq(other: &RelativeSize) -> bool {
|
||||||
self as uint == other as uint
|
self as uint == (*other) as uint
|
||||||
}
|
}
|
||||||
pure fn ne(&&other: RelativeSize) -> bool {
|
pure fn ne(other: &RelativeSize) -> bool {
|
||||||
return !self.eq(other);
|
return !self.eq(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,43 +229,43 @@ impl RelativeSize: cmp::Eq {
|
||||||
|
|
||||||
|
|
||||||
impl CSSBackgroundColor: cmp::Eq {
|
impl CSSBackgroundColor: cmp::Eq {
|
||||||
pure fn eq(&&other: CSSBackgroundColor) -> bool {
|
pure fn eq(other: &CSSBackgroundColor) -> bool {
|
||||||
match (self, other) {
|
match (self, *other) {
|
||||||
(BgColor(a), BgColor(b)) => a == b,
|
(BgColor(a), BgColor(b)) => a == b,
|
||||||
(BgTransparent, BgTransparent) => true,
|
(BgTransparent, BgTransparent) => true,
|
||||||
(_, _) => false
|
(_, _) => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pure fn ne(&&other: CSSBackgroundColor) -> bool {
|
pure fn ne(other: &CSSBackgroundColor) -> bool {
|
||||||
return !self.eq(other);
|
return !self.eq(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl CSSColor: cmp::Eq {
|
impl CSSColor: cmp::Eq {
|
||||||
pure fn eq(&&other: CSSColor) -> bool {
|
pure fn eq(other: &CSSColor) -> bool {
|
||||||
match (self, other) {
|
match (self, *other) {
|
||||||
(TextColor(a), TextColor(b)) => a == b
|
(TextColor(a), TextColor(b)) => a == b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pure fn ne(&&other: CSSColor) -> bool {
|
pure fn ne(other: &CSSColor) -> bool {
|
||||||
return !self.eq(other);
|
return !self.eq(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CSSDisplay: cmp::Eq {
|
impl CSSDisplay: cmp::Eq {
|
||||||
pure fn eq(&&other: CSSDisplay) -> bool {
|
pure fn eq(other: &CSSDisplay) -> bool {
|
||||||
self as uint == other as uint
|
self as uint == (*other) as uint
|
||||||
}
|
}
|
||||||
pure fn ne(&&other: CSSDisplay) -> bool {
|
pure fn ne(other: &CSSDisplay) -> bool {
|
||||||
return !self.eq(other);
|
return !self.eq(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl CSSFontSize: cmp::Eq {
|
impl CSSFontSize: cmp::Eq {
|
||||||
pure fn eq(&&other: CSSFontSize) -> bool {
|
pure fn eq(other: &CSSFontSize) -> bool {
|
||||||
match (self, other) {
|
match (self, *other) {
|
||||||
(AbsoluteSize(a), AbsoluteSize(b)) => a == b,
|
(AbsoluteSize(a), AbsoluteSize(b)) => a == b,
|
||||||
(RelativeSize(a), RelativeSize(b)) => a == b,
|
(RelativeSize(a), RelativeSize(b)) => a == b,
|
||||||
(LengthSize(a), LengthSize(b)) => a == b,
|
(LengthSize(a), LengthSize(b)) => a == b,
|
||||||
|
@ -273,7 +273,7 @@ impl CSSFontSize: cmp::Eq {
|
||||||
(_, _) => false
|
(_, _) => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pure fn ne(&&other: CSSFontSize) -> bool {
|
pure fn ne(other: &CSSFontSize) -> bool {
|
||||||
return !self.eq(other);
|
return !self.eq(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,8 +299,8 @@ impl StyleDeclaration: cmp::Eq {
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
impl Attr: cmp::Eq {
|
impl Attr: cmp::Eq {
|
||||||
pure fn eq(&&other: Attr) -> bool {
|
pure fn eq(other: &Attr) -> bool {
|
||||||
match (copy self, copy other) {
|
match (copy self, copy *other) {
|
||||||
(Exists(a), Exists(b)) => a == b,
|
(Exists(a), Exists(b)) => a == b,
|
||||||
|
|
||||||
(Exact(a, aa), Exact(b, bb))
|
(Exact(a, aa), Exact(b, bb))
|
||||||
|
@ -313,15 +313,15 @@ impl Attr: cmp::Eq {
|
||||||
| (StartsWith(*), _) => false
|
| (StartsWith(*), _) => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pure fn ne(&&other: Attr) -> bool {
|
pure fn ne(other: &Attr) -> bool {
|
||||||
return !self.eq(other);
|
return !self.eq(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Selector: cmp::Eq {
|
impl Selector: cmp::Eq {
|
||||||
pure fn eq(&&other: Selector) -> bool {
|
pure fn eq(other: &Selector) -> bool {
|
||||||
// FIXME: Lots of copying here
|
// 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,
|
(Element(s_a, attrs_a), Element(s_b, attrs_b)) => s_a == s_b && attrs_a == attrs_b,
|
||||||
|
|
||||||
(Child(s1a, s2a), Child(s1b, s2b))
|
(Child(s1a, s2a), Child(s1b, s2b))
|
||||||
|
@ -336,7 +336,7 @@ impl Selector: cmp::Eq {
|
||||||
(Sibling(*), _) => false
|
(Sibling(*), _) => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pure fn ne(&&other: Selector) -> bool {
|
pure fn ne(other: &Selector) -> bool {
|
||||||
return !self.eq(other);
|
return !self.eq(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ enum Element = int;
|
||||||
alt jsval_to_str(cx, id) {
|
alt jsval_to_str(cx, id) {
|
||||||
ok(s) {
|
ok(s) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let doc: *Document = unsafe::reinterpret_cast(JS_GetContextPrivate(cx));
|
let doc: *Document = cast::reinterpret_cast(JS_GetContextPrivate(cx));
|
||||||
let elem = (*doc).getElementById(s);
|
let elem = (*doc).getElementById(s);
|
||||||
}
|
}
|
||||||
//XXX wrap result
|
//XXX wrap result
|
||||||
|
@ -61,7 +61,7 @@ enum Element = int;
|
||||||
|
|
||||||
extern fn getDocumentElement(cx: *JSContext, _argc: c_uint, vp: *mut jsval)
|
extern fn getDocumentElement(cx: *JSContext, _argc: c_uint, vp: *mut jsval)
|
||||||
-> JSBool unsafe {
|
-> 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() {
|
if obj.is_null() {
|
||||||
return 0;
|
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> {
|
unsafe fn unwrap(obj: *JSObject) -> *rust_box<Document> {
|
||||||
//TODO: some kind of check if this is a Document object
|
//TODO: some kind of check if this is a Document object
|
||||||
let val = JS_GetReservedSlot(obj, 0);
|
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) {
|
extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {
|
||||||
#debug("document finalize!");
|
#debug("document finalize!");
|
||||||
unsafe {
|
unsafe {
|
||||||
let val = JS_GetReservedSlot(obj, 0);
|
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));
|
compartment.global_obj.ptr));
|
||||||
|
|
||||||
unsafe {
|
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));
|
JS_SetReservedSlot(instance.ptr, 0, RUST_PRIVATE_TO_JSVAL(raw_ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {
|
||||||
#debug("element finalize!");
|
#debug("element finalize!");
|
||||||
unsafe {
|
unsafe {
|
||||||
let val = JS_GetReservedSlot(obj, 0);
|
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)
|
extern fn HTMLImageElement_getWidth(cx: *JSContext, _argc: c_uint, vp: *mut jsval)
|
||||||
-> JSBool unsafe {
|
-> 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() {
|
if obj.is_null() {
|
||||||
return 0;
|
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)
|
extern fn HTMLImageElement_setWidth(cx: *JSContext, _argc: c_uint, vp: *mut jsval)
|
||||||
-> JSBool unsafe {
|
-> 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() {
|
if obj.is_null() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ extern fn HTMLImageElement_setWidth(cx: *JSContext, _argc: c_uint, vp: *mut jsva
|
||||||
~Element(ed) => {
|
~Element(ed) => {
|
||||||
match ed.kind {
|
match ed.kind {
|
||||||
~HTMLImageElement(img) => {
|
~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)
|
img.size.width = au::from_px(RUST_JSVAL_TO_INT(*arg) as int)
|
||||||
},
|
},
|
||||||
_ => fail ~"why is this not an image element?"
|
_ => 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)
|
extern fn getTagName(cx: *JSContext, _argc: c_uint, vp: *mut jsval)
|
||||||
-> JSBool {
|
-> JSBool {
|
||||||
unsafe {
|
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() {
|
if obj.is_null() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ fn create(cx: *JSContext, node: Node, scope: NodeScope) -> jsobj unsafe {
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let raw_ptr: *libc::c_void =
|
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));
|
JS_SetReservedSlot(obj.ptr, 0, RUST_PRIVATE_TO_JSVAL(raw_ptr));
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
|
|
|
@ -74,12 +74,12 @@ fn NodeBundle(n: Node, s: NodeScope) -> NodeBundle {
|
||||||
|
|
||||||
unsafe fn unwrap(obj: *JSObject) -> *rust_box<NodeBundle> {
|
unsafe fn unwrap(obj: *JSObject) -> *rust_box<NodeBundle> {
|
||||||
let val = JS_GetReservedSlot(obj, 0);
|
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 {
|
extern fn getFirstChild(cx: *JSContext, _argc: c_uint, vp: *mut jsval) -> JSBool {
|
||||||
unsafe {
|
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() {
|
if obj.is_null() {
|
||||||
return 0;
|
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 {
|
extern fn getNextSibling(cx: *JSContext, _argc: c_uint, vp: *mut jsval) -> JSBool {
|
||||||
unsafe {
|
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() {
|
if obj.is_null() {
|
||||||
return 0;
|
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 {
|
extern fn getNodeType(cx: *JSContext, _argc: c_uint, vp: *mut jsval) -> JSBool {
|
||||||
unsafe {
|
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() {
|
if obj.is_null() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,16 +19,16 @@ enum DOMString {
|
||||||
type rust_box<T> = {rc: uint, td: *sys::TypeDesc, next: *(), prev: *(), payload: T};
|
type rust_box<T> = {rc: uint, td: *sys::TypeDesc, next: *(), prev: *(), payload: T};
|
||||||
|
|
||||||
unsafe fn squirrel_away<T>(+x: @T) -> *rust_box<T> {
|
unsafe fn squirrel_away<T>(+x: @T) -> *rust_box<T> {
|
||||||
let y: *rust_box<T> = unsafe::reinterpret_cast(&x);
|
let y: *rust_box<T> = cast::reinterpret_cast(&x);
|
||||||
unsafe::forget(x);
|
cast::forget(x);
|
||||||
y
|
y
|
||||||
}
|
}
|
||||||
|
|
||||||
type rust_unique<T> = {payload: T};
|
type rust_unique<T> = {payload: T};
|
||||||
|
|
||||||
unsafe fn squirrel_away_unique<T>(+x: ~T) -> *rust_box<T> {
|
unsafe fn squirrel_away_unique<T>(+x: ~T) -> *rust_box<T> {
|
||||||
let y: *rust_box<T> = unsafe::reinterpret_cast(&x);
|
let y: *rust_box<T> = cast::reinterpret_cast(&x);
|
||||||
unsafe::forget(x);
|
cast::forget(x);
|
||||||
y
|
y
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ unsafe fn domstring_to_jsval(cx: *JSContext, str: DOMString) -> jsval {
|
||||||
}
|
}
|
||||||
str(s) => {
|
str(s) => {
|
||||||
str::as_buf(s, |buf, len| {
|
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))
|
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 {
|
fn get_compartment(cx: *JSContext) -> *bare_compartment {
|
||||||
unsafe {
|
unsafe {
|
||||||
let privptr: *libc::c_void = JS_GetContextPrivate(cx);
|
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;
|
assert cx == (*compartment).cx.ptr;
|
||||||
compartment
|
compartment
|
||||||
}
|
}
|
||||||
|
@ -94,8 +94,8 @@ extern fn has_instance(_cx: *JSContext, obj: **JSObject, v: *jsval, bp: *mut JSB
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prototype_jsclass(name: ~str) -> fn(bare_compartment) -> JSClass {
|
fn prototype_jsclass(name: ~str) -> fn(+bare_compartment) -> JSClass {
|
||||||
|compartment: bare_compartment, copy name| {
|
|+compartment: bare_compartment, copy name| {
|
||||||
{name: compartment.add_name(name),
|
{name: compartment.add_name(name),
|
||||||
flags: 0,
|
flags: 0,
|
||||||
addProperty: GetJSClassHookStubPointer(PROPERTY_STUB) as *u8,
|
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 instance_jsclass(name: ~str, finalize: *u8)
|
||||||
-> fn(bare_compartment) -> JSClass {
|
-> fn(+bare_compartment) -> JSClass {
|
||||||
|compartment: bare_compartment, copy name| {
|
|+compartment: bare_compartment, copy name| {
|
||||||
{name: compartment.add_name(name),
|
{name: compartment.add_name(name),
|
||||||
flags: JSCLASS_HAS_RESERVED_SLOTS(1),
|
flags: JSCLASS_HAS_RESERVED_SLOTS(1),
|
||||||
addProperty: GetJSClassHookStubPointer(PROPERTY_STUB) as *u8,
|
addProperty: GetJSClassHookStubPointer(PROPERTY_STUB) as *u8,
|
||||||
|
|
|
@ -72,14 +72,14 @@ extern fn setTimeout(cx: *JSContext, argc: c_uint, vp: *jsval) -> JSBool unsafe
|
||||||
|
|
||||||
unsafe fn unwrap(obj: *JSObject) -> *rust_box<Window> {
|
unsafe fn unwrap(obj: *JSObject) -> *rust_box<Window> {
|
||||||
let val = JS_GetReservedSlot(obj, 0);
|
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) {
|
extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {
|
||||||
#debug("finalize!");
|
#debug("finalize!");
|
||||||
unsafe {
|
unsafe {
|
||||||
let val = JS_GetReservedSlot(obj, 0);
|
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 {
|
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));
|
JS_SetReservedSlot(obj.ptr, 0, RUST_PRIVATE_TO_JSVAL(raw_ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ struct ScopeResource<T:Send,A> {
|
||||||
d : ScopeData<T,A>,
|
d : ScopeData<T,A>,
|
||||||
|
|
||||||
drop unsafe {
|
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> {
|
impl<T: Copy Send,A> Scope<T,A> {
|
||||||
fn clone(v: *T) -> *T unsafe {
|
fn clone(v: *T) -> *T unsafe {
|
||||||
let n: *mut T =
|
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
|
// 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
|
// everything is initialized to NULL by calloc will make this ok. We may have to make the
|
||||||
// take glue be tolerant of this.
|
// take glue be tolerant of this.
|
||||||
*n = unsafe{*v};
|
*n = unsafe{*v};
|
||||||
|
|
||||||
return unsafe::reinterpret_cast(&n);
|
return cast::reinterpret_cast(&n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn free<T:Send>(t: *T) {
|
unsafe fn free<T:Send>(t: *T) {
|
||||||
let _x <- *unsafe::reinterpret_cast::<*T,*mut T>(&t);
|
let _x <- *cast::reinterpret_cast::<*T,*mut T>(&t);
|
||||||
libc::free(unsafe::reinterpret_cast(&t));
|
libc::free(cast::reinterpret_cast(&t));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn free_handle<T:Send,A>(h: Handle<T,A>) {
|
unsafe fn free_handle<T:Send,A>(h: Handle<T,A>) {
|
||||||
free(h.read_ptr());
|
free(h.read_ptr());
|
||||||
if h.write_ptr() != unsafe::reinterpret_cast(&h.read_ptr()) {
|
if h.write_ptr() != cast::reinterpret_cast(&h.read_ptr()) {
|
||||||
free(unsafe::reinterpret_cast::<*mut T,*T>(&h.write_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() {
|
while (*handle).is_not_null() {
|
||||||
free(handle.read_ptr());
|
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();
|
let next_handle = handle.next_dirty();
|
||||||
handle.set_next_dirty(null_handle());
|
handle.set_next_dirty(null_handle());
|
||||||
handle = next_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);
|
let const_write_ptr = ptr::const_offset(h.write_ptr(), 0);
|
||||||
if self.d.layout_active && const_read_ptr == const_write_ptr {
|
if self.d.layout_active && const_read_ptr == const_write_ptr {
|
||||||
#debug["marking handle %? as dirty", h];
|
#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);
|
h.set_next_dirty(self.d.first_dirty);
|
||||||
self.d.first_dirty = h;
|
self.d.first_dirty = h;
|
||||||
}
|
}
|
||||||
|
@ -217,10 +217,10 @@ impl<T:Copy Send,A> Scope<T,A> {
|
||||||
#[allow(non_implicitly_copyable_typarams)]
|
#[allow(non_implicitly_copyable_typarams)]
|
||||||
fn handle(v: T) -> Handle<T,A> unsafe {
|
fn handle(v: T) -> Handle<T,A> unsafe {
|
||||||
let d: *HandleData<T,A> =
|
let d: *HandleData<T,A> =
|
||||||
unsafe::reinterpret_cast(
|
cast::reinterpret_cast(
|
||||||
&libc::malloc(sys::size_of::<HandleData<T,A>>() as size_t));
|
&libc::malloc(sys::size_of::<HandleData<T,A>>() as size_t));
|
||||||
(*d).read_ptr = self.clone(ptr::addr_of(v));
|
(*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).read_aux = ptr::null();
|
||||||
(*d).next_dirty = null_handle();
|
(*d).next_dirty = null_handle();
|
||||||
let h = _Handle(d);
|
let h = _Handle(d);
|
||||||
|
|
|
@ -90,8 +90,8 @@ trait DisplayListMethods {
|
||||||
impl DisplayList : DisplayListMethods {
|
impl DisplayList : DisplayListMethods {
|
||||||
fn draw(ctx: &RenderContext) {
|
fn draw(ctx: &RenderContext) {
|
||||||
for self.each |item| {
|
for self.each |item| {
|
||||||
debug!("drawing %?", item);
|
debug!("drawing %?", *item);
|
||||||
item.draw(item, ctx);
|
item.draw(*item, ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,15 +21,15 @@ impl au : Num {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl au : cmp::Ord {
|
impl au : cmp::Ord {
|
||||||
pure fn lt(&&other: au) -> bool { *self < *other }
|
pure fn lt(other: &au) -> bool { *self < **other }
|
||||||
pure fn le(&&other: au) -> bool { *self <= *other }
|
pure fn le(other: &au) -> bool { *self <= **other }
|
||||||
pure fn ge(&&other: au) -> bool { *self >= *other }
|
pure fn ge(other: &au) -> bool { *self >= **other }
|
||||||
pure fn gt(&&other: au) -> bool { *self > *other }
|
pure fn gt(other: &au) -> bool { *self > **other }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl au : cmp::Eq {
|
impl au : cmp::Eq {
|
||||||
pure fn eq(&&other: au) -> bool { *self == *other }
|
pure fn eq(other: &au) -> bool { *self == **other }
|
||||||
pure fn ne(&&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 } }
|
pure fn min(x: au, y: au) -> au { if x < y { x } else { y } }
|
||||||
|
|
|
@ -19,13 +19,14 @@ use compositor::Compositor;
|
||||||
use render_task::{RenderTask, RenderMsg};
|
use render_task::{RenderTask, RenderMsg};
|
||||||
use task::spawn_listener;
|
use task::spawn_listener;
|
||||||
use comm::{Chan, Port};
|
use comm::{Chan, Port};
|
||||||
use unsafe::reinterpret_cast;
|
use cast::reinterpret_cast;
|
||||||
use vec_from_buf = vec::raw::from_buf;
|
use vec_from_buf = vec::raw::from_buf;
|
||||||
use ptr::addr_of;
|
use ptr::addr_of;
|
||||||
use dom::event::Event;
|
use dom::event::Event;
|
||||||
use dvec::DVec;
|
use dvec::DVec;
|
||||||
use display_list::DisplayList;
|
use display_list::DisplayList;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
use core::io::BytesWriter;
|
||||||
|
|
||||||
pub type PngCompositor = Chan<Msg>;
|
pub type PngCompositor = Chan<Msg>;
|
||||||
|
|
||||||
|
@ -72,10 +73,9 @@ fn do_draw(sender: pipes::Chan<DrawTarget>,
|
||||||
+dt: DrawTarget,
|
+dt: DrawTarget,
|
||||||
output: Chan<~[u8]>,
|
output: Chan<~[u8]>,
|
||||||
cairo_surface: ImageSurface) {
|
cairo_surface: ImageSurface) {
|
||||||
let buffer = io::mem_buffer();
|
let buffer = BytesWriter();
|
||||||
cairo_surface.write_to_png_stream(&buffer);
|
cairo_surface.write_to_png_stream(&buffer);
|
||||||
let @{ buf: buffer, pos: _ } <- buffer;
|
output.send(buffer.buf.get());
|
||||||
output.send(dvec::unwrap(move buffer));
|
|
||||||
|
|
||||||
// Send the next draw target to the renderer
|
// Send the next draw target to the renderer
|
||||||
sender.send(move dt);
|
sender.send(move dt);
|
||||||
|
|
|
@ -6,12 +6,12 @@ enum format {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl format: cmp::Eq {
|
impl format: cmp::Eq {
|
||||||
pure fn eq(&&other: format) -> bool {
|
pure fn eq(other: &format) -> bool {
|
||||||
match (self, other) {
|
match (self, *other) {
|
||||||
(fo_rgba_8888, fo_rgba_8888) => true,
|
(fo_rgba_8888, fo_rgba_8888) => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pure fn ne(&&other: format) -> bool {
|
pure fn ne(other: &format) -> bool {
|
||||||
return !self.eq(other);
|
return !self.eq(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ use JSMessage = html::dom_builder::js_message;
|
||||||
|
|
||||||
use comm::{Chan, Port};
|
use comm::{Chan, Port};
|
||||||
use str::from_slice;
|
use str::from_slice;
|
||||||
use unsafe::reinterpret_cast;
|
use cast::reinterpret_cast;
|
||||||
use std::net::url::Url;
|
use std::net::url::Url;
|
||||||
|
|
||||||
type JSResult = ~[~[u8]];
|
type JSResult = ~[~[u8]];
|
||||||
|
|
|
@ -12,14 +12,14 @@ enum CharOrEof {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CharOrEof: cmp::Eq {
|
impl CharOrEof: cmp::Eq {
|
||||||
pure fn eq(&&other: CharOrEof) -> bool {
|
pure fn eq(other: &CharOrEof) -> bool {
|
||||||
match (self, other) {
|
match (self, *other) {
|
||||||
(CoeChar(a), CoeChar(b)) => a == b,
|
(CoeChar(a), CoeChar(b)) => a == b,
|
||||||
(CoeChar(*), _) | (_, CoeChar(*)) => false,
|
(CoeChar(*), _) | (_, CoeChar(*)) => false,
|
||||||
(CoeEof, CoeEof) => true,
|
(CoeEof, CoeEof) => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pure fn ne(&&other: CharOrEof) -> bool {
|
pure fn ne(other: &CharOrEof) -> bool {
|
||||||
return !self.eq(other);
|
return !self.eq(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,8 +137,8 @@ fn FlowContext(id: int, kind: FlowContextData, tree: tree::Tree<@FlowContext>) -
|
||||||
}
|
}
|
||||||
|
|
||||||
impl @FlowContext : cmp::Eq {
|
impl @FlowContext : cmp::Eq {
|
||||||
pure fn eq(&&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) }
|
pure fn ne(other: &@FlowContext) -> bool { !box::ptr_eq(self, *other) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ impl @RenderBox {
|
||||||
bounds.size.height = runs[i].size().height;
|
bounds.size.height = runs[i].size().height;
|
||||||
let glyph_run = make_glyph_run(&runs[i]);
|
let glyph_run = make_glyph_run(&runs[i]);
|
||||||
list.push(~dl::Glyphs(bounds, glyph_run));
|
list.push(~dl::Glyphs(bounds, glyph_run));
|
||||||
bounds.origin.y += bounds.size.height;
|
bounds.origin.y = bounds.origin.y.add(bounds.size.height);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -94,8 +94,8 @@ impl @FlowContext : BlockLayout {
|
||||||
/* if not an anonymous block context, add in block box's widths.
|
/* if not an anonymous block context, add in block box's widths.
|
||||||
these widths will not include child elements, just padding etc. */
|
these widths will not include child elements, just padding etc. */
|
||||||
do self.with_block_box |box| {
|
do self.with_block_box |box| {
|
||||||
min_width += box.get_min_width();
|
min_width = min_width.add(box.get_min_width());
|
||||||
pref_width += box.get_pref_width();
|
pref_width = pref_width.add(box.get_pref_width());
|
||||||
}
|
}
|
||||||
|
|
||||||
self.data.min_width = min_width;
|
self.data.min_width = min_width;
|
||||||
|
@ -121,7 +121,7 @@ impl @FlowContext : BlockLayout {
|
||||||
do self.with_block_box |box| {
|
do self.with_block_box |box| {
|
||||||
box.data.position.size.width = remaining_width;
|
box.data.position.size.width = remaining_width;
|
||||||
let (left_used, right_used) = box.get_used_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| {
|
for FlowTree.each_child(self) |child_ctx| {
|
||||||
|
@ -138,7 +138,7 @@ impl @FlowContext : BlockLayout {
|
||||||
|
|
||||||
for FlowTree.each_child(self) |child_ctx| {
|
for FlowTree.each_child(self) |child_ctx| {
|
||||||
child_ctx.data.position.origin.y = cur_y;
|
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;
|
self.data.position.size.height = cur_y;
|
||||||
|
|
|
@ -111,7 +111,7 @@ impl LayoutTreeBuilder {
|
||||||
debug!("Adding child box b%? of b%?", parent_box.id, new_box.id);
|
debug!("Adding child box b%? of b%?", parent_box.id, new_box.id);
|
||||||
RenderBoxTree.add_child(parent_box, new_box);
|
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);
|
debug!("Adding child flow f%? of f%?", parent_ctx.id, next_ctx.id);
|
||||||
FlowTree.add_child(parent_ctx, next_ctx);
|
FlowTree.add_child(parent_ctx, next_ctx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ impl @FlowContext : InlineLayout {
|
||||||
};
|
};
|
||||||
|
|
||||||
box.data.position.origin = Point2D(au(0), cur_y);
|
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|
|
} // for boxes.each |box|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,13 @@ type shared_box<T> = {
|
||||||
|
|
||||||
#[doc="Transform and @ into its underlying representation. The reference count stays constant."]
|
#[doc="Transform and @ into its underlying representation. The reference count stays constant."]
|
||||||
fn unwrap_box(-b : @RenderBox) -> *shared_box<RenderBox> unsafe {
|
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;
|
return new_box;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc="Transform an underlying representation back to an @. The reference count stays constant."]
|
#[doc="Transform an underlying representation back to an @. The reference count stays constant."]
|
||||||
fn rewrap_box(-b : *shared_box<RenderBox>) -> @RenderBox unsafe {
|
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;
|
return new_box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ pub enum ImageResponseMsg {
|
||||||
impl ImageResponseMsg {
|
impl ImageResponseMsg {
|
||||||
pure fn clone() -> ImageResponseMsg {
|
pure fn clone() -> ImageResponseMsg {
|
||||||
match self {
|
match self {
|
||||||
ImageReady(img) => ImageReady(unchecked { clone_arc(&img) }),
|
ImageReady(img) => ImageReady(unsafe { clone_arc(&img) }),
|
||||||
ImageNotReady => ImageNotReady,
|
ImageNotReady => ImageNotReady,
|
||||||
ImageFailed => ImageFailed
|
ImageFailed => ImageFailed
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ impl ImageResponseMsg {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ImageResponseMsg: cmp::Eq {
|
impl ImageResponseMsg: cmp::Eq {
|
||||||
pure fn eq(&&other: ImageResponseMsg) -> bool {
|
pure fn eq(other: &ImageResponseMsg) -> bool {
|
||||||
// FIXME: Bad copies
|
// FIXME: Bad copies
|
||||||
match (self.clone(), other.clone()) {
|
match (self.clone(), other.clone()) {
|
||||||
(ImageReady(*), ImageReady(*)) => fail ~"unimplemented comparison",
|
(ImageReady(*), ImageReady(*)) => fail ~"unimplemented comparison",
|
||||||
|
@ -73,7 +73,7 @@ impl ImageResponseMsg: cmp::Eq {
|
||||||
| (ImageFailed, _) => false
|
| (ImageFailed, _) => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pure fn ne(&&other: ImageResponseMsg) -> bool {
|
pure fn ne(other: &ImageResponseMsg) -> bool {
|
||||||
return !self.eq(other);
|
return !self.eq(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ impl ImageCache {
|
||||||
loop {
|
loop {
|
||||||
let msg = self.from_client.recv();
|
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);
|
#debug("image_cache_task: received: %?", msg);
|
||||||
|
|
||||||
|
@ -1093,4 +1093,4 @@ fn sync_cache_should_wait_for_images() {
|
||||||
|
|
||||||
image_cache_task.exit();
|
image_cache_task.exit();
|
||||||
mock_resource_task.send(resource_task::Exit);
|
mock_resource_task.send(resource_task::Exit);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,8 @@ enum ProgressMsg {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ProgressMsg: cmp::Eq {
|
impl ProgressMsg: cmp::Eq {
|
||||||
pure fn eq(&&other: ProgressMsg) -> bool {
|
pure fn eq(other: &ProgressMsg) -> bool {
|
||||||
match (copy self, copy other) {
|
match (copy self, copy *other) {
|
||||||
(Payload(a), Payload(b)) => a == b,
|
(Payload(a), Payload(b)) => a == b,
|
||||||
(Done(a), Done(b)) => a == b,
|
(Done(a), Done(b)) => a == b,
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ impl ProgressMsg: cmp::Eq {
|
||||||
| (Done(*), _) => false
|
| (Done(*), _) => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pure fn ne(&&other: ProgressMsg) -> bool {
|
pure fn ne(other: &ProgressMsg) -> bool {
|
||||||
return !self.eq(other);
|
return !self.eq(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ impl ResourceManager {
|
||||||
|
|
||||||
fn get_loader_factory(url: Url) -> Option<LoaderTaskFactory> {
|
fn get_loader_factory(url: Url) -> Option<LoaderTaskFactory> {
|
||||||
for self.loaders.each |scheme_loader| {
|
for self.loaders.each |scheme_loader| {
|
||||||
let (scheme, loader_factory) = copy scheme_loader;
|
let (scheme, loader_factory) = copy *scheme_loader;
|
||||||
if scheme == url.scheme {
|
if scheme == url.scheme {
|
||||||
return Some(loader_factory);
|
return Some(loader_factory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#[license = "MPL"];
|
#[license = "MPL"];
|
||||||
#[crate_type = "lib"];
|
#[crate_type = "lib"];
|
||||||
|
|
||||||
|
#[legacy_modes];
|
||||||
|
|
||||||
extern mod std;
|
extern mod std;
|
||||||
extern mod azure;
|
extern mod azure;
|
||||||
extern mod js;
|
extern mod js;
|
||||||
|
|
|
@ -41,7 +41,7 @@ fn run_pipeline_screen(urls: ~[~str]) {
|
||||||
let mut engine_task = Some(EngineTask(osmain));
|
let mut engine_task = Some(EngineTask(osmain));
|
||||||
|
|
||||||
for urls.each |filename| {
|
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)];
|
#debug["master: Sending url `%s`", url_to_str(copy url)];
|
||||||
engine_task =
|
engine_task =
|
||||||
Some(EngineProto::client::LoadURL(swap_unwrap(&mut engine_task),
|
Some(EngineProto::client::LoadURL(swap_unwrap(&mut engine_task),
|
||||||
|
|
|
@ -2,7 +2,7 @@ export FreeTypeNativeFont, with_test_native_font, create;
|
||||||
|
|
||||||
use vec_as_buf = vec::as_imm_buf;
|
use vec_as_buf = vec::as_imm_buf;
|
||||||
use ptr::{addr_of, null};
|
use ptr::{addr_of, null};
|
||||||
use unsafe::reinterpret_cast;
|
use cast::reinterpret_cast;
|
||||||
use glyph::GlyphIndex;
|
use glyph::GlyphIndex;
|
||||||
use font::FontMetrics;
|
use font::FontMetrics;
|
||||||
use azure::freetype;
|
use azure::freetype;
|
||||||
|
|
|
@ -17,7 +17,7 @@ use cocoa::cg::cg::{
|
||||||
CGFontCreateWithDataProvider,
|
CGFontCreateWithDataProvider,
|
||||||
CGFontRelease
|
CGFontRelease
|
||||||
};
|
};
|
||||||
use unsafe::transmute;
|
use cast::transmute;
|
||||||
use coretext::CTFontRef;
|
use coretext::CTFontRef;
|
||||||
use coretext::coretext::CFRelease;
|
use coretext::coretext::CFRelease;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ use gfx::geometry::au;
|
||||||
use geom::point::Point2D;
|
use geom::point::Point2D;
|
||||||
use font_cache::FontCache;
|
use font_cache::FontCache;
|
||||||
|
|
||||||
use unsafe::reinterpret_cast;
|
use cast::reinterpret_cast;
|
||||||
use harfbuzz::{HB_MEMORY_MODE_READONLY,
|
use harfbuzz::{HB_MEMORY_MODE_READONLY,
|
||||||
HB_DIRECTION_LTR};
|
HB_DIRECTION_LTR};
|
||||||
use harfbuzz::{hb_blob_t, hb_face_t, hb_font_t, hb_buffer_t,
|
use harfbuzz::{hb_blob_t, hb_face_t, hb_font_t, hb_buffer_t,
|
||||||
|
|
|
@ -12,11 +12,11 @@ use cmp::Eq;
|
||||||
enum Color = {red : u8, green : u8, blue : u8, alpha : float};
|
enum Color = {red : u8, green : u8, blue : u8, alpha : float};
|
||||||
|
|
||||||
impl Color : Eq {
|
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 &&
|
return self.red == other.red && self.green == other.green && self.blue == other.blue &&
|
||||||
self.alpha == other.alpha;
|
self.alpha == other.alpha;
|
||||||
}
|
}
|
||||||
pure fn ne(&&other: Color) -> bool {
|
pure fn ne(other: &Color) -> bool {
|
||||||
!self.eq(other)
|
!self.eq(other)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue