servo: Update for languages changes. Build still busted

Source-Repo: https://github.com/servo/servo
Source-Revision: 259ba8ce9332ae1b36e59cf90d598a83e6086ad9
This commit is contained in:
Brian Anderson 2012-06-27 12:09:38 -07:00
Родитель 25dc44b25c
Коммит 1c1a978669
5 изменённых файлов: 30 добавлений и 42 удалений

Просмотреть файл

@ -69,7 +69,7 @@ class ScopeResource<T:send,A> {
self.d = d;
}
drop unsafe {
for d.free_list.each { |h| free_handle(h); }
for self.d.free_list.each { |h| free_handle(h); }
}
}
@ -165,20 +165,20 @@ fn Scope<T:send,A>() -> Scope<T,A> {
impl WriterMethods<T:copy send,A> for Scope<T,A> {
fn is_reader_forked() -> bool {
self.layout_active
self.d.layout_active
}
fn reader_forked() {
assert !self.layout_active;
assert self.first_dirty.is_null();
self.layout_active = true;
assert !self.d.layout_active;
assert self.d.first_dirty.is_null();
self.d.layout_active = true;
}
fn reader_joined() unsafe {
assert self.layout_active;
assert self.d.layout_active;
if self.first_dirty.is_not_null() {
let mut handle = self.first_dirty;
if self.d.first_dirty.is_not_null() {
let mut handle = self.d.first_dirty;
while (*handle).is_not_null() {
free(handle.read_ptr());
@ -187,11 +187,11 @@ impl WriterMethods<T:copy send,A> for Scope<T,A> {
handle.set_next_dirty(null_handle());
handle = next_handle;
}
self.first_dirty = null_handle();
self.d.first_dirty = null_handle();
}
assert self.first_dirty.is_null();
self.layout_active = false;
assert self.d.first_dirty.is_null();
self.d.layout_active = false;
}
fn read<U>(h: Handle<T,A>, f: fn(T) -> U) -> U unsafe {
@ -200,11 +200,11 @@ impl WriterMethods<T:copy send,A> for Scope<T,A> {
}
fn write<U>(h: Handle<T,A>, f: fn(T) -> U) -> U unsafe {
if self.layout_active && h.read_ptr() == h.write_ptr() {
if self.d.layout_active && h.read_ptr() == h.write_ptr() {
#debug["marking handle %? as dirty", h];
h.set_write_ptr(unsafe::reinterpret_cast(self.clone(h.read_ptr())));
h.set_next_dirty(self.first_dirty);
self.first_dirty = h;
h.set_next_dirty(self.d.first_dirty);
self.d.first_dirty = h;
}
f(*h.write_ptr())
}
@ -219,7 +219,7 @@ impl WriterMethods<T:copy send,A> for Scope<T,A> {
(*d).read_aux = ptr::null();
(*d).next_dirty = null_handle();
let h = _Handle(d);
self.free_list += [h];
self.d.free_list += [h];
ret h;
}
}

Просмотреть файл

@ -27,7 +27,7 @@ impl text_layout_methods for @Box {
// FIXME: The font library should not be initialized here
let flib = FontLibrary();
let font = flib.get_test_font();
let run = TextRun(font, subbox.text);
let run = TextRun(*font, subbox.text);
self.bounds.size = run.size();
subbox.run = some(run);
}

Просмотреть файл

@ -7,8 +7,6 @@
#[license = "MPL"];
#[crate_type = "lib"];
#[warn(no_oldvecs)];
use std;
use sdl;
use azure;

Просмотреть файл

@ -23,34 +23,24 @@ import azure::cairo::bindgen::{
// FIXME (rust 2708): convert this to a class
type Font = FontDtor;
#[doc = "
A font handle. Layout can use this to calculate glyph metrics
and the renderer can use it to render text.
"]
resource FontDtor(state: FontState) {
state.font_dtor();
}
class Font {
let fontbuf: @[u8];
let cairo_font: *cairo_scaled_font_t;
let font_dtor: fn@();
type FontState = {
fontbuf: @[u8],
cairo_font: *cairo_scaled_font_t,
font_dtor: fn@()
};
new(-fontbuf: [u8]) {
let (cairo_font, font_dtor) = get_cairo_font(&copy fontbuf);
assert cairo_font.is_not_null();
fn Font(-fontbuf: [u8]) -> Font {
let (cairo_font, font_dtor) = get_cairo_font(&copy fontbuf);
assert cairo_font.is_not_null();
self.fontbuf = @fontbuf;
self.cairo_font = cairo_font;
self.font_dtor = font_dtor;
}
ret FontDtor({
fontbuf: @fontbuf,
cairo_font: cairo_font,
font_dtor: font_dtor
});
}
impl Font for Font {
fn buf() -> @[u8] {
self.fontbuf
}

Просмотреть файл

@ -11,8 +11,8 @@ import shaper::shape_text;
class TextRun {
let glyphs: [Glyph];
new(font: &Font, text: str) {
self.glyphs = shape_text(font, text);
new(font: Font, text: str) {
self.glyphs = shape_text(&font, text);
}
fn size() -> Size2D<au> {
@ -34,7 +34,7 @@ fn should_calculate_the_total_size() {
let flib = FontLibrary();
let font = flib.get_test_font();
let run = TextRun(font, "firecracker");
let run = TextRun(*font, "firecracker");
let expected = Size2D(px_to_au(84), px_to_au(20));
assert run.size() == expected;
}