mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Update for language changes
This commit is contained in:
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
|
|
@ -43,20 +43,20 @@ impl DisplayItem {
|
|||
}
|
||||
|
||||
fn draw_into_context(&self, ctx: &RenderContext) {
|
||||
match *self {
|
||||
SolidColor(_, color) => ctx.draw_solid_color(&self.d().bounds, color),
|
||||
Text(_, run, ref range, color) => {
|
||||
match self {
|
||||
&SolidColor(_, color) => ctx.draw_solid_color(&self.d().bounds, color),
|
||||
&Text(_, run, ref range, color) => {
|
||||
let new_run = @run.deserialize(ctx.font_ctx);
|
||||
let font = new_run.font;
|
||||
let origin = self.d().bounds.origin;
|
||||
let baseline_origin = Point2D(origin.x, origin.y + font.metrics.ascent);
|
||||
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);
|
||||
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!("%?", {
|
||||
|
|
|
@ -11,7 +11,7 @@ use core::send_map::linear::LinearMap;
|
|||
use core::send_map::linear;
|
||||
|
||||
// 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] {
|
||||
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, ()> {
|
||||
return match desc.selector {
|
||||
SelectorStubDummy => {
|
||||
return match &desc.selector {
|
||||
&SelectorStubDummy => {
|
||||
Font::new_from_buffer(&self, test_font_bin(), &desc.style, self.backend)
|
||||
},
|
||||
// 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);
|
||||
result::chain(move result_handle, |handle| {
|
||||
Ok(Font::new_from_adopted_handle(&self, move handle, &desc.style, self.backend))
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
const TEST_IMAGE: [u8 * 4962] = #include_bin("test.jpeg");
|
||||
const TEST_IMAGE: [u8 * 4962] = include_bin!("test.jpeg");
|
||||
|
||||
pub fn test_image_bin() -> ~[u8] {
|
||||
return vec::from_fn(4962, |i| TEST_IMAGE[i]);
|
||||
|
|
|
@ -2,27 +2,20 @@ extern mod core_foundation;
|
|||
extern mod core_graphics;
|
||||
extern mod core_text;
|
||||
|
||||
use cf = core_foundation;
|
||||
use cf::base::{
|
||||
CFIndex,
|
||||
CFTypeRef,
|
||||
CFWrapper,
|
||||
};
|
||||
use cf::data::{CFData, CFDataRef};
|
||||
use cf::string::UniChar;
|
||||
use cg = core_graphics;
|
||||
use quartz::font::core_foundation::base::{CFIndex, CFTypeRef, CFWrapper};
|
||||
use quartz::font::core_foundation::data::{CFData, CFDataRef};
|
||||
use quartz::font::core_foundation::string::UniChar;
|
||||
|
||||
use cg::base::{CGFloat, CGAffineTransform};
|
||||
use cg::data_provider::{CGDataProviderRef, CGDataProvider};
|
||||
use cg::font::{CGFont, CGFontRef, CGGlyph};
|
||||
use cg::geometry::CGRect;
|
||||
use quartz::font::core_graphics::base::{CGFloat, CGAffineTransform};
|
||||
use quartz::font::core_graphics::data_provider::{CGDataProviderRef, CGDataProvider};
|
||||
use quartz::font::core_graphics::font::{CGFont, CGFontRef, CGGlyph};
|
||||
use quartz::font::core_graphics::geometry::CGRect;
|
||||
|
||||
use ct = core_text;
|
||||
use ct::font::CTFont;
|
||||
use ct::font_descriptor::{kCTFontDefaultOrientation, CTFontSymbolicTraits};
|
||||
use ct::font_descriptor::{SymbolicTraitAccessors};
|
||||
use quartz::font::core_text::font::CTFont;
|
||||
use quartz::font::core_text::font_descriptor::{kCTFontDefaultOrientation, CTFontSymbolicTraits};
|
||||
use quartz::font::core_text::font_descriptor::{SymbolicTraitAccessors};
|
||||
|
||||
use font_context::QuartzFontContextHandle;
|
||||
use quartz::font_context::QuartzFontContextHandle;
|
||||
use geometry::Au;
|
||||
use gfx_font::{
|
||||
CSSFontWeight,
|
||||
|
@ -76,11 +69,11 @@ pub impl QuartzFontHandle {
|
|||
static fn new_from_buffer(_fctx: &QuartzFontContextHandle, buf: ~[u8],
|
||||
style: &SpecifiedFontStyle) -> Result<QuartzFontHandle, ()> {
|
||||
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 ctfont = ct::font::new_from_CGFont(&cgfont, style.pt_size);
|
||||
let cgfont = quartz::font::core_graphics::font::create_with_data_provider(&fontprov);
|
||||
let ctfont = quartz::font::core_text::font::new_from_CGFont(&cgfont, style.pt_size);
|
||||
|
||||
let result = Ok(QuartzFontHandle {
|
||||
cgfont : Some(move cgfont),
|
||||
|
|
|
@ -2,11 +2,10 @@ extern mod core_foundation;
|
|||
extern mod core_graphics;
|
||||
extern mod core_text;
|
||||
|
||||
use ct = core_text;
|
||||
use ct::font::CTFont;
|
||||
use quartz::font::QuartzFontHandle;
|
||||
use quartz::font_context::core_text::font::CTFont;
|
||||
|
||||
use gfx_font::{FontHandle, UsedFontStyle};
|
||||
use font::QuartzFontHandle;
|
||||
use gfx_font_context::FontContextHandleMethods;
|
||||
|
||||
pub struct QuartzFontContextHandle {
|
||||
|
@ -28,9 +27,10 @@ pub impl QuartzFontContextHandle : FontContextHandleMethods {
|
|||
}
|
||||
|
||||
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| {
|
||||
QuartzFontHandle::new_from_CTFont(&self, move ctfont)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
extern mod core_foundation;
|
||||
extern mod core_text;
|
||||
|
||||
use cf = core_foundation;
|
||||
use cf::array::CFArray;
|
||||
use cf::base::CFWrapper;
|
||||
use cf::string::{CFString, CFStringRef};
|
||||
use quartz::font_list::core_foundation::array::CFArray;
|
||||
use quartz::font_list::core_foundation::base::CFWrapper;
|
||||
use quartz::font_list::core_foundation::string::{CFString, CFStringRef};
|
||||
|
||||
use ct = core_text;
|
||||
use ct::font::{CTFont, debug_font_names, debug_font_traits};
|
||||
use ct::font_collection::CTFontCollection;
|
||||
use ct::font_descriptor::{CTFontDescriptor, CTFontDescriptorRef, debug_descriptor};
|
||||
use quartz::font_list::core_text::font::{CTFont, debug_font_names, debug_font_traits};
|
||||
use quartz::font_list::core_text::font_collection::CTFontCollection;
|
||||
use quartz::font_list::core_text::font_descriptor::{CTFontDescriptor, CTFontDescriptorRef};
|
||||
use quartz::font_list::core_text::font_descriptor::{debug_descriptor};
|
||||
|
||||
use quartz::font::QuartzFontHandle;
|
||||
use quartz::font_context::QuartzFontContextHandle;
|
||||
|
@ -29,7 +28,7 @@ pub impl QuartzFontListHandle {
|
|||
}
|
||||
|
||||
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();
|
||||
for family_names.each |strref: &CFStringRef| {
|
||||
let family_name = CFWrapper::wrap_shared(*strref).to_str();
|
||||
|
@ -45,10 +44,11 @@ pub impl QuartzFontListHandle {
|
|||
let family_name = &family.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| {
|
||||
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));
|
||||
|
||||
debug!("Creating new FontEntry for face: %s", handle.face_name());
|
||||
|
|
|
@ -111,7 +111,7 @@ pub fn render_layers(layer_ref: *RenderLayer,
|
|||
//}
|
||||
|
||||
// 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.
|
||||
f(layer_ref, move buffer, move new_buffer_chan);
|
||||
|
|
|
@ -23,11 +23,11 @@ pub enum 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 opts_cell = Cell(move opts);
|
||||
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();
|
||||
compositor.begin_drawing(move layer_buffer_channel);
|
||||
|
@ -67,7 +67,7 @@ priv struct ThreadRenderContext {
|
|||
opts: Opts,
|
||||
}
|
||||
|
||||
priv struct Renderer<C: Compositor Send> {
|
||||
priv struct Renderer<C: Compositor Owned> {
|
||||
port: comm::Port<Msg>,
|
||||
compositor: C,
|
||||
layer_buffer_set_port: Cell<pipes::Port<LayerBufferSet>>,
|
||||
|
@ -75,7 +75,7 @@ priv struct Renderer<C: Compositor Send> {
|
|||
opts: Opts,
|
||||
}
|
||||
|
||||
impl<C: Compositor Send> Renderer<C> {
|
||||
impl<C: Compositor Owned> Renderer<C> {
|
||||
fn start() {
|
||||
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_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);
|
||||
|
||||
let layer_buffer_set_cell = Cell(move layer_buffer_set);
|
||||
|
|
|
@ -2,7 +2,7 @@ export factory;
|
|||
|
||||
use comm::Chan;
|
||||
use task::spawn;
|
||||
use resource_task::{ProgressMsg, Payload, Done};
|
||||
use resource::resource_task::{ProgressMsg, Payload, Done};
|
||||
use std::net::url::Url;
|
||||
use io::{file_reader, ReaderUtil};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ export factory;
|
|||
|
||||
use comm::Chan;
|
||||
use task::spawn;
|
||||
use resource_task::{ProgressMsg, Payload, Done};
|
||||
use resource::resource_task::{ProgressMsg, Payload, Done};
|
||||
use std::net::url::Url;
|
||||
use http_client::{uv_http_request};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use image::base::{Image, load_from_memory, test_image_bin};
|
||||
use resource::resource_task;
|
||||
use resource_task::ResourceTask;
|
||||
use resource::resource_task::ResourceTask;
|
||||
use util::url::{make_url, UrlMap, url_map};
|
||||
|
||||
use clone_arc = std::arc::clone;
|
||||
|
@ -49,10 +49,10 @@ pub enum ImageResponseMsg {
|
|||
|
||||
impl ImageResponseMsg {
|
||||
pure fn clone() -> ImageResponseMsg {
|
||||
match self {
|
||||
ImageReady(img) => ImageReady(unsafe { clone_arc(&img) }),
|
||||
ImageNotReady => ImageNotReady,
|
||||
ImageFailed => ImageFailed
|
||||
match &self {
|
||||
&ImageReady(img) => ImageReady(unsafe { clone_arc(&img) }),
|
||||
&ImageNotReady => ImageNotReady,
|
||||
&ImageFailed => ImageFailed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ pub fn ImageCacheTask_(resource_task: ResourceTask, decoder_factory: DecoderFact
|
|||
// copy unsoundly
|
||||
let decoder_factory_cell = Cell(move decoder_factory);
|
||||
|
||||
let (chan, port) = stream();
|
||||
let (port, chan) = stream();
|
||||
let chan = SharedChan(move chan);
|
||||
let port_cell = Cell(move port);
|
||||
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 {
|
||||
let (chan, port) = stream();
|
||||
let (port, chan) = stream();
|
||||
let port_cell = Cell(move port);
|
||||
|
||||
do spawn |move port_cell, move resource_task| {
|
||||
|
@ -451,7 +451,7 @@ trait ImageCacheTaskClient {
|
|||
impl ImageCacheTask: ImageCacheTaskClient {
|
||||
|
||||
fn exit() {
|
||||
let (response_chan, response_port) = stream();
|
||||
let (response_port, response_chan) = stream();
|
||||
self.send(Exit(move response_chan));
|
||||
response_port.recv();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@ multiple times and thus triggering reflows multiple times.
|
|||
use clone_arc = std::arc::clone;
|
||||
use std::net::url::Url;
|
||||
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};
|
||||
|
||||
pub fn LocalImageCache(image_cache_task: ImageCacheTask) -> LocalImageCache {
|
||||
|
@ -72,14 +73,14 @@ pub impl LocalImageCache {
|
|||
ImageReady(ref image) => {
|
||||
// FIXME: appease borrowck
|
||||
unsafe {
|
||||
let (chan, port) = pipes::stream();
|
||||
let (port, chan) = pipes::stream();
|
||||
chan.send(ImageReady(clone_arc(image)));
|
||||
return move port;
|
||||
}
|
||||
}
|
||||
ImageNotReady => {
|
||||
if last_round == self.round_number {
|
||||
let (chan, port) = pipes::stream();
|
||||
let (port, chan) = pipes::stream();
|
||||
chan.send(ImageNotReady);
|
||||
return move port;
|
||||
} else {
|
||||
|
@ -88,13 +89,13 @@ pub impl LocalImageCache {
|
|||
}
|
||||
}
|
||||
ImageFailed => {
|
||||
let (chan, port) = pipes::stream();
|
||||
let (port, chan) = pipes::stream();
|
||||
chan.send(ImageFailed);
|
||||
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));
|
||||
|
||||
let response = response_port.recv();
|
||||
|
@ -110,7 +111,7 @@ pub impl LocalImageCache {
|
|||
let on_image_available = self.on_image_available.get()();
|
||||
let url = copy *url;
|
||||
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));
|
||||
on_image_available(response_port.recv());
|
||||
}
|
||||
|
@ -126,7 +127,7 @@ pub impl LocalImageCache {
|
|||
};
|
||||
state.last_response = move response_copy;
|
||||
|
||||
let (chan, port) = pipes::stream();
|
||||
let (port, chan) = pipes::stream();
|
||||
chan.send(move response);
|
||||
return move port;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use au = geometry;
|
||||
use au::Au;
|
||||
use geometry::Au;
|
||||
use servo_gfx_util::range::Range;
|
||||
use servo_gfx_util::vec::*;
|
||||
|
||||
|
@ -443,7 +442,7 @@ pub pure fn GlyphData(index: GlyphIndex,
|
|||
ligature_start: bool) -> GlyphData {
|
||||
|
||||
let _offset = match offset {
|
||||
None => au::zero_point(),
|
||||
None => geometry::zero_point(),
|
||||
Some(o) => o
|
||||
};
|
||||
|
||||
|
@ -532,7 +531,7 @@ pub impl GlyphStore {
|
|||
pure fn glyph_is_compressible(data: &GlyphData) -> bool {
|
||||
is_simple_glyph_id(data.index)
|
||||
&& is_simple_advance(data.advance)
|
||||
&& data.offset == au::zero_point()
|
||||
&& data.offset == geometry::zero_point()
|
||||
&& data.cluster_start // others are stored in detail buffer
|
||||
}
|
||||
|
||||
|
|
|
@ -2,20 +2,15 @@ extern mod harfbuzz;
|
|||
|
||||
use geom::Point2D;
|
||||
|
||||
use au = geometry;
|
||||
use au::Au;
|
||||
use geometry::Au;
|
||||
|
||||
use font::{
|
||||
Font,
|
||||
FontTable,
|
||||
FontTableTag,
|
||||
};
|
||||
use font::{Font, FontTable, FontTableTag};
|
||||
|
||||
use glyph::{GlyphStore, GlyphIndex, GlyphData};
|
||||
use text::glyph::{GlyphStore, GlyphIndex, GlyphData};
|
||||
use text::shaper::ShaperMethods;
|
||||
|
||||
use servo_util::range;
|
||||
use range::Range;
|
||||
use util::range::Range;
|
||||
|
||||
use core::libc::types::common::c99::int32_t;
|
||||
use core::libc::{c_uint, c_int, c_void, c_char};
|
||||
|
@ -23,36 +18,48 @@ use core::util::ignore;
|
|||
use dvec::DVec;
|
||||
use std::arc;
|
||||
|
||||
use harfbuzz::{HB_MEMORY_MODE_READONLY, HB_DIRECTION_LTR, hb_blob_t, hb_face_t, hb_font_t};
|
||||
use harfbuzz::{hb_font_funcs_t, hb_buffer_t, hb_codepoint_t, hb_bool_t, hb_glyph_position_t};
|
||||
use harfbuzz::{hb_glyph_info_t, hb_var_int_t, hb_position_t};
|
||||
use harfbuzz::bindgen::{hb_blob_create, hb_blob_destroy, hb_face_create, hb_face_destroy};
|
||||
use harfbuzz::bindgen::{hb_font_create, hb_font_destroy, hb_buffer_create, hb_buffer_destroy};
|
||||
use harfbuzz::bindgen::{hb_buffer_add_utf8, hb_shape, hb_buffer_get_glyph_infos};
|
||||
use harfbuzz::bindgen::{hb_buffer_get_glyph_positions, hb_font_set_ppem, hb_font_set_scale};
|
||||
use harfbuzz::bindgen::{hb_buffer_set_direction, hb_font_funcs_create, hb_font_funcs_destroy};
|
||||
use harfbuzz::bindgen::{hb_font_set_funcs, hb_font_funcs_set_glyph_h_advance_func};
|
||||
use harfbuzz::bindgen::{hb_font_funcs_set_glyph_func, hb_font_funcs_set_glyph_h_kerning_func};
|
||||
use text::harfbuzz::shaper::harfbuzz::{HB_MEMORY_MODE_READONLY, HB_DIRECTION_LTR, hb_blob_t};
|
||||
use text::harfbuzz::shaper::harfbuzz::{hb_face_t, hb_font_t};
|
||||
use text::harfbuzz::shaper::harfbuzz::{hb_font_funcs_t, hb_buffer_t, hb_codepoint_t, hb_bool_t};
|
||||
use text::harfbuzz::shaper::harfbuzz::{hb_glyph_position_t};
|
||||
use text::harfbuzz::shaper::harfbuzz::{hb_glyph_info_t, hb_var_int_t, hb_position_t};
|
||||
use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_blob_create, hb_blob_destroy};
|
||||
use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_face_create, hb_face_destroy};
|
||||
use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_font_create, hb_font_destroy};
|
||||
use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_buffer_create};
|
||||
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,
|
||||
HB_DIRECTION_LTR};
|
||||
use harfbuzz::{hb_blob_t, hb_face_t, hb_font_t, hb_font_funcs_t, hb_buffer_t,
|
||||
hb_codepoint_t, hb_bool_t, hb_glyph_position_t,
|
||||
hb_glyph_info_t, hb_var_int_t, hb_position_t, hb_tag_t};
|
||||
use harfbuzz::bindgen::{hb_blob_create, hb_blob_destroy,
|
||||
hb_face_create_for_tables, hb_face_destroy,
|
||||
hb_font_create, hb_font_destroy,
|
||||
hb_buffer_create, hb_buffer_destroy,
|
||||
hb_buffer_add_utf8, hb_shape,
|
||||
hb_buffer_get_glyph_infos,
|
||||
hb_buffer_get_glyph_positions,
|
||||
hb_font_set_ppem, hb_font_set_scale,
|
||||
hb_buffer_set_direction,
|
||||
hb_font_funcs_create, hb_font_funcs_destroy,
|
||||
hb_font_set_funcs,
|
||||
hb_font_funcs_set_glyph_h_advance_func,
|
||||
hb_font_funcs_set_glyph_func,
|
||||
hb_font_funcs_set_glyph_h_kerning_func};
|
||||
use text::harfbuzz::shaper::harfbuzz::{HB_MEMORY_MODE_READONLY, HB_DIRECTION_LTR};
|
||||
use text::harfbuzz::shaper::harfbuzz::{hb_blob_t, hb_face_t, hb_font_t, hb_font_funcs_t};
|
||||
use text::harfbuzz::shaper::harfbuzz::{hb_buffer_t, hb_codepoint_t, hb_bool_t};
|
||||
use text::harfbuzz::shaper::harfbuzz::{hb_glyph_position_t, hb_glyph_info_t, hb_var_int_t};
|
||||
use text::harfbuzz::shaper::harfbuzz::{hb_position_t, hb_tag_t};
|
||||
use text::harfbuzz::shaper::harfbuzz::bindgen::{hb_blob_create, hb_blob_destroy,
|
||||
hb_face_create_for_tables, hb_face_destroy,
|
||||
hb_font_create, hb_font_destroy,
|
||||
hb_buffer_create, hb_buffer_destroy,
|
||||
hb_buffer_add_utf8, hb_shape,
|
||||
hb_buffer_get_glyph_infos,
|
||||
hb_buffer_get_glyph_positions,
|
||||
hb_font_set_ppem, hb_font_set_scale,
|
||||
hb_buffer_set_direction,
|
||||
hb_font_funcs_create, hb_font_funcs_destroy,
|
||||
hb_font_set_funcs,
|
||||
hb_font_funcs_set_glyph_h_advance_func,
|
||||
hb_font_funcs_set_glyph_func,
|
||||
hb_font_funcs_set_glyph_h_kerning_func};
|
||||
|
||||
pub struct ShapedGlyphData {
|
||||
count: uint,
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
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. */
|
||||
|
||||
pub use shaper::Shaper;
|
||||
pub use text_run::TextRun;
|
||||
pub use text_run::SendableTextRun;
|
||||
pub use text::shaper::Shaper;
|
||||
pub use text::text_run::TextRun;
|
||||
pub use text::text_run::SendableTextRun;
|
||||
|
||||
pub mod glyph;
|
||||
pub mod text_run;
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
use font_context::FontContext;
|
||||
use geometry::Au;
|
||||
use glyph::{
|
||||
BreakTypeNormal,
|
||||
GlyphStore,
|
||||
};
|
||||
use text::glyph::{BreakTypeNormal, GlyphStore};
|
||||
use servo_gfx_font::{Font, FontDescriptor, RunMetrics};
|
||||
use servo_gfx_util::range::Range;
|
||||
|
||||
|
@ -16,7 +13,7 @@ use std::arc::ARC;
|
|||
pub struct TextRun {
|
||||
text: ~str,
|
||||
font: @Font,
|
||||
priv glyphs: GlyphStore,
|
||||
glyphs: GlyphStore,
|
||||
}
|
||||
|
||||
// This is a hack until TextRuns are normally sendable, or
|
||||
|
|
|
@ -54,7 +54,7 @@ pub fn ContentTask(layout_task: LayoutTask,
|
|||
resource_task: ResourceTask,
|
||||
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_copy = control_chan.clone();
|
||||
|
@ -301,7 +301,7 @@ impl Content {
|
|||
self.join_layout();
|
||||
|
||||
// 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);
|
||||
|
||||
// Send new document and relevant styles to layout
|
||||
|
|
|
@ -6,7 +6,7 @@ use dom::node::{Node, NodeTree};
|
|||
use newcss::select::{SelectCtx, SelectResults};
|
||||
use newcss::complete::CompleteSelectResults;
|
||||
use layout::context::LayoutContext;
|
||||
use select_handler::NodeSelectHandler;
|
||||
use css::select_handler::NodeSelectHandler;
|
||||
|
||||
trait MatchMethods {
|
||||
fn restyle_subtree(select_ctx: &SelectCtx);
|
||||
|
@ -65,4 +65,4 @@ fn find_parent_element_node(node: &Node) -> Option<Node> {
|
|||
}
|
||||
None => None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ use dom::node::Node;
|
|||
|
||||
// FIXME: Rust #3908. rust-css can't reexport VoidPtrLike
|
||||
extern mod netsurfcss;
|
||||
use netsurfcss::util::VoidPtrLike;
|
||||
use css::node_void_ptr::netsurfcss::util::VoidPtrLike;
|
||||
|
||||
impl Node: VoidPtrLike {
|
||||
static fn from_void_ptr(node: *libc::c_void) -> Node {
|
||||
|
|
|
@ -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 ptr::null;
|
||||
use libc::c_uint;
|
||||
use utils::{DOMString, domstring_to_jsval, rust_box, squirrel_away, str};
|
||||
use bindings::node::create;
|
||||
use dom::bindings::utils::{DOMString, domstring_to_jsval, rust_box, squirrel_away, str};
|
||||
use dom::bindings::node::create;
|
||||
|
||||
use dom::document::Document;
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use au = gfx::geometry;
|
||||
use au::au;
|
||||
use js::rust::{bare_compartment, methods, jsobj};
|
||||
use js::{JS_ARGV, JSCLASS_HAS_RESERVED_SLOTS, JSPROP_ENUMERATE, JSPROP_SHARED, JSVAL_NULL,
|
||||
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 dom::node::{Node, NodeScope, Element};
|
||||
use dom::element::*;
|
||||
use node::NodeBundle;
|
||||
use utils::{rust_box, squirrel_away_unique, get_compartment, domstring_to_jsval, str};
|
||||
use dom::bindings::node::NodeBundle;
|
||||
use dom::bindings::utils::{rust_box, squirrel_away_unique, get_compartment, domstring_to_jsval};
|
||||
use dom::bindings::utils::{str};
|
||||
use libc::c_uint;
|
||||
use ptr::null;
|
||||
use node::unwrap;
|
||||
use dom::bindings::node::unwrap;
|
||||
|
||||
|
||||
extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {
|
||||
|
|
|
@ -10,7 +10,8 @@ use js::jsapi::bindgen::*;
|
|||
use js::glue::bindgen::*;
|
||||
|
||||
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 ptr::null;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
match *string {
|
||||
null_string => {
|
||||
match string {
|
||||
&null_string => {
|
||||
JSVAL_NULL
|
||||
}
|
||||
str(s) => {
|
||||
&str(s) => {
|
||||
str::as_buf(s, |buf, len| {
|
||||
let cbuf = cast::reinterpret_cast(&buf);
|
||||
RUST_STRING_TO_JSVAL(JS_NewStringCopyN(cx, cbuf, len as libc::size_t))
|
||||
|
|
|
@ -11,11 +11,11 @@ use js::crust::{JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_Con
|
|||
use js::glue::bindgen::RUST_JSVAL_TO_INT;
|
||||
use ptr::null;
|
||||
use libc::c_uint;
|
||||
use utils::{rust_box, squirrel_away, jsval_to_str};
|
||||
use bindings::node::create;
|
||||
use dom::bindings::utils::{rust_box, squirrel_away, jsval_to_str};
|
||||
use dom::bindings::node::create;
|
||||
use dom::window::{Window, TimerMessage_Fire};
|
||||
use dom::node::Node;
|
||||
use dvec::DVec;
|
||||
use core::dvec::DVec;
|
||||
|
||||
extern fn alert(cx: *JSContext, argc: c_uint, vp: *JSVal) -> JSBool {
|
||||
unsafe {
|
||||
|
|
|
@ -63,13 +63,13 @@ use core::libc::types::os::arch::c95::size_t;
|
|||
use ptr::Ptr;
|
||||
use vec::push;
|
||||
|
||||
type ScopeData<T:Send,A> = {
|
||||
type ScopeData<T,A> = {
|
||||
mut layout_active: bool,
|
||||
mut free_list: ~[Handle<T,A>],
|
||||
mut first_dirty: Handle<T,A>
|
||||
};
|
||||
|
||||
struct ScopeResource<T:Send,A> {
|
||||
struct ScopeResource<T,A> {
|
||||
d : ScopeData<T,A>,
|
||||
|
||||
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 }
|
||||
}
|
||||
|
||||
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,
|
||||
mut write_ptr: *mut T,
|
||||
mut read_aux: *A,
|
||||
mut next_dirty: Handle<T,A>};
|
||||
pub enum Handle<T:Send,A> {
|
||||
type HandleData<T,A> = {mut read_ptr: *T,
|
||||
mut write_ptr: *mut T,
|
||||
mut read_aux: *A,
|
||||
mut next_dirty: Handle<T,A>};
|
||||
pub enum Handle<T,A> {
|
||||
_Handle(*HandleData<T,A>)
|
||||
}
|
||||
|
||||
// Private methods
|
||||
impl<T:Send,A> Handle<T,A> {
|
||||
impl<T,A> Handle<T,A> {
|
||||
fn read_ptr() -> *T unsafe { (**self).read_ptr }
|
||||
fn write_ptr() -> *mut T unsafe { (**self).write_ptr }
|
||||
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() }
|
||||
}
|
||||
|
||||
impl<T:Send,A> Handle<T,A> {
|
||||
impl<T:Owned,A> Handle<T,A> {
|
||||
/// Access the reader's view of the handle's data
|
||||
fn read<U>(f: fn(&T) -> U) -> U unsafe {
|
||||
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 ne(&self, other: &Handle<T,A>) -> bool { **self != **other }
|
||||
}
|
||||
|
||||
// Private methods
|
||||
impl<T: Copy Send,A> Scope<T,A> {
|
||||
impl<T: Copy Owned,A> Scope<T,A> {
|
||||
fn clone(v: *T) -> *T unsafe {
|
||||
let n: *mut 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);
|
||||
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());
|
||||
if h.write_ptr() != cast::reinterpret_cast(&h.read_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
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
fn null_handle<T:Send,A>() -> Handle<T,A> {
|
||||
fn null_handle<T:Owned,A>() -> Handle<T,A> {
|
||||
_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,
|
||||
mut free_list: ~[],
|
||||
mut first_dirty: null_handle()})
|
||||
}
|
||||
|
||||
// Writer methods
|
||||
impl<T:Copy Send,A> Scope<T,A> {
|
||||
impl<T:Copy Owned,A> Scope<T,A> {
|
||||
fn is_reader_forked() -> bool {
|
||||
self.d.layout_active
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
use au = gfx::geometry;
|
||||
use au::au;
|
||||
use dvec::DVec;
|
||||
use core::dvec::DVec;
|
||||
use geom::size::Size2D;
|
||||
use std::net::url::Url;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ pub fn TimerData(argc: libc::c_uint, argv: *JSVal) -> TimerData unsafe {
|
|||
impl Window {
|
||||
fn alert(s: &str) {
|
||||
// Right now, just print to the console
|
||||
io::println(#fmt("ALERT: %s", s));
|
||||
io::println(fmt!("ALERT: %s", s));
|
||||
}
|
||||
|
||||
fn close() {
|
||||
|
|
|
@ -2,7 +2,7 @@ use content::content_task::{ContentTask, ExecuteMsg, ParseMsg, ExitMsg};
|
|||
use content::content_task;
|
||||
use dom::event::Event;
|
||||
use layout::layout_task;
|
||||
use layout_task::LayoutTask;
|
||||
use layout::layout_task::LayoutTask;
|
||||
use resource::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
|
||||
use resource::resource_task::ResourceTask;
|
||||
use resource::resource_task;
|
||||
|
@ -23,7 +23,7 @@ pub enum Msg {
|
|||
ExitMsg(Chan<()>)
|
||||
}
|
||||
|
||||
pub struct Engine<C:Compositor Send Copy> {
|
||||
pub struct Engine<C:Compositor Owned Copy> {
|
||||
request_port: comm::Port<Msg>,
|
||||
compositor: C,
|
||||
render_task: RenderTask,
|
||||
|
@ -33,12 +33,12 @@ pub struct Engine<C:Compositor Send Copy> {
|
|||
content_task: ContentTask
|
||||
}
|
||||
|
||||
pub fn Engine<C:Compositor Send Copy>(compositor: C,
|
||||
opts: &Opts,
|
||||
dom_event_port: pipes::Port<Event>,
|
||||
dom_event_chan: pipes::SharedChan<Event>,
|
||||
resource_task: ResourceTask,
|
||||
image_cache_task: ImageCacheTask) -> EngineTask {
|
||||
pub fn Engine<C:Compositor Owned Copy>(compositor: C,
|
||||
opts: &Opts,
|
||||
dom_event_port: pipes::Port<Event>,
|
||||
dom_event_chan: pipes::SharedChan<Event>,
|
||||
resource_task: ResourceTask,
|
||||
image_cache_task: ImageCacheTask) -> EngineTask {
|
||||
|
||||
let dom_event_port = Cell(move dom_event_port);
|
||||
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() {
|
||||
while self.handle_request(self.request_port.recv()) {
|
||||
// Go on...
|
||||
|
@ -86,7 +86,7 @@ impl<C: Compositor Copy Send> Engine<C> {
|
|||
self.content_task.send(content_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));
|
||||
response_port.recv();
|
||||
|
|
|
@ -9,9 +9,9 @@ use resource::image_cache_task;
|
|||
use resource::resource_task::{Done, Load, Payload, ResourceTask};
|
||||
|
||||
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::Attribute;
|
||||
use newcss::stylesheet::Stylesheet;
|
||||
use std::net::url::Url;
|
||||
use std::net::url;
|
||||
|
@ -220,13 +220,13 @@ pub fn parse_html(scope: NodeScope,
|
|||
debug!("create doctype");
|
||||
// TODO: remove copying here by using struct pattern matching to
|
||||
// move all ~strs at once (blocked on Rust #3845, #3846, #3847)
|
||||
let public_id = match doctype.public_id {
|
||||
None => None,
|
||||
Some(id) => Some(copy id)
|
||||
let public_id = match &doctype.public_id {
|
||||
&None => None,
|
||||
&Some(id) => Some(copy id)
|
||||
};
|
||||
let system_id = match doctype.system_id {
|
||||
None => None,
|
||||
Some(id) => Some(copy id)
|
||||
let system_id = match &doctype.system_id {
|
||||
&None => None,
|
||||
&Some(id) => Some(copy id)
|
||||
};
|
||||
let data = DoctypeData(copy doctype.name, move public_id, move system_id,
|
||||
copy doctype.force_quirks);
|
||||
|
|
|
@ -140,8 +140,8 @@ impl RenderBox {
|
|||
}
|
||||
|
||||
pure fn is_whitespace_only() -> bool {
|
||||
match self {
|
||||
UnscannedTextBox(_, raw_text) => raw_text.is_whitespace(),
|
||||
match &self {
|
||||
&UnscannedTextBox(_, raw_text) => raw_text.is_whitespace(),
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
|
@ -235,30 +235,30 @@ impl RenderBox {
|
|||
* holder.get_image()
|
||||
*/
|
||||
fn get_min_width(_ctx: &LayoutContext) -> Au {
|
||||
match self {
|
||||
match &self {
|
||||
// TODO: this should account for min/pref widths of the
|
||||
// box element in isolation. That includes
|
||||
// border/margin/padding but not child widths. The block
|
||||
// FlowContext will combine the width of this element and
|
||||
// that of its children to arrive at the context width.
|
||||
GenericBox(*) => Au(0),
|
||||
&GenericBox(*) => Au(0),
|
||||
// TODO: consult CSS 'width', margin, border.
|
||||
// TODO: If image isn't available, consult '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),
|
||||
UnscannedTextBox(*) => fail ~"Shouldn't see unscanned boxes here."
|
||||
&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),
|
||||
&UnscannedTextBox(*) => fail ~"Shouldn't see unscanned boxes here."
|
||||
}
|
||||
}
|
||||
|
||||
fn get_pref_width(_ctx: &LayoutContext) -> Au {
|
||||
match self {
|
||||
match &self {
|
||||
// TODO: this should account for min/pref widths of the
|
||||
// box element in isolation. That includes
|
||||
// border/margin/padding but not child widths. The block
|
||||
// FlowContext will combine the width of this element and
|
||||
// that of its children to arrive at the context width.
|
||||
GenericBox(*) => Au(0),
|
||||
ImageBox(_,i) => Au::from_px(i.get_size().get_default(Size2D(0,0)).width),
|
||||
&GenericBox(*) => Au(0),
|
||||
&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.
|
||||
|
||||
|
@ -266,7 +266,7 @@ impl RenderBox {
|
|||
// they could report a smaller pref width during incremental reflow.
|
||||
// maybe text boxes should report nothing, and the parent flow could
|
||||
// factor in min/pref widths of any text runs that it owns.
|
||||
TextBox(_,d) => {
|
||||
&TextBox(_,d) => {
|
||||
let mut max_line_width: Au = Au(0);
|
||||
for d.run.iter_natural_lines_for_range(&const d.range) |line_range| {
|
||||
let mut line_width: Au = Au(0);
|
||||
|
@ -278,7 +278,7 @@ impl RenderBox {
|
|||
|
||||
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.
|
||||
Coordinates are relative to the owning flow. */
|
||||
pure fn content_box() -> Rect<Au> {
|
||||
match self {
|
||||
ImageBox(_,i) => {
|
||||
match &self {
|
||||
&ImageBox(_,i) => {
|
||||
let size = i.size();
|
||||
Rect {
|
||||
origin: copy self.d().position.origin,
|
||||
|
@ -312,7 +312,7 @@ impl RenderBox {
|
|||
Au::from_px(size.height))
|
||||
}
|
||||
},
|
||||
GenericBox(*) => {
|
||||
&GenericBox(*) => {
|
||||
copy self.d().position
|
||||
/* FIXME: The following hits an ICE for whatever reason
|
||||
|
||||
|
@ -327,10 +327,10 @@ impl RenderBox {
|
|||
size.height - (offset_top + offset_bottom))
|
||||
}*/
|
||||
},
|
||||
TextBox(*) => {
|
||||
&TextBox(*) => {
|
||||
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);
|
||||
|
||||
match *self {
|
||||
UnscannedTextBox(*) => fail ~"Shouldn't see unscanned boxes here.",
|
||||
TextBox(_,data) => {
|
||||
match self {
|
||||
@UnscannedTextBox(*) => fail ~"Shouldn't see unscanned boxes here.",
|
||||
@TextBox(_,data) => {
|
||||
let nearest_ancestor_element = self.nearest_ancestor_element();
|
||||
let color = nearest_ancestor_element.style().color().to_gfx_color();
|
||||
list.append_item(~DisplayItem::new_Text(&abs_box_bounds,
|
||||
|
@ -424,9 +424,9 @@ impl RenderBox {
|
|||
; ()});
|
||||
},
|
||||
// TODO: items for background, border, outline
|
||||
GenericBox(_) => {
|
||||
@GenericBox(_) => {
|
||||
},
|
||||
ImageBox(_,i) => {
|
||||
@ImageBox(_,i) => {
|
||||
match i.get_image() {
|
||||
Some(image) => {
|
||||
debug!("(building display list) building image box");
|
||||
|
|
|
@ -57,20 +57,24 @@ priv fn simulate_UA_display_rules(node: Node) -> CSSDisplay {
|
|||
if (resolved == CSSDisplayNone) { return resolved; }
|
||||
|
||||
do node.read |n| {
|
||||
match n.kind {
|
||||
~Doctype(*) | ~Comment(*) => CSSDisplayNone,
|
||||
~Text(*) => CSSDisplayInline,
|
||||
~Element(e) => match e.kind {
|
||||
~HTMLHeadElement(*) => CSSDisplayNone,
|
||||
~HTMLScriptElement(*) => CSSDisplayNone,
|
||||
~HTMLParagraphElement(*) => CSSDisplayBlock,
|
||||
~HTMLDivElement(*) => CSSDisplayBlock,
|
||||
~HTMLBodyElement(*) => CSSDisplayBlock,
|
||||
~HTMLHeadingElement(*) => CSSDisplayBlock,
|
||||
~HTMLHtmlElement(*) => CSSDisplayBlock,
|
||||
~HTMLUListElement(*) => CSSDisplayBlock,
|
||||
~HTMLOListElement(*) => CSSDisplayBlock,
|
||||
_ => resolved
|
||||
let kind: &dom::node::NodeKind = n.kind;
|
||||
match kind {
|
||||
&Doctype(*) | &Comment(*) => CSSDisplayNone,
|
||||
&Text(*) => CSSDisplayInline,
|
||||
&Element(ref e) => {
|
||||
let kind: &dom::element::ElementKind = e.kind;
|
||||
match kind {
|
||||
&HTMLHeadElement(*) => CSSDisplayNone,
|
||||
&HTMLScriptElement(*) => CSSDisplayNone,
|
||||
&HTMLParagraphElement(*) => CSSDisplayBlock,
|
||||
&HTMLDivElement(*) => CSSDisplayBlock,
|
||||
&HTMLBodyElement(*) => CSSDisplayBlock,
|
||||
&HTMLHeadingElement(*) => CSSDisplayBlock,
|
||||
&HTMLHtmlElement(*) => CSSDisplayBlock,
|
||||
&HTMLUListElement(*) => CSSDisplayBlock,
|
||||
&HTMLOListElement(*) => CSSDisplayBlock,
|
||||
_ => resolved
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,6 +108,8 @@ impl BoxGenerator {
|
|||
// TODO: remove this once UA styles work
|
||||
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.
|
||||
match self.flow {
|
||||
@InlineFlow(*) => {
|
||||
|
@ -126,6 +132,7 @@ impl BoxGenerator {
|
|||
// TODO: cases for inline-block, etc.
|
||||
},
|
||||
@BlockFlow(*) => {
|
||||
debug!("BoxGenerator[f%d]: point b", self.flow.d().id);
|
||||
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)",
|
||||
self.flow.d().id, new_box.d().id, node.debug_str());
|
||||
|
@ -134,7 +141,9 @@ impl BoxGenerator {
|
|||
self.flow.block().box = Some(new_box);
|
||||
},
|
||||
@RootFlow(*) => {
|
||||
debug!("BoxGenerator[f%d]: point c", self.flow.d().id);
|
||||
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)",
|
||||
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,
|
||||
and recurses on its children. */
|
||||
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) {
|
||||
Some(move ctx) => move ctx,
|
||||
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);
|
||||
debug!("point b: %s", cur_node.debug_str());
|
||||
|
||||
// recurse on child nodes.
|
||||
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 {
|
||||
@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 {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
export DisplayListBuilder;
|
||||
|
||||
use au = gfx::geometry;
|
||||
use au::Au;
|
||||
use newcss::values::Specified;
|
||||
use newcss::values::{CSSBackgroundColorColor, CSSBackgroundColorTransparent};
|
||||
use dom::node::{Text, NodeScope};
|
||||
|
@ -19,6 +17,7 @@ use util::tree;
|
|||
use vec::push;
|
||||
|
||||
use gfx::display_list::DisplayList;
|
||||
use gfx::geometry::Au;
|
||||
|
||||
/** A builder object that manages display list builder should mainly
|
||||
hold information about the initial request and desired result---for
|
||||
|
@ -42,7 +41,7 @@ trait FlowDisplayListBuilderMethods {
|
|||
impl FlowContext: FlowDisplayListBuilderMethods {
|
||||
fn build_display_list(@self, builder: &DisplayListBuilder, dirty: &Rect<Au>,
|
||||
list: &mut DisplayList) {
|
||||
let zero = au::zero_point();
|
||||
let zero = gfx::geometry::zero_point();
|
||||
self.build_display_list_recurse(builder, dirty, &zero, list);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ trait UnscannedMethods {
|
|||
|
||||
impl RenderBox : UnscannedMethods {
|
||||
pure fn raw_text() -> ~str {
|
||||
match self {
|
||||
UnscannedTextBox(_, s) => copy s,
|
||||
match &self {
|
||||
&UnscannedTextBox(_, s) => copy s,
|
||||
_ => fail ~"unsupported operation: box.raw_text() on non-unscanned text box."
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use ShareGlContext = sharegl::platform::Context;
|
||||
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 core::dvec::DVec;
|
||||
|
@ -334,7 +334,7 @@ fn Surface(backend: BackendType) -> Surface {
|
|||
}
|
||||
|
||||
/// 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)
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ impl ResizeRateLimiter {
|
|||
}
|
||||
|
||||
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.last_response_port = Some(move port);
|
||||
}
|
||||
|
|
|
@ -148,9 +148,9 @@ fn main() {
|
|||
|
||||
#[allow(non_implicitly_copyable_typarams)]
|
||||
fn run(opts: &Opts) {
|
||||
match opts.render_mode {
|
||||
Screen => run_pipeline_screen(opts),
|
||||
Png(outfile) => {
|
||||
match &opts.render_mode {
|
||||
&Screen => run_pipeline_screen(opts),
|
||||
&Png(outfile) => {
|
||||
assert opts.urls.is_not_empty();
|
||||
if opts.urls.len() > 1u {
|
||||
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) {
|
||||
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);
|
||||
|
||||
// The platform event handler thread
|
||||
let osmain = OSMain(dom_event_chan.clone(), copy *opts);
|
||||
|
||||
// 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));
|
||||
|
||||
// Create a servo instance
|
||||
|
@ -191,7 +191,7 @@ fn run_pipeline_screen(opts: &Opts) {
|
|||
|
||||
// Shut everything 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));
|
||||
exit_response_from_engine.recv();
|
||||
|
||||
|
@ -212,7 +212,7 @@ fn run_pipeline_png(url: ~str, outfile: &str) {
|
|||
use resource::image_cache_task::SyncImageCacheTask;
|
||||
|
||||
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 compositor = PngCompositor(pngdata_from_compositor);
|
||||
|
|
|
@ -11,11 +11,11 @@ Actors are only referred to by opaque handles parameterized
|
|||
over the actor's message type, which can be considered the
|
||||
actor's interface.
|
||||
*/
|
||||
struct ActorRef<M: Send> {
|
||||
struct ActorRef<M: Owned> {
|
||||
chan: Chan<M>,
|
||||
}
|
||||
|
||||
impl<M: Send> ActorRef<M> {
|
||||
impl<M: Owned> ActorRef<M> {
|
||||
fn send(&self, msg: M) {
|
||||
self.chan.send(move msg);
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ trait Actor<M> {
|
|||
}
|
||||
|
||||
/// A helper function used by actor constructors
|
||||
fn spawn<A: Actor<M>, M: Send>(f: ~fn() -> A) -> ActorRef<M> {
|
||||
let (chan, port) = stream();
|
||||
fn spawn<A: Actor<M>, M: Owned>(f: ~fn() -> A) -> ActorRef<M> {
|
||||
let (port, chan) = stream();
|
||||
do task::spawn |move f, move port| {
|
||||
let actor = f();
|
||||
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>
|
||||
}
|
||||
|
||||
impl<M: Send> SharedActorRef<M> {
|
||||
impl<M: Owned> SharedActorRef<M> {
|
||||
fn send(&self, msg: M) {
|
||||
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 {
|
||||
ActorRef {
|
||||
chan: move chan
|
||||
|
@ -112,7 +112,7 @@ mod test {
|
|||
#[test]
|
||||
fn test_exit() {
|
||||
let actor = HelloActor(~"bob");
|
||||
let (chan, port) = stream();
|
||||
let (port, chan) = stream();
|
||||
actor.send(Exit(move chan));
|
||||
port.recv();
|
||||
}
|
||||
|
@ -123,17 +123,17 @@ mod test {
|
|||
let actor1 = SharedActorRef(move actor);
|
||||
let actor2 = actor1.clone();
|
||||
|
||||
let (chan1, port1) = stream();
|
||||
let (port1, chan1) = stream();
|
||||
actor1.send(GetName(move chan1));
|
||||
let (chan2, port2) = stream();
|
||||
let (port2, chan2) = stream();
|
||||
actor2.send(GetName(move chan2));
|
||||
|
||||
assert port1.recv() == ~"bob";
|
||||
assert port2.recv() == ~"bob";
|
||||
|
||||
let (chan, port) = stream();
|
||||
let (port, chan) = stream();
|
||||
actor1.send(Exit(move chan));
|
||||
port.recv();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 38e440727470f034bda3d47faa22a84985e7a958
|
||||
Subproject commit d1f1e591c7a3b53b19d037aa33c79c5c7606d411
|
Loading…
Add table
Add a link
Reference in a new issue