зеркало из https://github.com/mozilla/gecko-dev.git
servo: Update for languages changes. Build still busted
Source-Repo: https://github.com/servo/servo Source-Revision: 259ba8ce9332ae1b36e59cf90d598a83e6086ad9
This commit is contained in:
Родитель
25dc44b25c
Коммит
1c1a978669
|
@ -69,7 +69,7 @@ class ScopeResource<T:send,A> {
|
||||||
self.d = d;
|
self.d = d;
|
||||||
}
|
}
|
||||||
drop unsafe {
|
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> {
|
impl WriterMethods<T:copy send,A> for Scope<T,A> {
|
||||||
fn is_reader_forked() -> bool {
|
fn is_reader_forked() -> bool {
|
||||||
self.layout_active
|
self.d.layout_active
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reader_forked() {
|
fn reader_forked() {
|
||||||
assert !self.layout_active;
|
assert !self.d.layout_active;
|
||||||
assert self.first_dirty.is_null();
|
assert self.d.first_dirty.is_null();
|
||||||
self.layout_active = true;
|
self.d.layout_active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reader_joined() unsafe {
|
fn reader_joined() unsafe {
|
||||||
assert self.layout_active;
|
assert self.d.layout_active;
|
||||||
|
|
||||||
if self.first_dirty.is_not_null() {
|
if self.d.first_dirty.is_not_null() {
|
||||||
let mut handle = self.first_dirty;
|
let mut handle = self.d.first_dirty;
|
||||||
while (*handle).is_not_null() {
|
while (*handle).is_not_null() {
|
||||||
free(handle.read_ptr());
|
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.set_next_dirty(null_handle());
|
||||||
handle = next_handle;
|
handle = next_handle;
|
||||||
}
|
}
|
||||||
self.first_dirty = null_handle();
|
self.d.first_dirty = null_handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
assert self.first_dirty.is_null();
|
assert self.d.first_dirty.is_null();
|
||||||
self.layout_active = false;
|
self.d.layout_active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read<U>(h: Handle<T,A>, f: fn(T) -> U) -> U unsafe {
|
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 {
|
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];
|
#debug["marking handle %? as dirty", h];
|
||||||
h.set_write_ptr(unsafe::reinterpret_cast(self.clone(h.read_ptr())));
|
h.set_write_ptr(unsafe::reinterpret_cast(self.clone(h.read_ptr())));
|
||||||
h.set_next_dirty(self.first_dirty);
|
h.set_next_dirty(self.d.first_dirty);
|
||||||
self.first_dirty = h;
|
self.d.first_dirty = h;
|
||||||
}
|
}
|
||||||
f(*h.write_ptr())
|
f(*h.write_ptr())
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ impl WriterMethods<T:copy send,A> for Scope<T,A> {
|
||||||
(*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);
|
||||||
self.free_list += [h];
|
self.d.free_list += [h];
|
||||||
ret h;
|
ret h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ impl text_layout_methods for @Box {
|
||||||
// FIXME: The font library should not be initialized here
|
// FIXME: The font library should not be initialized here
|
||||||
let flib = FontLibrary();
|
let flib = FontLibrary();
|
||||||
let font = flib.get_test_font();
|
let font = flib.get_test_font();
|
||||||
let run = TextRun(font, subbox.text);
|
let run = TextRun(*font, subbox.text);
|
||||||
self.bounds.size = run.size();
|
self.bounds.size = run.size();
|
||||||
subbox.run = some(run);
|
subbox.run = some(run);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
#[license = "MPL"];
|
#[license = "MPL"];
|
||||||
#[crate_type = "lib"];
|
#[crate_type = "lib"];
|
||||||
|
|
||||||
#[warn(no_oldvecs)];
|
|
||||||
|
|
||||||
use std;
|
use std;
|
||||||
use sdl;
|
use sdl;
|
||||||
use azure;
|
use azure;
|
||||||
|
|
|
@ -23,34 +23,24 @@ import azure::cairo::bindgen::{
|
||||||
|
|
||||||
// FIXME (rust 2708): convert this to a class
|
// FIXME (rust 2708): convert this to a class
|
||||||
|
|
||||||
type Font = FontDtor;
|
|
||||||
|
|
||||||
#[doc = "
|
#[doc = "
|
||||||
A font handle. Layout can use this to calculate glyph metrics
|
A font handle. Layout can use this to calculate glyph metrics
|
||||||
and the renderer can use it to render text.
|
and the renderer can use it to render text.
|
||||||
"]
|
"]
|
||||||
resource FontDtor(state: FontState) {
|
class Font {
|
||||||
state.font_dtor();
|
let fontbuf: @[u8];
|
||||||
}
|
let cairo_font: *cairo_scaled_font_t;
|
||||||
|
let font_dtor: fn@();
|
||||||
|
|
||||||
type FontState = {
|
new(-fontbuf: [u8]) {
|
||||||
fontbuf: @[u8],
|
|
||||||
cairo_font: *cairo_scaled_font_t,
|
|
||||||
font_dtor: fn@()
|
|
||||||
};
|
|
||||||
|
|
||||||
fn Font(-fontbuf: [u8]) -> Font {
|
|
||||||
let (cairo_font, font_dtor) = get_cairo_font(© fontbuf);
|
let (cairo_font, font_dtor) = get_cairo_font(© fontbuf);
|
||||||
assert cairo_font.is_not_null();
|
assert cairo_font.is_not_null();
|
||||||
|
|
||||||
ret FontDtor({
|
self.fontbuf = @fontbuf;
|
||||||
fontbuf: @fontbuf,
|
self.cairo_font = cairo_font;
|
||||||
cairo_font: cairo_font,
|
self.font_dtor = font_dtor;
|
||||||
font_dtor: font_dtor
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Font for Font {
|
|
||||||
fn buf() -> @[u8] {
|
fn buf() -> @[u8] {
|
||||||
self.fontbuf
|
self.fontbuf
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ import shaper::shape_text;
|
||||||
class TextRun {
|
class TextRun {
|
||||||
let glyphs: [Glyph];
|
let glyphs: [Glyph];
|
||||||
|
|
||||||
new(font: &Font, text: str) {
|
new(font: Font, text: str) {
|
||||||
self.glyphs = shape_text(font, text);
|
self.glyphs = shape_text(&font, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn size() -> Size2D<au> {
|
fn size() -> Size2D<au> {
|
||||||
|
@ -34,7 +34,7 @@ fn should_calculate_the_total_size() {
|
||||||
|
|
||||||
let flib = FontLibrary();
|
let flib = FontLibrary();
|
||||||
let font = flib.get_test_font();
|
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));
|
let expected = Size2D(px_to_au(84), px_to_au(20));
|
||||||
assert run.size() == expected;
|
assert run.size() == expected;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче