Other language changes

This commit is contained in:
Keegan McAllister 2013-10-29 14:55:17 -07:00 committed by Jack Moffitt
parent 4d23ce41af
commit b451ff3e15
13 changed files with 45 additions and 45 deletions

View file

@ -8,7 +8,7 @@
url = "http://servo.org/")];
#[crate_type = "lib"];
#[feature(globs)];
#[feature(globs, managed_boxes)];
extern mod azure;
extern mod extra;

View file

@ -530,24 +530,20 @@ impl FlowContext for InlineFlow {
child_base.floats_in = FloatContext::new(child_base.num_floats);
}
{
let this = &mut *self;
let mut min_width = Au::new(0);
let mut pref_width = Au::new(0);
let mut min_width = Au::new(0);
let mut pref_width = Au::new(0);
for box in this.boxes.iter() {
debug!("FlowContext[{:d}]: measuring {:s}", self.base.id, box.debug_str());
let (this_minimum_width, this_preferred_width) =
box.minimum_and_preferred_widths();
min_width = Au::max(min_width, this_minimum_width);
pref_width = Au::max(pref_width, this_preferred_width);
}
this.base.min_width = min_width;
this.base.pref_width = pref_width;
this.base.num_floats = num_floats;
for box in self.boxes.iter() {
debug!("FlowContext[{:d}]: measuring {:s}", self.base.id, box.debug_str());
let (this_minimum_width, this_preferred_width) =
box.minimum_and_preferred_widths();
min_width = Au::max(min_width, this_minimum_width);
pref_width = Au::max(pref_width, this_preferred_width);
}
self.base.min_width = min_width;
self.base.pref_width = pref_width;
self.base.num_floats = num_floats;
}
/// Recursively (top-down) determines the actual width of child contexts and boxes. When called

View file

@ -101,9 +101,8 @@ impl Pipeline {
// Wrap task creation within a supervised task so that failure will
// only tear down those tasks instead of ours.
let failure_chan = constellation_chan.clone();
let (task_port, task_chan) = stream::<task::TaskResult>();
let mut supervised_task = task::task();
supervised_task.opts.notify_chan = Some(task_chan);
let task_port = supervised_task.future_result();
supervised_task.supervised();
spawn_with!(supervised_task, [script_port, resource_task, size, render_port,
@ -138,8 +137,8 @@ impl Pipeline {
spawn_with!(task::task(), [failure_chan], {
match task_port.recv() {
task::Success => (),
task::Failure => {
Ok(*) => (),
Err(*) => {
failure_chan.send(FailureMsg(id, subpage_id));
}
}

View file

@ -11,7 +11,7 @@
#[license = "MPL"];
#[crate_type = "lib"];
#[feature(globs, macro_rules)];
#[feature(globs, macro_rules, managed_boxes)];
extern mod alert;
extern mod azure;

View file

@ -3,8 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use resource_task::{Metadata, Payload, Done, LoaderTask, start_sending};
use servo_util::io::ignoring_eof;
use std::io::{ReaderUtil, file_reader};
use std::rt::io;
use std::rt::io::Reader;
use std::task;
static READ_SIZE: uint = 1024;
@ -14,15 +16,17 @@ pub fn factory() -> LoaderTask {
assert!("file" == url.scheme);
let progress_chan = start_sending(start_chan, Metadata::default(url.clone()));
do task::spawn {
match file_reader(&from_str(url.path).unwrap()) {
Ok(reader) => {
match io::file::open(&url.path.as_slice(), io::Open, io::Read) {
Some(mut reader) => {
while !reader.eof() {
let data = reader.read_bytes(READ_SIZE);
progress_chan.send(Payload(data));
do ignoring_eof {
let data = reader.read_bytes(READ_SIZE);
progress_chan.send(Payload(data));
}
}
progress_chan.send(Done(Ok(())));
}
Err(*) => {
None => {
progress_chan.send(Done(Err(())));
}
};

View file

@ -14,10 +14,10 @@ pub fn Image(width: uint, height: uint, depth: uint, data: ~[u8]) -> Image {
stb_image::new_image(width, height, depth, data)
}
static TEST_IMAGE: [u8, ..4962] = include_bin!("test.jpeg");
static TEST_IMAGE: &'static [u8] = include_bin!("test.jpeg");
pub fn test_image_bin() -> ~[u8] {
return vec::from_fn(4962, |i| TEST_IMAGE[i]);
TEST_IMAGE.into_owned()
}
pub fn load_from_memory(buffer: &[u8]) -> Option<Image> {

View file

@ -8,7 +8,7 @@
url = "http://servo.org/")];
#[crate_type = "lib"];
#[feature(globs)];
#[feature(globs, managed_boxes)];
extern mod geom;
extern mod http;

View file

@ -23,7 +23,6 @@ use std::cell::Cell;
use std::comm;
use std::comm::SharedChan;
use std::hashmap::HashSet;
use std::io;
use std::ptr;
use std::int;
use std::libc;
@ -74,7 +73,7 @@ pub struct TimerData {
impl Window {
pub fn Alert(&self, s: &DOMString) {
// Right now, just print to the console
io::println(format!("ALERT: {:s}", null_str_as_empty(s)));
println(format!("ALERT: {:s}", null_str_as_empty(s)));
}
pub fn Close(&self) {

View file

@ -11,7 +11,7 @@
#[license = "MPL"];
#[crate_type = "lib"];
#[feature(globs, macro_rules, struct_variant)];
#[feature(globs, macro_rules, struct_variant, managed_boxes)];
extern mod geom;
extern mod gfx (name = "gfx");

View file

@ -11,7 +11,7 @@
#[license = "MPL"];
#[crate_type = "lib"];
#[feature(globs, macro_rules)];
#[feature(globs, macro_rules, managed_boxes)];
extern mod extra;
extern mod cssparser;

View file

@ -2,24 +2,26 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::io;
use std::rt::io;
use std::rt::io::Writer;
use std::vec::raw::buf_as_slice;
use std::cast::transmute;
use std::mem::size_of;
fn hexdump_slice(buf: &[u8]) {
let stderr = io::stderr();
stderr.write_str(" ");
let mut stderr = io::stderr();
stderr.write(bytes!(" "));
for (i, &v) in buf.iter().enumerate() {
stderr.write_str(format!("{:02X} ", v as uint));
let output = format!("{:02X} ", v as uint);
stderr.write(output.as_bytes());
match i % 16 {
15 => stderr.write_str("\n "),
7 => stderr.write_str(" "),
15 => stderr.write(bytes!("\n ")),
7 => stderr.write(bytes!(" ")),
_ => ()
}
stderr.flush();
}
stderr.write_char('\n');
stderr.write(bytes!("\n"));
}
pub fn hexdump<T>(obj: &T) {

View file

@ -8,7 +8,7 @@
url = "http://servo.org/")];
#[crate_type = "lib"];
#[feature(macro_rules)];
#[feature(macro_rules, managed_boxes)];
extern mod extra;
extern mod geom;

View file

@ -12,7 +12,7 @@ extern mod extra;
use extra::test::{TestOpts, run_tests_console, TestDesc, TestDescAndFn, DynTestFn, DynTestName};
use extra::getopts::{getopts, reqopt};
use std::{os, run, io, str};
use std::{os, run, str};
use std::cell::Cell;
use std::os::list_dir_path;
@ -89,7 +89,7 @@ fn run_test(file: ~str) {
let infile = ~"file://" + path.display().to_str();
let res = run::process_output("./servo", [~"-z", infile]);
let out = str::from_utf8(res.output);
io::print(out);
print(out);
let lines: ~[&str] = out.split_iter('\n').collect();
for &line in lines.iter() {
if line.contains("TEST-UNEXPECTED-FAIL") {