aboutsummaryrefslogtreecommitdiffstats
path: root/src/servo/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/servo/util')
-rw-r--r--src/servo/util/color.rs10
-rw-r--r--src/servo/util/time.rs2
-rw-r--r--src/servo/util/tree.rs14
-rw-r--r--src/servo/util/url.rs2
4 files changed, 14 insertions, 14 deletions
diff --git a/src/servo/util/color.rs b/src/servo/util/color.rs
index 456bf1c525a..2a5cd5d063a 100644
--- a/src/servo/util/color.rs
+++ b/src/servo/util/color.rs
@@ -9,7 +9,7 @@ use libc::types::os::arch::c95::c_double;
use css_colors::*;
use cmp::Eq;
-enum Color = {red : u8, green : u8, blue : u8, alpha : float};
+pub enum Color = {red : u8, green : u8, blue : u8, alpha : float};
impl Color : Eq {
pure fn eq(other: &Color) -> bool {
@@ -21,15 +21,15 @@ impl Color : Eq {
}
}
-fn rgba(r : u8, g : u8, b : u8, a : float) -> Color {
+pub fn rgba(r : u8, g : u8, b : u8, a : float) -> Color {
Color({red : r, green : g, blue : b, alpha : a})
}
-fn rgb(r : u8, g : u8, b : u8) -> Color {
+pub fn rgb(r : u8, g : u8, b : u8) -> Color {
return rgba(r, g, b, 1.0);
}
-fn hsla(h : float, s : float, l : float, a : float) -> Color {
+pub fn hsla(h : float, s : float, l : float, a : float) -> Color {
// Algorithm for converting hsl to rbg taken from
// http://www.w3.org/TR/2003/CR-css3-color-20030514/#hsl-color
let m2 = if l <= 0.5 { l*(s + 1.0) } else { l + s - l*s };
@@ -55,7 +55,7 @@ fn hsla(h : float, s : float, l : float, a : float) -> Color {
return rgba(r as u8, g as u8, b as u8, a);
}
-fn hsl(h : float, s : float, l : float) -> Color {
+pub fn hsl(h : float, s : float, l : float) -> Color {
return hsla(h, s, l, 1.0);
}
diff --git a/src/servo/util/time.rs b/src/servo/util/time.rs
index 09a06966b50..975d7639055 100644
--- a/src/servo/util/time.rs
+++ b/src/servo/util/time.rs
@@ -1,7 +1,7 @@
// Timing functions.
use std::time::precise_time_ns;
-fn time(msg: ~str, callback: fn()) {
+pub fn time(msg: ~str, callback: fn()) {
let start_time = precise_time_ns();
callback();
let end_time = precise_time_ns();
diff --git a/src/servo/util/tree.rs b/src/servo/util/tree.rs
index 32998d506ea..eaf220aea6b 100644
--- a/src/servo/util/tree.rs
+++ b/src/servo/util/tree.rs
@@ -4,7 +4,7 @@ use core::vec;
//
// TODO: Use traits.
-type Tree<T> = {
+pub type Tree<T> = {
mut parent: Option<T>,
mut first_child: Option<T>,
mut last_child: Option<T>,
@@ -12,15 +12,15 @@ type Tree<T> = {
mut next_sibling: Option<T>
};
-trait ReadMethods<T> {
+pub trait ReadMethods<T> {
fn with_tree_fields<R>(T, f: fn(Tree<T>) -> R) -> R;
}
-trait WriteMethods<T> {
+pub trait WriteMethods<T> {
fn with_tree_fields<R>(T, f: fn(Tree<T>) -> R) -> R;
}
-fn each_child<T:Copy,O:ReadMethods<T>>(ops: O, node: T, f: fn(T) -> bool) {
+pub fn each_child<T:Copy,O:ReadMethods<T>>(ops: O, node: T, f: fn(T) -> bool) {
let mut p = ops.with_tree_fields(node, |f| f.first_child);
loop {
match copy p {
@@ -33,7 +33,7 @@ fn each_child<T:Copy,O:ReadMethods<T>>(ops: O, node: T, f: fn(T) -> bool) {
}
}
-fn empty<T>() -> Tree<T> {
+pub fn empty<T>() -> Tree<T> {
{mut parent: None,
mut first_child: None,
mut last_child: None,
@@ -41,7 +41,7 @@ fn empty<T>() -> Tree<T> {
mut next_sibling: None}
}
-fn add_child<T:Copy,O:WriteMethods<T>>(ops: O, parent: T, child: T) {
+pub fn add_child<T:Copy,O:WriteMethods<T>>(ops: O, parent: T, child: T) {
ops.with_tree_fields(child, |child_tf| {
match child_tf.parent {
@@ -72,7 +72,7 @@ fn add_child<T:Copy,O:WriteMethods<T>>(ops: O, parent: T, child: T) {
});
}
-fn get_parent<T:Copy,O:ReadMethods<T>>(ops: O, node: T) -> Option<T> {
+pub fn get_parent<T:Copy,O:ReadMethods<T>>(ops: O, node: T) -> Option<T> {
ops.with_tree_fields(node, |tf| tf.parent)
}
diff --git a/src/servo/util/url.rs b/src/servo/util/url.rs
index 81766f4cd01..90462a45cad 100644
--- a/src/servo/util/url.rs
+++ b/src/servo/util/url.rs
@@ -17,7 +17,7 @@ Create a URL object from a string. Does various helpful browsery things like
#[allow(non_implicitly_copyable_typarams)]
fn make_url(str_url: ~str, current_url: Option<Url>) -> Url {
let mut schm = url::get_scheme(str_url);
- let str_url = if result::is_err(schm) {
+ let str_url = if result::is_err(&schm) {
if current_url.is_none() {
// If all we have is a filename, assume it's a local relative file
// and build an absolute path with the cwd