From 8b94a44c0be8d987b873d88bf422b12cac33eec4 Mon Sep 17 00:00:00 2001 From: Matt Murphy Date: Wed, 30 Apr 2014 17:34:13 -0500 Subject: [PATCH] Changes based on review --- src/components/gfx/buffer_map.rs | 2 +- src/components/gfx/render_task.rs | 2 +- src/components/gfx/text/glyph.rs | 10 +++++----- src/components/gfx/text/shaping/harfbuzz.rs | 2 +- src/components/main/compositing/compositor_layer.rs | 2 +- src/components/script/script_task.rs | 2 +- src/components/style/selectors.rs | 10 +++++----- src/components/style/stylesheets.rs | 2 +- src/components/util/time.rs | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/components/gfx/buffer_map.rs b/src/components/gfx/buffer_map.rs index 33ab8a4b5d2d..9b3a6f609888 100644 --- a/src/components/gfx/buffer_map.rs +++ b/src/components/gfx/buffer_map.rs @@ -54,7 +54,7 @@ impl BufferKey { /// A helper struct to keep track of buffers in the HashMap struct BufferValue { /// An array of buffers, all the same size - buffers: Vec, + buffers: Vec, /// The counter when this size was last requested last_action: uint, } diff --git a/src/components/gfx/render_task.rs b/src/components/gfx/render_task.rs index 958989bf3fbf..6d38286c0f95 100644 --- a/src/components/gfx/render_task.rs +++ b/src/components/gfx/render_task.rs @@ -256,7 +256,7 @@ impl RenderTask { } } 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); } } diff --git a/src/components/gfx/text/glyph.rs b/src/components/gfx/text/glyph.rs index f48cee8997e8..1d1b99a8abcb 100644 --- a/src/components/gfx/text/glyph.rs +++ b/src/components/gfx/text/glyph.rs @@ -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) { + 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); diff --git a/src/components/gfx/text/shaping/harfbuzz.rs b/src/components/gfx/text/shaping/harfbuzz.rs index 2eefc4f95e31..6a89a3359117 100644 --- a/src/components/gfx/text/shaping/harfbuzz.rs +++ b/src/components/gfx/text/shaping/harfbuzz.rs @@ -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(); diff --git a/src/components/main/compositing/compositor_layer.rs b/src/components/main/compositing/compositor_layer.rs index a1ef5b95bd31..160024c1815f 100644 --- a/src/components/main/compositing/compositor_layer.rs +++ b/src/components/main/compositing/compositor_layer.rs @@ -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, diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs index 051bc9b58d26..09d9ee59aa68 100644 --- a/src/components/script/script_task.rs +++ b/src/components/script/script_task.rs @@ -1133,7 +1133,7 @@ impl ScriptTask { match page.get_nodes_under_mouse(&point) { Some(node_address) => { - let mut target_list: Vec> = vec!(); + let mut target_list = vec!(); let mut target_compare = false; let mouse_over_targets = &mut *self.mouse_over_targets.borrow_mut(); diff --git a/src/components/style/selectors.rs b/src/components/style/selectors.rs index 88384a37d185..b7d9d986ce54 100644 --- a/src/components/style/selectors.rs +++ b/src/components/style/selectors.rs @@ -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, + 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()), ), diff --git a/src/components/style/stylesheets.rs b/src/components/style/stylesheets.rs index 6f4c97acb124..80ebf02c8667 100644 --- a/src/components/style/stylesheets.rs +++ b/src/components/style/stylesheets.rs @@ -44,7 +44,7 @@ impl Stylesheet { pub fn from_bytes_iter>>( mut input: I, base_url: Url, protocol_encoding_label: Option<&str>, environment_encoding: Option) -> 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()) diff --git a/src/components/util/time.rs b/src/components/util/time.rs index a9aa8d870ed6..151e4385b562 100644 --- a/src/components/util/time.rs +++ b/src/components/util/time.rs @@ -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}",