Changes based on review

This commit is contained in:
Matt Murphy 2014-04-30 17:34:13 -05:00 committed by Ms2ger
parent af920f442b
commit 8b94a44c0b
9 changed files with 17 additions and 17 deletions

View file

@ -54,7 +54,7 @@ impl BufferKey {
/// A helper struct to keep track of buffers in the HashMap
struct BufferValue<T> {
/// An array of buffers, all the same size
buffers: Vec<T>,
buffers: Vec<T>,
/// The counter when this size was last requested
last_action: uint,
}

View file

@ -256,7 +256,7 @@ impl<C: RenderListener + Send> RenderTask<C> {
}
}
UnusedBufferMsg(unused_buffers) => {
for buffer in unused_buffers.move_iter() {
for buffer in unused_buffers.move_iter().rev() {
self.buffer_map.insert(native_graphics_context!(self), buffer);
}
}

View file

@ -555,20 +555,20 @@ impl<'a> GlyphStore {
self.entry_buffer[i] = entry;
}
pub fn add_glyphs_for_char_index(&mut self, i: uint, data_for_glyphs: &Vec<GlyphData>) {
pub fn add_glyphs_for_char_index(&mut self, i: uint, data_for_glyphs: &[GlyphData]) {
assert!(i < self.entry_buffer.len());
assert!(data_for_glyphs.len() > 0);
let glyph_count = data_for_glyphs.len();
let first_glyph_data = data_for_glyphs.get(0);
let first_glyph_data = data_for_glyphs[0];
let entry = match first_glyph_data.is_missing {
true => GlyphEntry::missing(glyph_count),
false => {
let glyphs_vec = slice::from_fn(glyph_count, |i| {
DetailedGlyph::new(data_for_glyphs.get(i).index,
data_for_glyphs.get(i).advance,
data_for_glyphs.get(i).offset)
DetailedGlyph::new(data_for_glyphs[i].index,
data_for_glyphs[i].advance,
data_for_glyphs[i].offset)
});
self.detail_store.add_detailed_glyphs_for_entry(i, glyphs_vec);

View file

@ -425,7 +425,7 @@ impl Shaper {
}
// now add the detailed glyph entry.
glyphs.add_glyphs_for_char_index(char_idx, &datas);
glyphs.add_glyphs_for_char_index(char_idx, datas.as_slice());
// set the other chars, who have no glyphs
let mut i = covered_byte_span.begin();

View file

@ -842,7 +842,7 @@ impl CompositorLayer {
};
let mut unused_tiles = vec!();
for buffer in new_buffers.buffers.move_iter() {
for buffer in new_buffers.buffers.move_iter().rev() {
unused_tiles.push_all_move(quadtree.add_tile_pixel(buffer.screen_pos.origin.x,
buffer.screen_pos.origin.y,
buffer.resolution,

View file

@ -1133,7 +1133,7 @@ impl ScriptTask {
match page.get_nodes_under_mouse(&point) {
Some(node_address) => {
let mut target_list: Vec<JS<Node>> = vec!();
let mut target_list = vec!();
let mut target_compare = false;
let mouse_over_targets = &mut *self.mouse_over_targets.borrow_mut();

View file

@ -197,18 +197,18 @@ fn compute_specificity(mut selector: &CompoundSelector,
};
if pseudo_element.is_some() { specificity.element_selectors += 1 }
simple_selectors_specificity(&selector.simple_selectors, &mut specificity);
simple_selectors_specificity(selector.simple_selectors.as_slice(), &mut specificity);
loop {
match selector.next {
None => break,
Some((ref next_selector, _)) => {
selector = &**next_selector;
simple_selectors_specificity(&selector.simple_selectors, &mut specificity)
simple_selectors_specificity(selector.simple_selectors.as_slice(), &mut specificity)
}
}
}
fn simple_selectors_specificity(simple_selectors: &Vec<SimpleSelector>,
fn simple_selectors_specificity(simple_selectors: &[SimpleSelector],
specificity: &mut Specificity) {
for simple_selector in simple_selectors.iter() {
match simple_selector {
@ -226,7 +226,7 @@ fn compute_specificity(mut selector: &CompoundSelector,
=> specificity.class_like_selectors += 1,
&NamespaceSelector(..) => (),
&Negation(ref negated)
=> simple_selectors_specificity(negated, specificity),
=> simple_selectors_specificity(negated.as_slice(), specificity),
}
}
}
@ -680,7 +680,7 @@ mod tests {
// Default namespace does apply to type selectors
assert!(parse_ns("e", &namespaces) == Some(vec!(Selector{
compound_selectors: Arc::new(CompoundSelector {
simple_selectors: vec!(
simple_selectors: vec!(
NamespaceSelector(namespace::MathML),
LocalNameSelector("e".to_owned()),
),

View file

@ -44,7 +44,7 @@ impl Stylesheet {
pub fn from_bytes_iter<I: Iterator<Vec<u8>>>(
mut input: I, base_url: Url, protocol_encoding_label: Option<&str>,
environment_encoding: Option<EncodingRef>) -> Stylesheet {
let mut bytes = vec!();
let mut bytes = vec!();
// TODO: incremental decoding and tokinization/parsing
for chunk in input {
bytes.push_all(chunk.as_slice())

View file

@ -200,7 +200,7 @@ impl Profiler {
if data_len > 0 {
let (mean, median, min, max) =
(data.iter().map(|&x|x).sum() / (data_len as f64),
data.get(data_len / 2).clone(),
*data.get(data_len / 2),
data.iter().fold(f64::INFINITY, |a, &b| a.min(b)),
data.iter().fold(-f64::INFINITY, |a, &b| a.max(b)));
println!("{:-35s}: {:15.4f} {:15.4f} {:15.4f} {:15.4f} {:15u}",