Skip to content

Commit

Permalink
auto merge of #2041 : mozilla/servo/rustup_20140321b, r=larsbergstrom
Browse files Browse the repository at this point in the history
  • Loading branch information
bors-servo committed Apr 4, 2014
2 parents 7ece5f9 + 4b8254f commit 83aabe3
Show file tree
Hide file tree
Showing 103 changed files with 771 additions and 876 deletions.
2 changes: 1 addition & 1 deletion src/compiler/rust
Submodule rust updated from 68a4f7 to aa39d7
2 changes: 1 addition & 1 deletion src/compiler/rust-auto-clean-trigger
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# If this file is modified, then rust will be forcibly cleaned and then rebuilt.
# The actual contents of this file do not matter, but to trigger a change on the
# build bots then the contents should be changed so git updates the mtime.
2014-02-24
2014-03-23
6 changes: 6 additions & 0 deletions src/components/gfx/buffer_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ impl Eq for BufferKey {
}
}

impl TotalEq for BufferKey {
fn equals(&self, other: &BufferKey) -> bool {
self.eq(other)
}
}

/// Create a key from a given size
impl BufferKey {
fn get(input: Size2D<uint>) -> BufferKey {
Expand Down
22 changes: 11 additions & 11 deletions src/components/gfx/display_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use servo_util::range::Range;
use servo_util::smallvec::{SmallVec, SmallVec0, SmallVecIterator};
use std::libc::uintptr_t;
use std::mem;
use std::vec::Items;
use std::slice::Items;
use style::computed_values::border_style;
use sync::Arc;

Expand Down Expand Up @@ -351,18 +351,18 @@ impl DisplayItem {
let text_run = text.text_run.get();
let font = render_context.font_ctx.get_font_by_descriptor(&text_run.font_descriptor).unwrap();

let font_metrics = font.borrow().with(|font| {
font.metrics.clone()
});
let font_metrics = {
font.borrow().metrics.clone()
};
let origin = text.base.bounds.origin;
let baseline_origin = Point2D(origin.x, origin.y + font_metrics.ascent);
font.borrow().with_mut(|font| {
font.draw_text_into_context(render_context,
text.text_run.get(),
&text.range,
baseline_origin,
text.text_color);
});
{
font.borrow_mut().draw_text_into_context(render_context,
text.text_run.get(),
&text.range,
baseline_origin,
text.text_color);
}
let width = text.base.bounds.size.width;
let underline_size = font_metrics.underline_size;
let underline_offset = font_metrics.underline_offset;
Expand Down
4 changes: 1 addition & 3 deletions src/components/gfx/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,7 @@ impl FontGroup {
assert!(self.fonts.len() > 0);

// TODO(Issue #177): Actually fall back through the FontGroup when a font is unsuitable.
self.fonts[0].borrow().with_mut(|font| {
TextRun::new(font, text.clone(), decoration)
})
TextRun::new(&mut *self.fonts[0].borrow_mut(), text.clone(), decoration)
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/components/gfx/gfx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@

#[feature(globs, managed_boxes, macro_rules, phase)];

#[feature(phase)];
#[phase(syntax, link)]
extern crate log;

extern crate azure;
extern crate collections;
extern crate extra;
extern crate geom;
extern crate layers;
extern crate stb_image;
Expand Down
6 changes: 3 additions & 3 deletions src/components/gfx/platform/linux/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl FontHandleMethods for FontHandle {
buf: ~[u8],
style: &SpecifiedFontStyle)
-> Result<FontHandle, ()> {
let ft_ctx: FT_Library = fctx.ctx.borrow().ctx;
let ft_ctx: FT_Library = fctx.ctx.ctx;
if ft_ctx.is_null() { return Err(()); }

let face_result = create_face_from_buffer(ft_ctx, buf.as_ptr(), buf.len(), style.pt_size);
Expand Down Expand Up @@ -279,7 +279,7 @@ impl<'a> FontHandle {
pub fn new_from_file(fctx: &FontContextHandle, file: &str,
style: &SpecifiedFontStyle) -> Result<FontHandle, ()> {
unsafe {
let ft_ctx: FT_Library = fctx.ctx.borrow().ctx;
let ft_ctx: FT_Library = fctx.ctx.ctx;
if ft_ctx.is_null() { return Err(()); }

let mut face: FT_Face = ptr::null();
Expand All @@ -306,7 +306,7 @@ impl<'a> FontHandle {
pub fn new_from_file_unstyled(fctx: &FontContextHandle, file: ~str)
-> Result<FontHandle, ()> {
unsafe {
let ft_ctx: FT_Library = fctx.ctx.borrow().ctx;
let ft_ctx: FT_Library = fctx.ctx.ctx;
if ft_ctx.is_null() { return Err(()); }

let mut face: FT_Face = ptr::null();
Expand Down
16 changes: 8 additions & 8 deletions src/components/gfx/render_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use servo_util::time::{ProfilerChan, profile};
use servo_util::time;
use servo_util::task::send_on_failure;

use std::comm::{Chan, Port};
use std::comm::{channel, Receiver, Sender};
use std::task;
use sync::Arc;

Expand All @@ -53,7 +53,7 @@ pub enum Msg {
UnusedBufferMsg(~[~LayerBuffer]),
PaintPermissionGranted,
PaintPermissionRevoked,
ExitMsg(Option<Chan<()>>),
ExitMsg(Option<Sender<()>>),
}

/// A request from the compositor to the renderer for tiles that need to be (re)displayed.
Expand All @@ -75,7 +75,7 @@ pub fn BufferRequest(screen_rect: Rect<uint>, page_rect: Rect<f32>) -> BufferReq

// FIXME(#2005, pcwalton): This should be a newtype struct.
pub struct RenderChan {
chan: Chan<Msg>,
chan: Sender<Msg>,
}

impl Clone for RenderChan {
Expand All @@ -87,8 +87,8 @@ impl Clone for RenderChan {
}

impl RenderChan {
pub fn new() -> (Port<Msg>, RenderChan) {
let (port, chan) = Chan::new();
pub fn new() -> (Receiver<Msg>, RenderChan) {
let (chan, port) = channel();
let render_chan = RenderChan {
chan: chan,
};
Expand All @@ -113,7 +113,7 @@ enum GraphicsContext {

pub struct RenderTask<C> {
id: PipelineId,
port: Port<Msg>,
port: Receiver<Msg>,
compositor: C,
constellation_chan: ConstellationChan,
font_ctx: ~FontContext,
Expand Down Expand Up @@ -167,13 +167,13 @@ fn initialize_layers<C:RenderListener>(

impl<C: RenderListener + Send> RenderTask<C> {
pub fn create(id: PipelineId,
port: Port<Msg>,
port: Receiver<Msg>,
compositor: C,
constellation_chan: ConstellationChan,
failure_msg: Failure,
opts: Opts,
profiler_chan: ProfilerChan,
shutdown_chan: Chan<()>) {
shutdown_chan: Sender<()>) {
let mut builder = task::task().named("RenderTask");
let ConstellationChan(c) = constellation_chan.clone();
send_on_failure(&mut builder, FailureMsg(failure_msg), c);
Expand Down
6 changes: 3 additions & 3 deletions src/components/gfx/text/glyph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::cmp::{Ord, Eq};
use std::num::NumCast;
use std::mem;
use std::u16;
use std::vec;
use std::slice;
use std::iter;
use geom::point::Point2D;

Expand Down Expand Up @@ -514,7 +514,7 @@ impl<'a> GlyphStore {
assert!(length > 0);

GlyphStore {
entry_buffer: vec::from_elem(length, GlyphEntry::initial()),
entry_buffer: slice::from_elem(length, GlyphEntry::initial()),
detail_store: DetailedGlyphStore::new(),
is_whitespace: is_whitespace,
}
Expand Down Expand Up @@ -566,7 +566,7 @@ impl<'a> GlyphStore {
let entry = match first_glyph_data.is_missing {
true => GlyphEntry::missing(glyph_count),
false => {
let glyphs_vec = vec::from_fn(glyph_count, |i| {
let glyphs_vec = slice::from_fn(glyph_count, |i| {
DetailedGlyph::new(data_for_glyphs[i].index,
data_for_glyphs[i].advance,
data_for_glyphs[i].offset)
Expand Down
6 changes: 3 additions & 3 deletions src/components/gfx/text/shaping/harfbuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use std::char;
use std::cmp;
use std::libc::{c_uint, c_int, c_void, c_char};
use std::ptr::null;
use std::vec;
use std::slice;

static NO_GLYPH: i32 = -1;
static CONTINUATION_BYTE: i32 = -2;
Expand Down Expand Up @@ -246,9 +246,9 @@ impl Shaper {

// fast path: all chars are single-byte.
if byte_max == char_max {
byteToGlyph = vec::from_elem(byte_max, NO_GLYPH);
byteToGlyph = slice::from_elem(byte_max, NO_GLYPH);
} else {
byteToGlyph = vec::from_elem(byte_max, CONTINUATION_BYTE);
byteToGlyph = slice::from_elem(byte_max, CONTINUATION_BYTE);
for (i, _) in text.char_indices() {
byteToGlyph[i] = NO_GLYPH;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/gfx/text/text_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use font::{Font, FontDescriptor, RunMetrics, FontStyle, FontMetrics};
use servo_util::geometry::Au;
use servo_util::range::Range;
use std::vec::Items;
use std::slice::Items;
use style::computed_values::text_decoration;
use sync::Arc;
use text::glyph::GlyphStore;
Expand Down
42 changes: 20 additions & 22 deletions src/components/main/compositing/compositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ use servo_msg::constellation_msg;
use servo_util::opts::Opts;
use servo_util::time::{profile, ProfilerChan, Timer};
use servo_util::{time, url};
use std::cmp;
use std::comm::{Empty, Disconnected, Data, Port};
use std::comm::{Empty, Disconnected, Data, Sender, Receiver};
use std::path::Path;
use std::rc::Rc;
use time::precise_time_s;
Expand All @@ -46,7 +45,7 @@ pub struct IOCompositor {
window: Rc<Window>,

/// The port on which we receive messages.
port: Port<Msg>,
port: Receiver<Msg>,

/// The render context.
context: RenderContext,
Expand Down Expand Up @@ -114,7 +113,7 @@ pub struct IOCompositor {
impl IOCompositor {
pub fn new(app: &Application,
opts: Opts,
port: Port<Msg>,
port: Receiver<Msg>,
constellation_chan: ConstellationChan,
profiler_chan: ProfilerChan) -> IOCompositor {
let window: Rc<Window> = WindowMethods::new(app);
Expand All @@ -124,7 +123,7 @@ impl IOCompositor {
// TODO: There should be no initial layer tree until the renderer creates one from the display
// list. This is only here because we don't have that logic in the renderer yet.
let root_layer = Rc::new(ContainerLayer());
let window_size = window.borrow().size();
let window_size = window.size();

IOCompositor {
window: window,
Expand Down Expand Up @@ -154,7 +153,7 @@ impl IOCompositor {

pub fn create(app: &Application,
opts: Opts,
port: Port<Msg>,
port: Receiver<Msg>,
constellation_chan: ConstellationChan,
profiler_chan: ProfilerChan) {
let mut compositor = IOCompositor::new(app,
Expand Down Expand Up @@ -187,7 +186,7 @@ impl IOCompositor {
}

// Check for messages coming from the windowing system.
let msg = self.window.borrow().recv();
let msg = self.window.recv();
self.handle_window_message(msg);

// If asked to recomposite and renderer has run at least once
Expand Down Expand Up @@ -247,7 +246,7 @@ impl IOCompositor {
}

(Data(ChangeReadyState(ready_state)), false) => {
self.window.borrow().set_ready_state(ready_state);
self.window.set_ready_state(ready_state);
self.ready_state = ready_state;
}

Expand Down Expand Up @@ -320,7 +319,7 @@ impl IOCompositor {
}

fn change_render_state(&mut self, render_state: RenderState) {
self.window.borrow().set_render_state(render_state);
self.window.set_render_state(render_state);
if render_state == IdleRenderState {
self.composite_ready = true;
}
Expand All @@ -336,14 +335,14 @@ impl IOCompositor {

fn set_ids(&mut self,
frame_tree: SendableFrameTree,
response_chan: Chan<()>,
response_chan: Sender<()>,
new_constellation_chan: ConstellationChan) {
response_chan.send(());

self.root_pipeline = Some(frame_tree.pipeline.clone());

// Initialize the new constellation channel by sending it the root window size.
let window_size = self.window.borrow().size();
let window_size = self.window.size();
let window_size = Size2D(window_size.width as uint,
window_size.height as uint);
{
Expand Down Expand Up @@ -378,13 +377,10 @@ impl IOCompositor {
self.opts.tile_size,
self.opts.cpu_painting);

{
let current_child = self.root_layer.borrow().first_child.borrow();
match *current_child.get() {
None => {}
Some(ref old_layer) => {
ContainerLayer::remove_child(self.root_layer.clone(), old_layer.clone())
}
match self.root_layer.first_child.get() {
None => {}
Some(ref old_layer) => {
ContainerLayer::remove_child(self.root_layer.clone(), old_layer.clone())
}
}

Expand Down Expand Up @@ -685,10 +681,12 @@ impl IOCompositor {
let window_size = &self.window_size;

// Determine zoom amount
self.world_zoom = cmp::max(self.world_zoom * magnification, 1.0);
self.world_zoom = (self.world_zoom * magnification).max(1.0);
let world_zoom = self.world_zoom;

self.root_layer.borrow().common.with_mut(|common| common.set_transform(identity().scale(world_zoom, world_zoom, 1f32)));
{
self.root_layer.common.borrow_mut().set_transform(identity().scale(world_zoom, world_zoom, 1f32));
}

// Scroll as needed
let page_delta = Point2D(window_size.width as f32 * (1.0 / world_zoom - 1.0 / old_world_zoom) * 0.5,
Expand Down Expand Up @@ -736,7 +734,7 @@ impl IOCompositor {
profile(time::CompositingCategory, self.profiler_chan.clone(), || {
debug!("compositor: compositing");
// Adjust the layer dimensions as necessary to correspond to the size of the window.
self.scene.size = self.window.borrow().size();
self.scene.size = self.window.size();
// Render the scene.
match self.compositor_layer {
Some(ref mut layer) => {
Expand Down Expand Up @@ -786,7 +784,7 @@ impl IOCompositor {
self.shutting_down = true;
}

self.window.borrow().present();
self.window.present();

let exit = self.opts.exit_after_load;
if exit {
Expand Down
Loading

0 comments on commit 83aabe3

Please sign in to comment.