Fix warnings in gfx.

This commit is contained in:
Ms2ger 2015-02-13 11:00:20 +01:00
parent 5e999c7d40
commit e25322ce5b
6 changed files with 24 additions and 12 deletions

View file

@ -353,7 +353,7 @@ impl StackingContext {
fn hit_test_in_list<'a,I>(point: Point2D<Au>, fn hit_test_in_list<'a,I>(point: Point2D<Au>,
result: &mut Vec<DisplayItemMetadata>, result: &mut Vec<DisplayItemMetadata>,
topmost_only: bool, topmost_only: bool,
mut iterator: I) iterator: I)
where I: Iterator<Item=&'a DisplayItem> { where I: Iterator<Item=&'a DisplayItem> {
for item in iterator { for item in iterator {
// TODO(pcwalton): Use a precise algorithm here. This will allow us to properly hit // TODO(pcwalton): Use a precise algorithm here. This will allow us to properly hit

View file

@ -43,7 +43,7 @@ impl DisplayListOptimizer {
/// Adds display items that intersect the visible rect to `result_list`. /// Adds display items that intersect the visible rect to `result_list`.
fn add_in_bounds_display_items<'a,I>(&self, fn add_in_bounds_display_items<'a,I>(&self,
result_list: &mut DList<DisplayItem>, result_list: &mut DList<DisplayItem>,
mut display_items: I) display_items: I)
where I: Iterator<Item=&'a DisplayItem> { where I: Iterator<Item=&'a DisplayItem> {
for display_item in display_items { for display_item in display_items {
if self.visible_rect.intersects(&display_item.base().bounds) && if self.visible_rect.intersects(&display_item.base().bounds) &&
@ -56,7 +56,7 @@ impl DisplayListOptimizer {
/// Adds child stacking contexts whose boundaries intersect the visible rect to `result_list`. /// Adds child stacking contexts whose boundaries intersect the visible rect to `result_list`.
fn add_in_bounds_stacking_contexts<'a,I>(&self, fn add_in_bounds_stacking_contexts<'a,I>(&self,
result_list: &mut DList<Arc<StackingContext>>, result_list: &mut DList<Arc<StackingContext>>,
mut stacking_contexts: I) stacking_contexts: I)
where I: Iterator<Item=&'a Arc<StackingContext>> { where I: Iterator<Item=&'a Arc<StackingContext>> {
for stacking_context in stacking_contexts { for stacking_context in stacking_contexts {
let overflow = stacking_context.overflow.translate(&stacking_context.bounds.origin); let overflow = stacking_context.overflow.translate(&stacking_context.bounds.origin);

View file

@ -58,7 +58,7 @@ impl FontTableTagConversions for FontTableTag {
fn tag_to_str(&self) -> String { fn tag_to_str(&self) -> String {
unsafe { unsafe {
let pointer = mem::transmute::<&u32, *const u8>(self); let pointer = mem::transmute::<&u32, *const u8>(self);
let mut bytes = slice::from_raw_buf(&pointer, 4).to_vec(); let mut bytes = slice::from_raw_parts(pointer, 4).to_vec();
bytes.reverse(); bytes.reverse();
String::from_utf8_unchecked(bytes) String::from_utf8_unchecked(bytes)
} }

View file

@ -2,10 +2,22 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(unsafe_destructor, int_uint, plugin, box_syntax)] #![feature(alloc)]
#![feature(box_syntax)]
#![feature(collections)]
#![feature(core)]
#![feature(hash)]
#![feature(int_uint)]
#![feature(io)]
#![feature(libc)]
#![feature(path)]
#![feature(plugin)]
#![feature(rustc_private)]
#![feature(std_misc)]
#![feature(unicode)]
#![feature(unsafe_destructor)]
#![allow(missing_copy_implementations)] #![allow(missing_copy_implementations)]
#![allow(unstable)]
#[macro_use] #[macro_use]
extern crate log; extern crate log;

View file

@ -345,7 +345,7 @@ impl<'a> DetailedGlyphStore {
// FIXME: Is this right? --pcwalton // FIXME: Is this right? --pcwalton
// TODO: should fix this somewhere else // TODO: should fix this somewhere else
if count == 0 { if count == 0 {
return self.detail_buffer.slice(0, 0); return &self.detail_buffer[0..0];
} }
assert!((count as uint) <= self.detail_buffer.len()); assert!((count as uint) <= self.detail_buffer.len());
@ -361,7 +361,7 @@ impl<'a> DetailedGlyphStore {
assert!(i + (count as uint) <= self.detail_buffer.len()); assert!(i + (count as uint) <= self.detail_buffer.len());
// return a slice into the buffer // return a slice into the buffer
self.detail_buffer.slice(i, i + count as uint) &self.detail_buffer[i .. i + count as uint]
} }
fn get_detailed_glyph_with_index(&'a self, fn get_detailed_glyph_with_index(&'a self,

View file

@ -231,7 +231,7 @@ impl<'a> TextRun {
// Create a glyph store for this slice if it's nonempty. // Create a glyph store for this slice if it's nonempty.
if can_break_before && byte_i > byte_last_boundary { if can_break_before && byte_i > byte_last_boundary {
let slice = text.slice(byte_last_boundary, byte_i); let slice = &text[byte_last_boundary .. byte_i];
debug!("creating glyph store for slice {} (ws? {}), {} - {} in run {}", debug!("creating glyph store for slice {} (ws? {}), {} - {} in run {}",
slice, !cur_slice_is_whitespace, byte_last_boundary, byte_i, text); slice, !cur_slice_is_whitespace, byte_last_boundary, byte_i, text);
@ -254,7 +254,7 @@ impl<'a> TextRun {
// Create a glyph store for the final slice if it's nonempty. // Create a glyph store for the final slice if it's nonempty.
if byte_i > byte_last_boundary { if byte_i > byte_last_boundary {
let slice = text.slice_from(byte_last_boundary); let slice = &text[byte_last_boundary..];
debug!("creating glyph store for final slice {} (ws? {}), {} - {} in run {}", debug!("creating glyph store for final slice {} (ws? {}), {} - {} in run {}",
slice, cur_slice_is_whitespace, byte_last_boundary, text.len(), text); slice, cur_slice_is_whitespace, byte_last_boundary, text.len(), text);
@ -343,7 +343,7 @@ impl<'a> TextRun {
Some(index) => index, Some(index) => index,
}; };
NaturalWordSliceIterator { NaturalWordSliceIterator {
glyph_iter: self.glyphs.slice_from(index).iter(), glyph_iter: self.glyphs[index..].iter(),
range: *range, range: *range,
} }
} }
@ -356,7 +356,7 @@ impl<'a> TextRun {
None => self.glyphs.len(), None => self.glyphs.len(),
Some(index) => index, Some(index) => index,
}; };
let mut glyph_run_iter = self.glyphs.slice_from(index).iter(); let mut glyph_run_iter = self.glyphs[index..].iter();
let first_glyph_run = glyph_run_iter.next(); let first_glyph_run = glyph_run_iter.next();
CharacterSliceIterator { CharacterSliceIterator {
glyph_run: first_glyph_run, glyph_run: first_glyph_run,