Update for language changes

This commit is contained in:
Patrick Walton 2012-12-13 18:43:26 -08:00
parent 136c3a6b9f
commit 8fd5bd516f
50 changed files with 264 additions and 259 deletions

@ -1 +1 @@
Subproject commit 4a5c9889f8d4354deec3becbeb80f6b51ad7e583 Subproject commit 37389b82bd5608b05b66edce7a4cce92c7edb3c6

@ -1 +1 @@
Subproject commit 536b7641da5aab88cbb554d35548c408feed1829 Subproject commit 4fa6613be800afb715b1be304274e074426475b4

@ -1 +1 @@
Subproject commit 8366d38b751fa1952ebe85c531c5249d3439a339 Subproject commit e4afef45bb91bf78589b3f02f4ee0411f85d86c5

@ -1 +1 @@
Subproject commit c413a96a8c6b70815b4d5ad7469c7983af417728 Subproject commit fb1ea4368fd766239bd3578d66c4218fa46f1e5e

@ -1 +1 @@
Subproject commit 87af01643fa7e5cd06a3fb58d66b387046303f9a Subproject commit e777e17f054be294792a097d5aaa7a1f56f018bc

@ -1 +1 @@
Subproject commit c5b2028f812195e9509523ad7e269b36266b1d7a Subproject commit 105bc09e7d5988a5d8601d69efc5a22b73d634a4

@ -1 +1 @@
Subproject commit f521dd6f94ba3ed92930116e16fb26fe63baa2ac Subproject commit fda5dc9644e1eba2dbf4d1023ee3b6c6eda43b62

@ -1 +1 @@
Subproject commit 1bc7ce1f009afb308d170e6456e41de6570c3731 Subproject commit c14e24d51502ffaa44ccde9877920ba829be1bd0

@ -1 +1 @@
Subproject commit db00f7d1feb0ff2ad2989d98ff152702d4638c04 Subproject commit ab8f9db13f401eeeff5a08e2955bc6964a7c06e0

@ -1 +1 @@
Subproject commit 0e0d487a2be12b881d83fcf1c2680d00a020282d Subproject commit caecddcc50418adbed686f6bd33e4c1d9ea5efeb

@ -1 +1 @@
Subproject commit 7f392d636b1e0d34871f1c66adf0d7d8b39b4c7e Subproject commit fb5f5a5660f4b3af536b5dc314f7ebd059c0e291

@ -1 +1 @@
Subproject commit 5cde7b87ad4168a13d89077b2670c0e156cf4b0a Subproject commit 915654c60779a41ff7e419153a2f3d00a2d37416

View file

@ -43,20 +43,20 @@ impl DisplayItem {
} }
fn draw_into_context(&self, ctx: &RenderContext) { fn draw_into_context(&self, ctx: &RenderContext) {
match *self { match self {
SolidColor(_, color) => ctx.draw_solid_color(&self.d().bounds, color), &SolidColor(_, color) => ctx.draw_solid_color(&self.d().bounds, color),
Text(_, run, ref range, color) => { &Text(_, run, ref range, color) => {
let new_run = @run.deserialize(ctx.font_ctx); let new_run = @run.deserialize(ctx.font_ctx);
let font = new_run.font; let font = new_run.font;
let origin = self.d().bounds.origin; let origin = self.d().bounds.origin;
let baseline_origin = Point2D(origin.x, origin.y + font.metrics.ascent); let baseline_origin = Point2D(origin.x, origin.y + font.metrics.ascent);
font.draw_text_into_context(ctx, new_run, range, baseline_origin, color); font.draw_text_into_context(ctx, new_run, range, baseline_origin, color);
}, },
Image(_, ref img) => { &Image(_, ref img) => {
debug!("drawing image at %?", self.d().bounds); debug!("drawing image at %?", self.d().bounds);
ctx.draw_image(self.d().bounds, clone_arc(img)); ctx.draw_image(self.d().bounds, clone_arc(img));
} }
Border(_, width, color) => ctx.draw_border(&self.d().bounds, width, color), &Border(_, width, color) => ctx.draw_border(&self.d().bounds, width, color),
} }
debug!("%?", { debug!("%?", {

View file

@ -11,7 +11,7 @@ use core::send_map::linear::LinearMap;
use core::send_map::linear; use core::send_map::linear;
// TODO(Issue #164): delete, and get default font from font list // TODO(Issue #164): delete, and get default font from font list
const TEST_FONT: [u8 * 33004] = #include_bin("JosefinSans-SemiBold.ttf"); const TEST_FONT: [u8 * 33004] = include_bin!("JosefinSans-SemiBold.ttf");
fn test_font_bin() -> ~[u8] { fn test_font_bin() -> ~[u8] {
return vec::from_fn(33004, |i| TEST_FONT[i]); return vec::from_fn(33004, |i| TEST_FONT[i]);
@ -170,12 +170,12 @@ pub impl FontContext {
} }
priv fn create_font_instance(desc: &FontDescriptor) -> Result<@Font, ()> { priv fn create_font_instance(desc: &FontDescriptor) -> Result<@Font, ()> {
return match desc.selector { return match &desc.selector {
SelectorStubDummy => { &SelectorStubDummy => {
Font::new_from_buffer(&self, test_font_bin(), &desc.style, self.backend) Font::new_from_buffer(&self, test_font_bin(), &desc.style, self.backend)
}, },
// TODO(Issue #174): implement by-platform-name font selectors. // TODO(Issue #174): implement by-platform-name font selectors.
SelectorPlatformIdentifier(identifier) => { &SelectorPlatformIdentifier(identifier) => {
let result_handle = self.handle.create_font_from_identifier(copy identifier, copy desc.style); let result_handle = self.handle.create_font_from_identifier(copy identifier, copy desc.style);
result::chain(move result_handle, |handle| { result::chain(move result_handle, |handle| {
Ok(Font::new_from_adopted_handle(&self, move handle, &desc.style, self.backend)) Ok(Font::new_from_adopted_handle(&self, move handle, &desc.style, self.backend))

View file

@ -9,7 +9,7 @@ pub fn Image(width: uint, height: uint, depth: uint, data: ~[u8]) -> Image {
stb_image::new_image(width, height, depth, move data) stb_image::new_image(width, height, depth, move data)
} }
const TEST_IMAGE: [u8 * 4962] = #include_bin("test.jpeg"); const TEST_IMAGE: [u8 * 4962] = include_bin!("test.jpeg");
pub fn test_image_bin() -> ~[u8] { pub fn test_image_bin() -> ~[u8] {
return vec::from_fn(4962, |i| TEST_IMAGE[i]); return vec::from_fn(4962, |i| TEST_IMAGE[i]);

View file

@ -2,27 +2,20 @@ extern mod core_foundation;
extern mod core_graphics; extern mod core_graphics;
extern mod core_text; extern mod core_text;
use cf = core_foundation; use quartz::font::core_foundation::base::{CFIndex, CFTypeRef, CFWrapper};
use cf::base::{ use quartz::font::core_foundation::data::{CFData, CFDataRef};
CFIndex, use quartz::font::core_foundation::string::UniChar;
CFTypeRef,
CFWrapper,
};
use cf::data::{CFData, CFDataRef};
use cf::string::UniChar;
use cg = core_graphics;
use cg::base::{CGFloat, CGAffineTransform}; use quartz::font::core_graphics::base::{CGFloat, CGAffineTransform};
use cg::data_provider::{CGDataProviderRef, CGDataProvider}; use quartz::font::core_graphics::data_provider::{CGDataProviderRef, CGDataProvider};
use cg::font::{CGFont, CGFontRef, CGGlyph}; use quartz::font::core_graphics::font::{CGFont, CGFontRef, CGGlyph};
use cg::geometry::CGRect; use quartz::font::core_graphics::geometry::CGRect;
use ct = core_text; use quartz::font::core_text::font::CTFont;
use ct::font::CTFont; use quartz::font::core_text::font_descriptor::{kCTFontDefaultOrientation, CTFontSymbolicTraits};
use ct::font_descriptor::{kCTFontDefaultOrientation, CTFontSymbolicTraits}; use quartz::font::core_text::font_descriptor::{SymbolicTraitAccessors};
use ct::font_descriptor::{SymbolicTraitAccessors};
use font_context::QuartzFontContextHandle; use quartz::font_context::QuartzFontContextHandle;
use geometry::Au; use geometry::Au;
use gfx_font::{ use gfx_font::{
CSSFontWeight, CSSFontWeight,
@ -76,11 +69,11 @@ pub impl QuartzFontHandle {
static fn new_from_buffer(_fctx: &QuartzFontContextHandle, buf: ~[u8], static fn new_from_buffer(_fctx: &QuartzFontContextHandle, buf: ~[u8],
style: &SpecifiedFontStyle) -> Result<QuartzFontHandle, ()> { style: &SpecifiedFontStyle) -> Result<QuartzFontHandle, ()> {
let fontprov : CGDataProvider = vec::as_imm_buf(buf, |cbuf, len| { let fontprov : CGDataProvider = vec::as_imm_buf(buf, |cbuf, len| {
cg::data_provider::new_from_buffer(cbuf, len) quartz::font::core_graphics::data_provider::new_from_buffer(cbuf, len)
}); });
let cgfont = cg::font::create_with_data_provider(&fontprov); let cgfont = quartz::font::core_graphics::font::create_with_data_provider(&fontprov);
let ctfont = ct::font::new_from_CGFont(&cgfont, style.pt_size); let ctfont = quartz::font::core_text::font::new_from_CGFont(&cgfont, style.pt_size);
let result = Ok(QuartzFontHandle { let result = Ok(QuartzFontHandle {
cgfont : Some(move cgfont), cgfont : Some(move cgfont),

View file

@ -2,11 +2,10 @@ extern mod core_foundation;
extern mod core_graphics; extern mod core_graphics;
extern mod core_text; extern mod core_text;
use ct = core_text; use quartz::font::QuartzFontHandle;
use ct::font::CTFont; use quartz::font_context::core_text::font::CTFont;
use gfx_font::{FontHandle, UsedFontStyle}; use gfx_font::{FontHandle, UsedFontStyle};
use font::QuartzFontHandle;
use gfx_font_context::FontContextHandleMethods; use gfx_font_context::FontContextHandleMethods;
pub struct QuartzFontContextHandle { pub struct QuartzFontContextHandle {
@ -28,9 +27,10 @@ pub impl QuartzFontContextHandle : FontContextHandleMethods {
} }
fn create_font_from_identifier(name: ~str, style: UsedFontStyle) -> Result<FontHandle, ()> { fn create_font_from_identifier(name: ~str, style: UsedFontStyle) -> Result<FontHandle, ()> {
let ctfont_result = ct::font::new_from_name(move name, style.pt_size); let ctfont_result = quartz::font_context::core_text::font::new_from_name(move name,
style.pt_size);
do result::chain(move ctfont_result) |ctfont| { do result::chain(move ctfont_result) |ctfont| {
QuartzFontHandle::new_from_CTFont(&self, move ctfont) QuartzFontHandle::new_from_CTFont(&self, move ctfont)
} }
} }
} }

View file

@ -1,15 +1,14 @@
extern mod core_foundation; extern mod core_foundation;
extern mod core_text; extern mod core_text;
use cf = core_foundation; use quartz::font_list::core_foundation::array::CFArray;
use cf::array::CFArray; use quartz::font_list::core_foundation::base::CFWrapper;
use cf::base::CFWrapper; use quartz::font_list::core_foundation::string::{CFString, CFStringRef};
use cf::string::{CFString, CFStringRef};
use ct = core_text; use quartz::font_list::core_text::font::{CTFont, debug_font_names, debug_font_traits};
use ct::font::{CTFont, debug_font_names, debug_font_traits}; use quartz::font_list::core_text::font_collection::CTFontCollection;
use ct::font_collection::CTFontCollection; use quartz::font_list::core_text::font_descriptor::{CTFontDescriptor, CTFontDescriptorRef};
use ct::font_descriptor::{CTFontDescriptor, CTFontDescriptorRef, debug_descriptor}; use quartz::font_list::core_text::font_descriptor::{debug_descriptor};
use quartz::font::QuartzFontHandle; use quartz::font::QuartzFontHandle;
use quartz::font_context::QuartzFontContextHandle; use quartz::font_context::QuartzFontContextHandle;
@ -29,7 +28,7 @@ pub impl QuartzFontListHandle {
} }
fn get_available_families() -> FontFamilyMap { fn get_available_families() -> FontFamilyMap {
let family_names = ct::font_collection::get_family_names(); let family_names = quartz::font_list::core_text::font_collection::get_family_names();
let mut family_map : FontFamilyMap = linear::LinearMap(); let mut family_map : FontFamilyMap = linear::LinearMap();
for family_names.each |strref: &CFStringRef| { for family_names.each |strref: &CFStringRef| {
let family_name = CFWrapper::wrap_shared(*strref).to_str(); let family_name = CFWrapper::wrap_shared(*strref).to_str();
@ -45,10 +44,11 @@ pub impl QuartzFontListHandle {
let family_name = &family.family_name; let family_name = &family.family_name;
debug!("Looking for faces of family: %s", *family_name); debug!("Looking for faces of family: %s", *family_name);
let family_collection = ct::font_collection::create_for_family(*family_name); let family_collection =
quartz::font_list::core_text::font_collection::create_for_family(*family_name);
for family_collection.get_descriptors().each |descref: &CTFontDescriptorRef| { for family_collection.get_descriptors().each |descref: &CTFontDescriptorRef| {
let desc = CFWrapper::wrap_shared(*descref); let desc = CFWrapper::wrap_shared(*descref);
let font = ct::font::new_from_descriptor(&desc, 0.0); let font = quartz::font_list::core_text::font::new_from_descriptor(&desc, 0.0);
let handle = result::unwrap(QuartzFontHandle::new_from_CTFont(&self.fctx, move font)); let handle = result::unwrap(QuartzFontHandle::new_from_CTFont(&self.fctx, move font));
debug!("Creating new FontEntry for face: %s", handle.face_name()); debug!("Creating new FontEntry for face: %s", handle.face_name());

View file

@ -111,7 +111,7 @@ pub fn render_layers(layer_ref: *RenderLayer,
//} //}
// Create a port and channel pair to receive the new buffer. // Create a port and channel pair to receive the new buffer.
let (new_buffer_chan, new_buffer_port) = pipes::stream(); let (new_buffer_port, new_buffer_chan) = pipes::stream();
// Send the buffer to the child. // Send the buffer to the child.
f(layer_ref, move buffer, move new_buffer_chan); f(layer_ref, move buffer, move new_buffer_chan);

View file

@ -23,11 +23,11 @@ pub enum Msg {
pub type RenderTask = comm::Chan<Msg>; pub type RenderTask = comm::Chan<Msg>;
pub fn RenderTask<C: Compositor Send>(compositor: C, opts: Opts) -> RenderTask { pub fn RenderTask<C: Compositor Owned>(compositor: C, opts: Opts) -> RenderTask {
let compositor_cell = Cell(move compositor); let compositor_cell = Cell(move compositor);
let opts_cell = Cell(move opts); let opts_cell = Cell(move opts);
do task::spawn_listener |po: comm::Port<Msg>, move compositor_cell, move opts_cell| { do task::spawn_listener |po: comm::Port<Msg>, move compositor_cell, move opts_cell| {
let (layer_buffer_channel, layer_buffer_set_port) = pipes::stream(); let (layer_buffer_set_port, layer_buffer_channel) = pipes::stream();
let compositor = compositor_cell.take(); let compositor = compositor_cell.take();
compositor.begin_drawing(move layer_buffer_channel); compositor.begin_drawing(move layer_buffer_channel);
@ -67,7 +67,7 @@ priv struct ThreadRenderContext {
opts: Opts, opts: Opts,
} }
priv struct Renderer<C: Compositor Send> { priv struct Renderer<C: Compositor Owned> {
port: comm::Port<Msg>, port: comm::Port<Msg>,
compositor: C, compositor: C,
layer_buffer_set_port: Cell<pipes::Port<LayerBufferSet>>, layer_buffer_set_port: Cell<pipes::Port<LayerBufferSet>>,
@ -75,7 +75,7 @@ priv struct Renderer<C: Compositor Send> {
opts: Opts, opts: Opts,
} }
impl<C: Compositor Send> Renderer<C> { impl<C: Compositor Owned> Renderer<C> {
fn start() { fn start() {
debug!("renderer: beginning rendering loop"); debug!("renderer: beginning rendering loop");
@ -100,7 +100,7 @@ impl<C: Compositor Send> Renderer<C> {
} }
let layer_buffer_set = layer_buffer_set_port.recv(); let layer_buffer_set = layer_buffer_set_port.recv();
let (layer_buffer_set_channel, new_layer_buffer_set_port) = pipes::stream(); let (new_layer_buffer_set_port, layer_buffer_set_channel) = pipes::stream();
self.layer_buffer_set_port.put_back(move new_layer_buffer_set_port); self.layer_buffer_set_port.put_back(move new_layer_buffer_set_port);
let layer_buffer_set_cell = Cell(move layer_buffer_set); let layer_buffer_set_cell = Cell(move layer_buffer_set);

View file

@ -2,7 +2,7 @@ export factory;
use comm::Chan; use comm::Chan;
use task::spawn; use task::spawn;
use resource_task::{ProgressMsg, Payload, Done}; use resource::resource_task::{ProgressMsg, Payload, Done};
use std::net::url::Url; use std::net::url::Url;
use io::{file_reader, ReaderUtil}; use io::{file_reader, ReaderUtil};

View file

@ -2,7 +2,7 @@ export factory;
use comm::Chan; use comm::Chan;
use task::spawn; use task::spawn;
use resource_task::{ProgressMsg, Payload, Done}; use resource::resource_task::{ProgressMsg, Payload, Done};
use std::net::url::Url; use std::net::url::Url;
use http_client::{uv_http_request}; use http_client::{uv_http_request};

View file

@ -1,6 +1,6 @@
use image::base::{Image, load_from_memory, test_image_bin}; use image::base::{Image, load_from_memory, test_image_bin};
use resource::resource_task; use resource::resource_task;
use resource_task::ResourceTask; use resource::resource_task::ResourceTask;
use util::url::{make_url, UrlMap, url_map}; use util::url::{make_url, UrlMap, url_map};
use clone_arc = std::arc::clone; use clone_arc = std::arc::clone;
@ -49,10 +49,10 @@ pub enum ImageResponseMsg {
impl ImageResponseMsg { impl ImageResponseMsg {
pure fn clone() -> ImageResponseMsg { pure fn clone() -> ImageResponseMsg {
match self { match &self {
ImageReady(img) => ImageReady(unsafe { clone_arc(&img) }), &ImageReady(img) => ImageReady(unsafe { clone_arc(&img) }),
ImageNotReady => ImageNotReady, &ImageNotReady => ImageNotReady,
ImageFailed => ImageFailed &ImageFailed => ImageFailed
} }
} }
} }
@ -89,7 +89,7 @@ pub fn ImageCacheTask_(resource_task: ResourceTask, decoder_factory: DecoderFact
// copy unsoundly // copy unsoundly
let decoder_factory_cell = Cell(move decoder_factory); let decoder_factory_cell = Cell(move decoder_factory);
let (chan, port) = stream(); let (port, chan) = stream();
let chan = SharedChan(move chan); let chan = SharedChan(move chan);
let port_cell = Cell(move port); let port_cell = Cell(move port);
let chan_cell = Cell(chan.clone()); let chan_cell = Cell(chan.clone());
@ -110,7 +110,7 @@ pub fn ImageCacheTask_(resource_task: ResourceTask, decoder_factory: DecoderFact
} }
fn SyncImageCacheTask(resource_task: ResourceTask) -> ImageCacheTask { fn SyncImageCacheTask(resource_task: ResourceTask) -> ImageCacheTask {
let (chan, port) = stream(); let (port, chan) = stream();
let port_cell = Cell(move port); let port_cell = Cell(move port);
do spawn |move port_cell, move resource_task| { do spawn |move port_cell, move resource_task| {
@ -451,7 +451,7 @@ trait ImageCacheTaskClient {
impl ImageCacheTask: ImageCacheTaskClient { impl ImageCacheTask: ImageCacheTaskClient {
fn exit() { fn exit() {
let (response_chan, response_port) = stream(); let (response_port, response_chan) = stream();
self.send(Exit(move response_chan)); self.send(Exit(move response_chan));
response_port.recv(); response_port.recv();
} }

View file

@ -7,7 +7,8 @@ multiple times and thus triggering reflows multiple times.
use clone_arc = std::arc::clone; use clone_arc = std::arc::clone;
use std::net::url::Url; use std::net::url::Url;
use pipes::{Port, Chan, stream}; use pipes::{Port, Chan, stream};
use image_cache_task::{ImageCacheTask, ImageResponseMsg, Prefetch, Decode, GetImage, WaitForImage, ImageReady, ImageNotReady, ImageFailed}; use resource::image_cache_task::{ImageCacheTask, ImageResponseMsg, Prefetch, Decode, GetImage};
use resource::image_cache_task::{ WaitForImage, ImageReady, ImageNotReady, ImageFailed};
use util::url::{UrlMap, url_map}; use util::url::{UrlMap, url_map};
pub fn LocalImageCache(image_cache_task: ImageCacheTask) -> LocalImageCache { pub fn LocalImageCache(image_cache_task: ImageCacheTask) -> LocalImageCache {
@ -72,14 +73,14 @@ pub impl LocalImageCache {
ImageReady(ref image) => { ImageReady(ref image) => {
// FIXME: appease borrowck // FIXME: appease borrowck
unsafe { unsafe {
let (chan, port) = pipes::stream(); let (port, chan) = pipes::stream();
chan.send(ImageReady(clone_arc(image))); chan.send(ImageReady(clone_arc(image)));
return move port; return move port;
} }
} }
ImageNotReady => { ImageNotReady => {
if last_round == self.round_number { if last_round == self.round_number {
let (chan, port) = pipes::stream(); let (port, chan) = pipes::stream();
chan.send(ImageNotReady); chan.send(ImageNotReady);
return move port; return move port;
} else { } else {
@ -88,13 +89,13 @@ pub impl LocalImageCache {
} }
} }
ImageFailed => { ImageFailed => {
let (chan, port) = pipes::stream(); let (port, chan) = pipes::stream();
chan.send(ImageFailed); chan.send(ImageFailed);
return move port; return move port;
} }
} }
let (response_chan, response_port) = pipes::stream(); let (response_port, response_chan) = pipes::stream();
self.image_cache_task.send(GetImage(copy *url, move response_chan)); self.image_cache_task.send(GetImage(copy *url, move response_chan));
let response = response_port.recv(); let response = response_port.recv();
@ -110,7 +111,7 @@ pub impl LocalImageCache {
let on_image_available = self.on_image_available.get()(); let on_image_available = self.on_image_available.get()();
let url = copy *url; let url = copy *url;
do task::spawn |move url, move on_image_available, move image_cache_task| { do task::spawn |move url, move on_image_available, move image_cache_task| {
let (response_chan, response_port) = pipes::stream(); let (response_port, response_chan) = pipes::stream();
image_cache_task.send(WaitForImage(copy url, move response_chan)); image_cache_task.send(WaitForImage(copy url, move response_chan));
on_image_available(response_port.recv()); on_image_available(response_port.recv());
} }
@ -126,7 +127,7 @@ pub impl LocalImageCache {
}; };
state.last_response = move response_copy; state.last_response = move response_copy;
let (chan, port) = pipes::stream(); let (port, chan) = pipes::stream();
chan.send(move response); chan.send(move response);
return move port; return move port;
} }

View file

@ -1,5 +1,4 @@
use au = geometry; use geometry::Au;
use au::Au;
use servo_gfx_util::range::Range; use servo_gfx_util::range::Range;
use servo_gfx_util::vec::*; use servo_gfx_util::vec::*;
@ -443,7 +442,7 @@ pub pure fn GlyphData(index: GlyphIndex,
ligature_start: bool) -> GlyphData { ligature_start: bool) -> GlyphData {
let _offset = match offset { let _offset = match offset {
None => au::zero_point(), None => geometry::zero_point(),
Some(o) => o Some(o) => o
}; };
@ -532,7 +531,7 @@ pub impl GlyphStore {
pure fn glyph_is_compressible(data: &GlyphData) -> bool { pure fn glyph_is_compressible(data: &GlyphData) -> bool {
is_simple_glyph_id(data.index) is_simple_glyph_id(data.index)
&& is_simple_advance(data.advance) && is_simple_advance(data.advance)
&& data.offset == au::zero_point() && data.offset == geometry::zero_point()
&& data.cluster_start // others are stored in detail buffer && data.cluster_start // others are stored in detail buffer
} }

View file

@ -2,20 +2,15 @@ extern mod harfbuzz;
use geom::Point2D; use geom::Point2D;
use au = geometry; use geometry::Au;
use au::Au;
use font::{ use font::{Font, FontTable, FontTableTag};
Font,
FontTable,
FontTableTag,
};
use glyph::{GlyphStore, GlyphIndex, GlyphData}; use text::glyph::{GlyphStore, GlyphIndex, GlyphData};
use text::shaper::ShaperMethods; use text::shaper::ShaperMethods;
use servo_util::range; use servo_util::range;
use range::Range; use util::range::Range;
use core::libc::types::common::c99::int32_t; use core::libc::types::common::c99::int32_t;
use core::libc::{c_uint, c_int, c_void, c_char}; use core::libc::{c_uint, c_int, c_void, c_char};
@ -23,36 +18,48 @@ use core::util::ignore;
use dvec::DVec; use dvec::DVec;
use std::arc; use std::arc;
use harfbuzz::{HB_MEMORY_MODE_READONLY, HB_DIRECTION_LTR, hb_blob_t, hb_face_t, hb_font_t}; use text::harfbuzz::shaper::harfbuzz::{HB_MEMORY_MODE_READONLY, HB_DIRECTION_LTR, hb_blob_t};
use harfbuzz::{hb_font_funcs_t, hb_buffer_t, hb_codepoint_t, hb_bool_t, hb_glyph_position_t}; use text::harfbuzz::shaper::harfbuzz::{hb_face_t, hb_font_t};
use harfbuzz::{hb_glyph_info_t, hb_var_int_t, hb_position_t}; use text::harfbuzz::shaper::harfbuzz::{hb_font_funcs_t, hb_buffer_t, hb_codepoint_t, hb_bool_t};
use harfbuzz::bindgen::{hb_blob_create, hb_blob_destroy, hb_face_create, hb_face_destroy}; use text::harfbuzz::shaper::harfbuzz::{hb_glyph_position_t};
use harfbuzz::bindgen::{hb_font_create, hb_font_destroy, hb_buffer_create, hb_buffer_destroy}; use text::harfbuzz::shaper::harfbuzz::{hb_glyph_info_t, hb_var_int_t, hb_position_t};
use harfbuzz::bindgen::{hb_buffer_add_utf8, hb_shape, hb_buffer_get_glyph_infos}; use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_blob_create, hb_blob_destroy};
use harfbuzz::bindgen::{hb_buffer_get_glyph_positions, hb_font_set_ppem, hb_font_set_scale}; use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_face_create, hb_face_destroy};
use harfbuzz::bindgen::{hb_buffer_set_direction, hb_font_funcs_create, hb_font_funcs_destroy}; use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_font_create, hb_font_destroy};
use harfbuzz::bindgen::{hb_font_set_funcs, hb_font_funcs_set_glyph_h_advance_func}; use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_buffer_create};
use harfbuzz::bindgen::{hb_font_funcs_set_glyph_func, hb_font_funcs_set_glyph_h_kerning_func}; use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_buffer_destroy};
use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_buffer_add_utf8, hb_shape};
use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_buffer_get_glyph_infos};
use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_buffer_get_glyph_positions};
use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_font_set_ppem};
use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_font_set_scale};
use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_buffer_set_direction};
use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_font_funcs_create};
use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_font_funcs_destroy};
use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_font_set_funcs};
use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_font_funcs_set_glyph_h_advance_func};
use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_font_funcs_set_glyph_func};
use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_font_funcs_set_glyph_h_kerning_func};
use harfbuzz::{HB_MEMORY_MODE_READONLY, use text::harfbuzz::shaper::harfbuzz::{HB_MEMORY_MODE_READONLY, HB_DIRECTION_LTR};
HB_DIRECTION_LTR}; use text::harfbuzz::shaper::harfbuzz::{hb_blob_t, hb_face_t, hb_font_t, hb_font_funcs_t};
use harfbuzz::{hb_blob_t, hb_face_t, hb_font_t, hb_font_funcs_t, hb_buffer_t, use text::harfbuzz::shaper::harfbuzz::{hb_buffer_t, hb_codepoint_t, hb_bool_t};
hb_codepoint_t, hb_bool_t, hb_glyph_position_t, use text::harfbuzz::shaper::harfbuzz::{hb_glyph_position_t, hb_glyph_info_t, hb_var_int_t};
hb_glyph_info_t, hb_var_int_t, hb_position_t, hb_tag_t}; use text::harfbuzz::shaper::harfbuzz::{hb_position_t, hb_tag_t};
use harfbuzz::bindgen::{hb_blob_create, hb_blob_destroy, use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_blob_create, hb_blob_destroy,
hb_face_create_for_tables, hb_face_destroy, hb_face_create_for_tables, hb_face_destroy,
hb_font_create, hb_font_destroy, hb_font_create, hb_font_destroy,
hb_buffer_create, hb_buffer_destroy, hb_buffer_create, hb_buffer_destroy,
hb_buffer_add_utf8, hb_shape, hb_buffer_add_utf8, hb_shape,
hb_buffer_get_glyph_infos, hb_buffer_get_glyph_infos,
hb_buffer_get_glyph_positions, hb_buffer_get_glyph_positions,
hb_font_set_ppem, hb_font_set_scale, hb_font_set_ppem, hb_font_set_scale,
hb_buffer_set_direction, hb_buffer_set_direction,
hb_font_funcs_create, hb_font_funcs_destroy, hb_font_funcs_create, hb_font_funcs_destroy,
hb_font_set_funcs, hb_font_set_funcs,
hb_font_funcs_set_glyph_h_advance_func, hb_font_funcs_set_glyph_h_advance_func,
hb_font_funcs_set_glyph_func, hb_font_funcs_set_glyph_func,
hb_font_funcs_set_glyph_h_kerning_func}; hb_font_funcs_set_glyph_h_kerning_func};
pub struct ShapedGlyphData { pub struct ShapedGlyphData {
count: uint, count: uint,

View file

@ -4,9 +4,9 @@
Note that you still must define each of the files as a module in Note that you still must define each of the files as a module in
servo.rc. This is not ideal and may be changed in the future. */ servo.rc. This is not ideal and may be changed in the future. */
pub use shaper::Shaper; pub use text::shaper::Shaper;
pub use text_run::TextRun; pub use text::text_run::TextRun;
pub use text_run::SendableTextRun; pub use text::text_run::SendableTextRun;
pub mod glyph; pub mod glyph;
pub mod text_run; pub mod text_run;

View file

@ -1,9 +1,6 @@
use font_context::FontContext; use font_context::FontContext;
use geometry::Au; use geometry::Au;
use glyph::{ use text::glyph::{BreakTypeNormal, GlyphStore};
BreakTypeNormal,
GlyphStore,
};
use servo_gfx_font::{Font, FontDescriptor, RunMetrics}; use servo_gfx_font::{Font, FontDescriptor, RunMetrics};
use servo_gfx_util::range::Range; use servo_gfx_util::range::Range;
@ -16,7 +13,7 @@ use std::arc::ARC;
pub struct TextRun { pub struct TextRun {
text: ~str, text: ~str,
font: @Font, font: @Font,
priv glyphs: GlyphStore, glyphs: GlyphStore,
} }
// This is a hack until TextRuns are normally sendable, or // This is a hack until TextRuns are normally sendable, or

View file

@ -54,7 +54,7 @@ pub fn ContentTask(layout_task: LayoutTask,
resource_task: ResourceTask, resource_task: ResourceTask,
img_cache_task: ImageCacheTask) -> ContentTask { img_cache_task: ImageCacheTask) -> ContentTask {
let (control_chan, control_port) = pipes::stream(); let (control_port, control_chan) = pipes::stream();
let control_chan = pipes::SharedChan(move control_chan); let control_chan = pipes::SharedChan(move control_chan);
let control_chan_copy = control_chan.clone(); let control_chan_copy = control_chan.clone();
@ -301,7 +301,7 @@ impl Content {
self.join_layout(); self.join_layout();
// Layout will let us know when it's done // Layout will let us know when it's done
let (join_chan, join_port) = pipes::stream(); let (join_port, join_chan) = pipes::stream();
self.layout_join_port = move Some(move join_port); self.layout_join_port = move Some(move join_port);
// Send new document and relevant styles to layout // Send new document and relevant styles to layout

View file

@ -6,7 +6,7 @@ use dom::node::{Node, NodeTree};
use newcss::select::{SelectCtx, SelectResults}; use newcss::select::{SelectCtx, SelectResults};
use newcss::complete::CompleteSelectResults; use newcss::complete::CompleteSelectResults;
use layout::context::LayoutContext; use layout::context::LayoutContext;
use select_handler::NodeSelectHandler; use css::select_handler::NodeSelectHandler;
trait MatchMethods { trait MatchMethods {
fn restyle_subtree(select_ctx: &SelectCtx); fn restyle_subtree(select_ctx: &SelectCtx);
@ -65,4 +65,4 @@ fn find_parent_element_node(node: &Node) -> Option<Node> {
} }
None => None None => None
} }
} }

View file

@ -4,7 +4,7 @@ use dom::node::Node;
// FIXME: Rust #3908. rust-css can't reexport VoidPtrLike // FIXME: Rust #3908. rust-css can't reexport VoidPtrLike
extern mod netsurfcss; extern mod netsurfcss;
use netsurfcss::util::VoidPtrLike; use css::node_void_ptr::netsurfcss::util::VoidPtrLike;
impl Node: VoidPtrLike { impl Node: VoidPtrLike {
static fn from_void_ptr(node: *libc::c_void) -> Node { static fn from_void_ptr(node: *libc::c_void) -> Node {

View file

@ -10,8 +10,8 @@ use js::glue::{PROPERTY_STUB, STRICT_PROPERTY_STUB};
use js::crust::{JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ConvertStub, JS_ResolveStub}; use js::crust::{JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ConvertStub, JS_ResolveStub};
use ptr::null; use ptr::null;
use libc::c_uint; use libc::c_uint;
use utils::{DOMString, domstring_to_jsval, rust_box, squirrel_away, str}; use dom::bindings::utils::{DOMString, domstring_to_jsval, rust_box, squirrel_away, str};
use bindings::node::create; use dom::bindings::node::create;
use dom::document::Document; use dom::document::Document;

View file

@ -1,5 +1,3 @@
use au = gfx::geometry;
use au::au;
use js::rust::{bare_compartment, methods, jsobj}; use js::rust::{bare_compartment, methods, jsobj};
use js::{JS_ARGV, JSCLASS_HAS_RESERVED_SLOTS, JSPROP_ENUMERATE, JSPROP_SHARED, JSVAL_NULL, use js::{JS_ARGV, JSCLASS_HAS_RESERVED_SLOTS, JSPROP_ENUMERATE, JSPROP_SHARED, JSVAL_NULL,
JS_THIS_OBJECT, JS_SET_RVAL, JSPROP_NATIVE_ACCESSORS}; JS_THIS_OBJECT, JS_SET_RVAL, JSPROP_NATIVE_ACCESSORS};
@ -15,11 +13,12 @@ use content::content_task::{Content, task_from_context};
use layout::layout_task; use layout::layout_task;
use dom::node::{Node, NodeScope, Element}; use dom::node::{Node, NodeScope, Element};
use dom::element::*; use dom::element::*;
use node::NodeBundle; use dom::bindings::node::NodeBundle;
use utils::{rust_box, squirrel_away_unique, get_compartment, domstring_to_jsval, str}; use dom::bindings::utils::{rust_box, squirrel_away_unique, get_compartment, domstring_to_jsval};
use dom::bindings::utils::{str};
use libc::c_uint; use libc::c_uint;
use ptr::null; use ptr::null;
use node::unwrap; use dom::bindings::node::unwrap;
extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) { extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {

View file

@ -10,7 +10,8 @@ use js::jsapi::bindgen::*;
use js::glue::bindgen::*; use js::glue::bindgen::*;
use dom::node::{Node, NodeScope, Text, Doctype, Comment, Element}; use dom::node::{Node, NodeScope, Text, Doctype, Comment, Element};
use utils::{rust_box, squirrel_away_unique, get_compartment, domstring_to_jsval, str}; use dom::bindings::utils::{rust_box, squirrel_away_unique, get_compartment, domstring_to_jsval};
use dom::bindings::utils::{str};
use libc::c_uint; use libc::c_uint;
use ptr::null; use ptr::null;

View file

@ -56,11 +56,11 @@ pub fn jsval_to_str(cx: *JSContext, v: JSVal) -> Result<~str, ()> {
} }
pub unsafe fn domstring_to_jsval(cx: *JSContext, string: &DOMString) -> JSVal { pub unsafe fn domstring_to_jsval(cx: *JSContext, string: &DOMString) -> JSVal {
match *string { match string {
null_string => { &null_string => {
JSVAL_NULL JSVAL_NULL
} }
str(s) => { &str(s) => {
str::as_buf(s, |buf, len| { str::as_buf(s, |buf, len| {
let cbuf = cast::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))

View file

@ -11,11 +11,11 @@ use js::crust::{JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_Con
use js::glue::bindgen::RUST_JSVAL_TO_INT; use js::glue::bindgen::RUST_JSVAL_TO_INT;
use ptr::null; use ptr::null;
use libc::c_uint; use libc::c_uint;
use utils::{rust_box, squirrel_away, jsval_to_str}; use dom::bindings::utils::{rust_box, squirrel_away, jsval_to_str};
use bindings::node::create; use dom::bindings::node::create;
use dom::window::{Window, TimerMessage_Fire}; use dom::window::{Window, TimerMessage_Fire};
use dom::node::Node; use dom::node::Node;
use dvec::DVec; use core::dvec::DVec;
extern fn alert(cx: *JSContext, argc: c_uint, vp: *JSVal) -> JSBool { extern fn alert(cx: *JSContext, argc: c_uint, vp: *JSVal) -> JSBool {
unsafe { unsafe {

View file

@ -63,13 +63,13 @@ use core::libc::types::os::arch::c95::size_t;
use ptr::Ptr; use ptr::Ptr;
use vec::push; use vec::push;
type ScopeData<T:Send,A> = { type ScopeData<T,A> = {
mut layout_active: bool, mut layout_active: bool,
mut free_list: ~[Handle<T,A>], mut free_list: ~[Handle<T,A>],
mut first_dirty: Handle<T,A> mut first_dirty: Handle<T,A>
}; };
struct ScopeResource<T:Send,A> { struct ScopeResource<T,A> {
d : ScopeData<T,A>, d : ScopeData<T,A>,
drop unsafe { drop unsafe {
@ -77,22 +77,22 @@ struct ScopeResource<T:Send,A> {
} }
} }
fn ScopeResource<T:Send,A>(d : ScopeData<T,A>) -> ScopeResource<T,A> { fn ScopeResource<T:Owned,A>(d : ScopeData<T,A>) -> ScopeResource<T,A> {
ScopeResource { d: move d } ScopeResource { d: move d }
} }
pub type Scope<T:Send,A> = @ScopeResource<T,A>; pub type Scope<T,A> = @ScopeResource<T,A>;
type HandleData<T:Send,A> = {mut read_ptr: *T, type HandleData<T,A> = {mut read_ptr: *T,
mut write_ptr: *mut T, mut write_ptr: *mut T,
mut read_aux: *A, mut read_aux: *A,
mut next_dirty: Handle<T,A>}; mut next_dirty: Handle<T,A>};
pub enum Handle<T:Send,A> { pub enum Handle<T,A> {
_Handle(*HandleData<T,A>) _Handle(*HandleData<T,A>)
} }
// Private methods // Private methods
impl<T:Send,A> Handle<T,A> { impl<T,A> Handle<T,A> {
fn read_ptr() -> *T unsafe { (**self).read_ptr } fn read_ptr() -> *T unsafe { (**self).read_ptr }
fn write_ptr() -> *mut T unsafe { (**self).write_ptr } fn write_ptr() -> *mut T unsafe { (**self).write_ptr }
fn read_aux() -> *A unsafe { (**self).read_aux } fn read_aux() -> *A unsafe { (**self).read_aux }
@ -107,7 +107,7 @@ impl<T:Send,A> Handle<T,A> {
fn is_not_null() -> bool { (*self).is_not_null() } fn is_not_null() -> bool { (*self).is_not_null() }
} }
impl<T:Send,A> Handle<T,A> { impl<T:Owned,A> Handle<T,A> {
/// Access the reader's view of the handle's data /// Access the reader's view of the handle's data
fn read<U>(f: fn(&T) -> U) -> U unsafe { fn read<U>(f: fn(&T) -> U) -> U unsafe {
f(&*self.read_ptr()) f(&*self.read_ptr())
@ -133,13 +133,13 @@ impl<T:Send,A> Handle<T,A> {
} }
} }
impl <T: Send,A> Handle<T,A> : cmp::Eq { impl <T: Owned,A> Handle<T,A> : cmp::Eq {
pure fn eq(&self, other: &Handle<T,A>) -> bool { **self == **other } pure fn eq(&self, other: &Handle<T,A>) -> bool { **self == **other }
pure fn ne(&self, other: &Handle<T,A>) -> bool { **self != **other } pure fn ne(&self, other: &Handle<T,A>) -> bool { **self != **other }
} }
// Private methods // Private methods
impl<T: Copy Send,A> Scope<T,A> { impl<T: Copy Owned,A> Scope<T,A> {
fn clone(v: *T) -> *T unsafe { fn clone(v: *T) -> *T unsafe {
let n: *mut T = let n: *mut T =
cast::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));
@ -153,38 +153,38 @@ impl<T: Copy Send,A> Scope<T,A> {
} }
} }
unsafe fn free<T:Send>(t: *T) { unsafe fn free<T>(t: *T) {
let _x = move *cast::reinterpret_cast::<*T,*mut T>(&t); let _x = move *cast::reinterpret_cast::<*T,*mut T>(&t);
libc::free(cast::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,A>(h: Handle<T,A>) {
free(h.read_ptr()); free(h.read_ptr());
if h.write_ptr() != cast::reinterpret_cast(&h.read_ptr()) { if h.write_ptr() != cast::reinterpret_cast(&h.read_ptr()) {
free(cast::reinterpret_cast::<*mut T,*T>(&h.write_ptr())); free(cast::reinterpret_cast::<*mut T,*T>(&h.write_ptr()));
} }
} }
pub unsafe fn unwrap<T:Send, A>(handle: Handle<T,A>) -> *HandleData<T,A> { pub unsafe fn unwrap<T:Owned, A>(handle: Handle<T,A>) -> *HandleData<T,A> {
*handle *handle
} }
pub unsafe fn wrap<T:Send, A>(data: *HandleData<T,A>) -> Handle<T,A> { pub unsafe fn wrap<T:Owned, A>(data: *HandleData<T,A>) -> Handle<T,A> {
_Handle(data) _Handle(data)
} }
fn null_handle<T:Send,A>() -> Handle<T,A> { fn null_handle<T:Owned,A>() -> Handle<T,A> {
_Handle(ptr::null()) _Handle(ptr::null())
} }
pub fn Scope<T:Send,A>() -> Scope<T,A> { pub fn Scope<T:Owned,A>() -> Scope<T,A> {
@ScopeResource({mut layout_active: false, @ScopeResource({mut layout_active: false,
mut free_list: ~[], mut free_list: ~[],
mut first_dirty: null_handle()}) mut first_dirty: null_handle()})
} }
// Writer methods // Writer methods
impl<T:Copy Send,A> Scope<T,A> { impl<T:Copy Owned,A> Scope<T,A> {
fn is_reader_forked() -> bool { fn is_reader_forked() -> bool {
self.d.layout_active self.d.layout_active
} }

View file

@ -1,6 +1,4 @@
use au = gfx::geometry; use core::dvec::DVec;
use au::au;
use dvec::DVec;
use geom::size::Size2D; use geom::size::Size2D;
use std::net::url::Url; use std::net::url::Url;

View file

@ -45,7 +45,7 @@ pub fn TimerData(argc: libc::c_uint, argv: *JSVal) -> TimerData unsafe {
impl Window { impl Window {
fn alert(s: &str) { fn alert(s: &str) {
// Right now, just print to the console // Right now, just print to the console
io::println(#fmt("ALERT: %s", s)); io::println(fmt!("ALERT: %s", s));
} }
fn close() { fn close() {

View file

@ -2,7 +2,7 @@ use content::content_task::{ContentTask, ExecuteMsg, ParseMsg, ExitMsg};
use content::content_task; use content::content_task;
use dom::event::Event; use dom::event::Event;
use layout::layout_task; use layout::layout_task;
use layout_task::LayoutTask; use layout::layout_task::LayoutTask;
use resource::image_cache_task::{ImageCacheTask, ImageCacheTaskClient}; use resource::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
use resource::resource_task::ResourceTask; use resource::resource_task::ResourceTask;
use resource::resource_task; use resource::resource_task;
@ -23,7 +23,7 @@ pub enum Msg {
ExitMsg(Chan<()>) ExitMsg(Chan<()>)
} }
pub struct Engine<C:Compositor Send Copy> { pub struct Engine<C:Compositor Owned Copy> {
request_port: comm::Port<Msg>, request_port: comm::Port<Msg>,
compositor: C, compositor: C,
render_task: RenderTask, render_task: RenderTask,
@ -33,12 +33,12 @@ pub struct Engine<C:Compositor Send Copy> {
content_task: ContentTask content_task: ContentTask
} }
pub fn Engine<C:Compositor Send Copy>(compositor: C, pub fn Engine<C:Compositor Owned Copy>(compositor: C,
opts: &Opts, opts: &Opts,
dom_event_port: pipes::Port<Event>, dom_event_port: pipes::Port<Event>,
dom_event_chan: pipes::SharedChan<Event>, dom_event_chan: pipes::SharedChan<Event>,
resource_task: ResourceTask, resource_task: ResourceTask,
image_cache_task: ImageCacheTask) -> EngineTask { image_cache_task: ImageCacheTask) -> EngineTask {
let dom_event_port = Cell(move dom_event_port); let dom_event_port = Cell(move dom_event_port);
let dom_event_chan = Cell(move dom_event_chan); let dom_event_chan = Cell(move dom_event_chan);
@ -64,7 +64,7 @@ pub fn Engine<C:Compositor Send Copy>(compositor: C,
} }
} }
impl<C: Compositor Copy Send> Engine<C> { impl<C: Compositor Copy Owned> Engine<C> {
fn run() { fn run() {
while self.handle_request(self.request_port.recv()) { while self.handle_request(self.request_port.recv()) {
// Go on... // Go on...
@ -86,7 +86,7 @@ impl<C: Compositor Copy Send> Engine<C> {
self.content_task.send(content_task::ExitMsg); self.content_task.send(content_task::ExitMsg);
self.layout_task.send(layout_task::ExitMsg); self.layout_task.send(layout_task::ExitMsg);
let (response_chan, response_port) = pipes::stream(); let (response_port, response_chan) = pipes::stream();
self.render_task.send(render_task::ExitMsg(move response_chan)); self.render_task.send(render_task::ExitMsg(move response_chan));
response_port.recv(); response_port.recv();

View file

@ -9,9 +9,9 @@ use resource::image_cache_task;
use resource::resource_task::{Done, Load, Payload, ResourceTask}; use resource::resource_task::{Done, Load, Payload, ResourceTask};
use core::comm::{Chan, Port}; use core::comm::{Chan, Port};
use cssparse::{InlineProvenance, StylesheetProvenance, UrlProvenance, spawn_css_parser}; use html::cssparse::{InlineProvenance, StylesheetProvenance, UrlProvenance, spawn_css_parser};
use hubbub::hubbub::Attribute;
use hubbub::hubbub; use hubbub::hubbub;
use hubbub::Attribute;
use newcss::stylesheet::Stylesheet; use newcss::stylesheet::Stylesheet;
use std::net::url::Url; use std::net::url::Url;
use std::net::url; use std::net::url;
@ -220,13 +220,13 @@ pub fn parse_html(scope: NodeScope,
debug!("create doctype"); debug!("create doctype");
// TODO: remove copying here by using struct pattern matching to // TODO: remove copying here by using struct pattern matching to
// move all ~strs at once (blocked on Rust #3845, #3846, #3847) // move all ~strs at once (blocked on Rust #3845, #3846, #3847)
let public_id = match doctype.public_id { let public_id = match &doctype.public_id {
None => None, &None => None,
Some(id) => Some(copy id) &Some(id) => Some(copy id)
}; };
let system_id = match doctype.system_id { let system_id = match &doctype.system_id {
None => None, &None => None,
Some(id) => Some(copy id) &Some(id) => Some(copy id)
}; };
let data = DoctypeData(copy doctype.name, move public_id, move system_id, let data = DoctypeData(copy doctype.name, move public_id, move system_id,
copy doctype.force_quirks); copy doctype.force_quirks);

View file

@ -140,8 +140,8 @@ impl RenderBox {
} }
pure fn is_whitespace_only() -> bool { pure fn is_whitespace_only() -> bool {
match self { match &self {
UnscannedTextBox(_, raw_text) => raw_text.is_whitespace(), &UnscannedTextBox(_, raw_text) => raw_text.is_whitespace(),
_ => false _ => false
} }
} }
@ -235,30 +235,30 @@ impl RenderBox {
* holder.get_image() * holder.get_image()
*/ */
fn get_min_width(_ctx: &LayoutContext) -> Au { fn get_min_width(_ctx: &LayoutContext) -> Au {
match self { match &self {
// TODO: this should account for min/pref widths of the // TODO: this should account for min/pref widths of the
// box element in isolation. That includes // box element in isolation. That includes
// border/margin/padding but not child widths. The block // border/margin/padding but not child widths. The block
// FlowContext will combine the width of this element and // FlowContext will combine the width of this element and
// that of its children to arrive at the context width. // that of its children to arrive at the context width.
GenericBox(*) => Au(0), &GenericBox(*) => Au(0),
// TODO: consult CSS 'width', margin, border. // TODO: consult CSS 'width', margin, border.
// TODO: If image isn't available, consult 'width'. // TODO: If image isn't available, consult 'width'.
ImageBox(_,i) => Au::from_px(i.get_size().get_default(Size2D(0,0)).width), &ImageBox(_,i) => Au::from_px(i.get_size().get_default(Size2D(0,0)).width),
TextBox(_,d) => d.run.min_width_for_range(&const d.range), &TextBox(_,d) => d.run.min_width_for_range(&const d.range),
UnscannedTextBox(*) => fail ~"Shouldn't see unscanned boxes here." &UnscannedTextBox(*) => fail ~"Shouldn't see unscanned boxes here."
} }
} }
fn get_pref_width(_ctx: &LayoutContext) -> Au { fn get_pref_width(_ctx: &LayoutContext) -> Au {
match self { match &self {
// TODO: this should account for min/pref widths of the // TODO: this should account for min/pref widths of the
// box element in isolation. That includes // box element in isolation. That includes
// border/margin/padding but not child widths. The block // border/margin/padding but not child widths. The block
// FlowContext will combine the width of this element and // FlowContext will combine the width of this element and
// that of its children to arrive at the context width. // that of its children to arrive at the context width.
GenericBox(*) => Au(0), &GenericBox(*) => Au(0),
ImageBox(_,i) => Au::from_px(i.get_size().get_default(Size2D(0,0)).width), &ImageBox(_,i) => Au::from_px(i.get_size().get_default(Size2D(0,0)).width),
// a text box cannot span lines, so assume that this is an unsplit text box. // a text box cannot span lines, so assume that this is an unsplit text box.
@ -266,7 +266,7 @@ impl RenderBox {
// they could report a smaller pref width during incremental reflow. // they could report a smaller pref width during incremental reflow.
// maybe text boxes should report nothing, and the parent flow could // maybe text boxes should report nothing, and the parent flow could
// factor in min/pref widths of any text runs that it owns. // factor in min/pref widths of any text runs that it owns.
TextBox(_,d) => { &TextBox(_,d) => {
let mut max_line_width: Au = Au(0); let mut max_line_width: Au = Au(0);
for d.run.iter_natural_lines_for_range(&const d.range) |line_range| { for d.run.iter_natural_lines_for_range(&const d.range) |line_range| {
let mut line_width: Au = Au(0); let mut line_width: Au = Au(0);
@ -278,7 +278,7 @@ impl RenderBox {
max_line_width max_line_width
}, },
UnscannedTextBox(*) => fail ~"Shouldn't see unscanned boxes here." &UnscannedTextBox(*) => fail ~"Shouldn't see unscanned boxes here."
} }
} }
@ -303,8 +303,8 @@ impl RenderBox {
/* The box formed by the content edge, as defined in CSS 2.1 Section 8.1. /* The box formed by the content edge, as defined in CSS 2.1 Section 8.1.
Coordinates are relative to the owning flow. */ Coordinates are relative to the owning flow. */
pure fn content_box() -> Rect<Au> { pure fn content_box() -> Rect<Au> {
match self { match &self {
ImageBox(_,i) => { &ImageBox(_,i) => {
let size = i.size(); let size = i.size();
Rect { Rect {
origin: copy self.d().position.origin, origin: copy self.d().position.origin,
@ -312,7 +312,7 @@ impl RenderBox {
Au::from_px(size.height)) Au::from_px(size.height))
} }
}, },
GenericBox(*) => { &GenericBox(*) => {
copy self.d().position copy self.d().position
/* FIXME: The following hits an ICE for whatever reason /* FIXME: The following hits an ICE for whatever reason
@ -327,10 +327,10 @@ impl RenderBox {
size.height - (offset_top + offset_bottom)) size.height - (offset_top + offset_bottom))
}*/ }*/
}, },
TextBox(*) => { &TextBox(*) => {
copy self.d().position copy self.d().position
}, },
UnscannedTextBox(*) => fail ~"Shouldn't see unscanned boxes here." &UnscannedTextBox(*) => fail ~"Shouldn't see unscanned boxes here."
} }
} }
@ -397,9 +397,9 @@ impl RenderBox {
self.add_bgcolor_to_list(list, &abs_box_bounds); self.add_bgcolor_to_list(list, &abs_box_bounds);
match *self { match self {
UnscannedTextBox(*) => fail ~"Shouldn't see unscanned boxes here.", @UnscannedTextBox(*) => fail ~"Shouldn't see unscanned boxes here.",
TextBox(_,data) => { @TextBox(_,data) => {
let nearest_ancestor_element = self.nearest_ancestor_element(); let nearest_ancestor_element = self.nearest_ancestor_element();
let color = nearest_ancestor_element.style().color().to_gfx_color(); let color = nearest_ancestor_element.style().color().to_gfx_color();
list.append_item(~DisplayItem::new_Text(&abs_box_bounds, list.append_item(~DisplayItem::new_Text(&abs_box_bounds,
@ -424,9 +424,9 @@ impl RenderBox {
; ()}); ; ()});
}, },
// TODO: items for background, border, outline // TODO: items for background, border, outline
GenericBox(_) => { @GenericBox(_) => {
}, },
ImageBox(_,i) => { @ImageBox(_,i) => {
match i.get_image() { match i.get_image() {
Some(image) => { Some(image) => {
debug!("(building display list) building image box"); debug!("(building display list) building image box");

View file

@ -57,20 +57,24 @@ priv fn simulate_UA_display_rules(node: Node) -> CSSDisplay {
if (resolved == CSSDisplayNone) { return resolved; } if (resolved == CSSDisplayNone) { return resolved; }
do node.read |n| { do node.read |n| {
match n.kind { let kind: &dom::node::NodeKind = n.kind;
~Doctype(*) | ~Comment(*) => CSSDisplayNone, match kind {
~Text(*) => CSSDisplayInline, &Doctype(*) | &Comment(*) => CSSDisplayNone,
~Element(e) => match e.kind { &Text(*) => CSSDisplayInline,
~HTMLHeadElement(*) => CSSDisplayNone, &Element(ref e) => {
~HTMLScriptElement(*) => CSSDisplayNone, let kind: &dom::element::ElementKind = e.kind;
~HTMLParagraphElement(*) => CSSDisplayBlock, match kind {
~HTMLDivElement(*) => CSSDisplayBlock, &HTMLHeadElement(*) => CSSDisplayNone,
~HTMLBodyElement(*) => CSSDisplayBlock, &HTMLScriptElement(*) => CSSDisplayNone,
~HTMLHeadingElement(*) => CSSDisplayBlock, &HTMLParagraphElement(*) => CSSDisplayBlock,
~HTMLHtmlElement(*) => CSSDisplayBlock, &HTMLDivElement(*) => CSSDisplayBlock,
~HTMLUListElement(*) => CSSDisplayBlock, &HTMLBodyElement(*) => CSSDisplayBlock,
~HTMLOListElement(*) => CSSDisplayBlock, &HTMLHeadingElement(*) => CSSDisplayBlock,
_ => resolved &HTMLHtmlElement(*) => CSSDisplayBlock,
&HTMLUListElement(*) => CSSDisplayBlock,
&HTMLOListElement(*) => CSSDisplayBlock,
_ => resolved
}
} }
} }
} }
@ -104,6 +108,8 @@ impl BoxGenerator {
// TODO: remove this once UA styles work // TODO: remove this once UA styles work
let box_type = builder.decide_box_type(node, simulated_display); let box_type = builder.decide_box_type(node, simulated_display);
debug!("BoxGenerator[f%d]: point a", self.flow.d().id);
// depending on flow, make a box for this node. // depending on flow, make a box for this node.
match self.flow { match self.flow {
@InlineFlow(*) => { @InlineFlow(*) => {
@ -126,6 +132,7 @@ impl BoxGenerator {
// TODO: cases for inline-block, etc. // TODO: cases for inline-block, etc.
}, },
@BlockFlow(*) => { @BlockFlow(*) => {
debug!("BoxGenerator[f%d]: point b", self.flow.d().id);
let new_box = builder.make_box(ctx, box_type, node, self.flow); let new_box = builder.make_box(ctx, box_type, node, self.flow);
debug!("BoxGenerator[f%d]: attaching box[b%d] to block flow (node: %s)", debug!("BoxGenerator[f%d]: attaching box[b%d] to block flow (node: %s)",
self.flow.d().id, new_box.d().id, node.debug_str()); self.flow.d().id, new_box.d().id, node.debug_str());
@ -134,7 +141,9 @@ impl BoxGenerator {
self.flow.block().box = Some(new_box); self.flow.block().box = Some(new_box);
}, },
@RootFlow(*) => { @RootFlow(*) => {
debug!("BoxGenerator[f%d]: point c", self.flow.d().id);
let new_box = builder.make_box(ctx, box_type, node, self.flow); let new_box = builder.make_box(ctx, box_type, node, self.flow);
debug!("BoxGenerator[f%d]: (node is: %s)", self.flow.d().id, node.debug_str());
debug!("BoxGenerator[f%d]: attaching box[b%d] to root flow (node: %s)", debug!("BoxGenerator[f%d]: attaching box[b%d] to root flow (node: %s)",
self.flow.d().id, new_box.d().id, node.debug_str()); self.flow.d().id, new_box.d().id, node.debug_str());
@ -271,13 +280,15 @@ impl LayoutTreeBuilder {
/** Creates necessary box(es) and flow context(s) for the current DOM node, /** Creates necessary box(es) and flow context(s) for the current DOM node,
and recurses on its children. */ and recurses on its children. */
fn construct_recursively(layout_ctx: &LayoutContext, cur_node: Node, parent_ctx: &BuilderContext) { fn construct_recursively(layout_ctx: &LayoutContext, cur_node: Node, parent_ctx: &BuilderContext) {
debug!("Considering node: %?", fmt!("%?", cur_node.read(|n| copy n.kind ))); debug!("Considering node: %s", cur_node.debug_str());
let this_ctx = match move parent_ctx.containing_context_for_node(cur_node, &self) { let this_ctx = match move parent_ctx.containing_context_for_node(cur_node, &self) {
Some(move ctx) => move ctx, Some(move ctx) => move ctx,
None => { return; } // no context because of display: none. Stop building subtree. None => { return; } // no context because of display: none. Stop building subtree.
}; };
debug!("point a: %s", cur_node.debug_str());
this_ctx.default_collector.push_node(layout_ctx, &self, cur_node); this_ctx.default_collector.push_node(layout_ctx, &self, cur_node);
debug!("point b: %s", cur_node.debug_str());
// recurse on child nodes. // recurse on child nodes.
for tree::each_child(&NodeTree, &cur_node) |child_node| { for tree::each_child(&NodeTree, &cur_node) |child_node| {
@ -403,7 +414,7 @@ impl LayoutTreeBuilder {
} }
fn make_generic_box(_layout_ctx: &LayoutContext, node: Node, ctx: @FlowContext) -> @RenderBox { fn make_generic_box(_layout_ctx: &LayoutContext, node: Node, ctx: @FlowContext) -> @RenderBox {
@GenericBox(RenderBoxData(node, ctx, self.next_box_id())) @GenericBox(RenderBoxData(copy node, ctx, self.next_box_id()))
} }
fn make_image_box(layout_ctx: &LayoutContext, node: Node, ctx: @FlowContext) -> @RenderBox { fn make_image_box(layout_ctx: &LayoutContext, node: Node, ctx: @FlowContext) -> @RenderBox {

View file

@ -1,7 +1,5 @@
export DisplayListBuilder; export DisplayListBuilder;
use au = gfx::geometry;
use au::Au;
use newcss::values::Specified; use newcss::values::Specified;
use newcss::values::{CSSBackgroundColorColor, CSSBackgroundColorTransparent}; use newcss::values::{CSSBackgroundColorColor, CSSBackgroundColorTransparent};
use dom::node::{Text, NodeScope}; use dom::node::{Text, NodeScope};
@ -19,6 +17,7 @@ use util::tree;
use vec::push; use vec::push;
use gfx::display_list::DisplayList; use gfx::display_list::DisplayList;
use gfx::geometry::Au;
/** A builder object that manages display list builder should mainly /** A builder object that manages display list builder should mainly
hold information about the initial request and desired result---for hold information about the initial request and desired result---for
@ -42,7 +41,7 @@ trait FlowDisplayListBuilderMethods {
impl FlowContext: FlowDisplayListBuilderMethods { impl FlowContext: FlowDisplayListBuilderMethods {
fn build_display_list(@self, builder: &DisplayListBuilder, dirty: &Rect<Au>, fn build_display_list(@self, builder: &DisplayListBuilder, dirty: &Rect<Au>,
list: &mut DisplayList) { list: &mut DisplayList) {
let zero = au::zero_point(); let zero = gfx::geometry::zero_point();
self.build_display_list_recurse(builder, dirty, &zero, list); self.build_display_list_recurse(builder, dirty, &zero, list);
} }

View file

@ -38,8 +38,8 @@ trait UnscannedMethods {
impl RenderBox : UnscannedMethods { impl RenderBox : UnscannedMethods {
pure fn raw_text() -> ~str { pure fn raw_text() -> ~str {
match self { match &self {
UnscannedTextBox(_, s) => copy s, &UnscannedTextBox(_, s) => copy s,
_ => fail ~"unsupported operation: box.raw_text() on non-unscanned text box." _ => fail ~"unsupported operation: box.raw_text() on non-unscanned text box."
} }
} }

View file

@ -1,6 +1,6 @@
use ShareGlContext = sharegl::platform::Context; use ShareGlContext = sharegl::platform::Context;
use dom::event::{Event, ResizeEvent}; use dom::event::{Event, ResizeEvent};
use resize_rate_limiter::ResizeRateLimiter; use platform::resize_rate_limiter::ResizeRateLimiter;
use azure::azure_hl::{BackendType, B8G8R8A8, DataSourceSurface, DrawTarget, SourceSurfaceMethods}; use azure::azure_hl::{BackendType, B8G8R8A8, DataSourceSurface, DrawTarget, SourceSurfaceMethods};
use core::dvec::DVec; use core::dvec::DVec;
@ -334,7 +334,7 @@ fn Surface(backend: BackendType) -> Surface {
} }
/// A function for spawning into the platform's main thread /// A function for spawning into the platform's main thread
fn on_osmain<T: Send>(f: fn~(po: comm::Port<T>)) -> comm::Chan<T> { fn on_osmain<T: Owned>(f: fn~(po: comm::Port<T>)) -> comm::Chan<T> {
task::task().sched_mode(task::PlatformThread).spawn_listener(move f) task::task().sched_mode(task::PlatformThread).spawn_listener(move f)
} }

View file

@ -59,7 +59,7 @@ impl ResizeRateLimiter {
} }
priv fn send_event(width: uint, height: uint) { priv fn send_event(width: uint, height: uint) {
let (chan, port) = pipes::stream(); let (port, chan) = pipes::stream();
self.dom_event_chan.send(ResizeEvent(width, height, move chan)); self.dom_event_chan.send(ResizeEvent(width, height, move chan));
self.last_response_port = Some(move port); self.last_response_port = Some(move port);
} }

View file

@ -148,9 +148,9 @@ fn main() {
#[allow(non_implicitly_copyable_typarams)] #[allow(non_implicitly_copyable_typarams)]
fn run(opts: &Opts) { fn run(opts: &Opts) {
match opts.render_mode { match &opts.render_mode {
Screen => run_pipeline_screen(opts), &Screen => run_pipeline_screen(opts),
Png(outfile) => { &Png(outfile) => {
assert opts.urls.is_not_empty(); assert opts.urls.is_not_empty();
if opts.urls.len() > 1u { if opts.urls.len() > 1u {
fail ~"servo asks that you stick to a single URL in PNG output mode" fail ~"servo asks that you stick to a single URL in PNG output mode"
@ -161,14 +161,14 @@ fn run(opts: &Opts) {
} }
fn run_pipeline_screen(opts: &Opts) { fn run_pipeline_screen(opts: &Opts) {
let (dom_event_chan, dom_event_port) = pipes::stream(); 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(move dom_event_chan);
// The platform event handler thread // The platform event handler thread
let osmain = OSMain(dom_event_chan.clone(), copy *opts); let osmain = OSMain(dom_event_chan.clone(), copy *opts);
// Send each file to render then wait for keypress // Send each file to render then wait for keypress
let (keypress_to_engine, keypress_from_osmain) = pipes::stream(); let (keypress_from_osmain, keypress_to_engine) = pipes::stream();
osmain.chan.send(AddKeyHandler(move keypress_to_engine)); osmain.chan.send(AddKeyHandler(move keypress_to_engine));
// Create a servo instance // Create a servo instance
@ -191,7 +191,7 @@ fn run_pipeline_screen(opts: &Opts) {
// Shut everything down // Shut everything down
debug!("master: Shut down"); debug!("master: Shut down");
let (exit_chan, exit_response_from_engine) = pipes::stream(); let (exit_response_from_engine, exit_chan) = pipes::stream();
engine_task.send(engine::ExitMsg(move exit_chan)); engine_task.send(engine::ExitMsg(move exit_chan));
exit_response_from_engine.recv(); exit_response_from_engine.recv();
@ -212,7 +212,7 @@ fn run_pipeline_png(url: ~str, outfile: &str) {
use resource::image_cache_task::SyncImageCacheTask; use resource::image_cache_task::SyncImageCacheTask;
listen(|pngdata_from_compositor| { listen(|pngdata_from_compositor| {
let (dom_event_chan, dom_event_port) = pipes::stream(); 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(move dom_event_chan);
let compositor = PngCompositor(pngdata_from_compositor); let compositor = PngCompositor(pngdata_from_compositor);

View file

@ -11,11 +11,11 @@ Actors are only referred to by opaque handles parameterized
over the actor's message type, which can be considered the over the actor's message type, which can be considered the
actor's interface. actor's interface.
*/ */
struct ActorRef<M: Send> { struct ActorRef<M: Owned> {
chan: Chan<M>, chan: Chan<M>,
} }
impl<M: Send> ActorRef<M> { impl<M: Owned> ActorRef<M> {
fn send(&self, msg: M) { fn send(&self, msg: M) {
self.chan.send(move msg); self.chan.send(move msg);
} }
@ -27,8 +27,8 @@ trait Actor<M> {
} }
/// A helper function used by actor constructors /// A helper function used by actor constructors
fn spawn<A: Actor<M>, M: Send>(f: ~fn() -> A) -> ActorRef<M> { fn spawn<A: Actor<M>, M: Owned>(f: ~fn() -> A) -> ActorRef<M> {
let (chan, port) = stream(); let (port, chan) = stream();
do task::spawn |move f, move port| { do task::spawn |move f, move port| {
let actor = f(); let actor = f();
loop { loop {
@ -44,11 +44,11 @@ fn spawn<A: Actor<M>, M: Send>(f: ~fn() -> A) -> ActorRef<M> {
} }
} }
struct SharedActorRef<M: Send> { struct SharedActorRef<M: Owned> {
chan: SharedChan<M> chan: SharedChan<M>
} }
impl<M: Send> SharedActorRef<M> { impl<M: Owned> SharedActorRef<M> {
fn send(&self, msg: M) { fn send(&self, msg: M) {
self.chan.send(move msg); self.chan.send(move msg);
} }
@ -60,7 +60,7 @@ impl<M: Send> SharedActorRef<M> {
} }
} }
fn SharedActorRef<M: Send>(actor: ActorRef<M>) -> SharedActorRef<M> { fn SharedActorRef<M: Owned>(actor: ActorRef<M>) -> SharedActorRef<M> {
let chan = match move actor { let chan = match move actor {
ActorRef { ActorRef {
chan: move chan chan: move chan
@ -112,7 +112,7 @@ mod test {
#[test] #[test]
fn test_exit() { fn test_exit() {
let actor = HelloActor(~"bob"); let actor = HelloActor(~"bob");
let (chan, port) = stream(); let (port, chan) = stream();
actor.send(Exit(move chan)); actor.send(Exit(move chan));
port.recv(); port.recv();
} }
@ -123,17 +123,17 @@ mod test {
let actor1 = SharedActorRef(move actor); let actor1 = SharedActorRef(move actor);
let actor2 = actor1.clone(); let actor2 = actor1.clone();
let (chan1, port1) = stream(); let (port1, chan1) = stream();
actor1.send(GetName(move chan1)); actor1.send(GetName(move chan1));
let (chan2, port2) = stream(); let (port2, chan2) = stream();
actor2.send(GetName(move chan2)); actor2.send(GetName(move chan2));
assert port1.recv() == ~"bob"; assert port1.recv() == ~"bob";
assert port2.recv() == ~"bob"; assert port2.recv() == ~"bob";
let (chan, port) = stream(); let (port, chan) = stream();
actor1.send(Exit(move chan)); actor1.send(Exit(move chan));
port.recv(); port.recv();
} }
} }

@ -1 +1 @@
Subproject commit 38e440727470f034bda3d47faa22a84985e7a958 Subproject commit d1f1e591c7a3b53b19d037aa33c79c5c7606d411