Fix some warnings in layout.

This commit is contained in:
Ms2ger 2015-02-12 18:58:38 +01:00
parent 31f6595981
commit 2b0eb98c1d
7 changed files with 28 additions and 17 deletions

View file

@ -63,7 +63,7 @@ use style::computed_values::{overflow, position, box_sizing, display, float};
use std::sync::Arc;
/// Information specific to floated blocks.
#[derive(Clone, Encodable)]
#[derive(Clone, RustcEncodable)]
pub struct FloatedBlockInfo {
/// The amount of inline size that is available for the float.
pub containing_inline_size: Au,
@ -735,7 +735,7 @@ impl BlockFlow {
traversal.process(flow);
let cb_block_start_edge_offset = flow.generated_containing_block_rect().start.b;
let mut descendant_offset_iter = mut_base(flow).abs_descendants.iter_with_offset();
let descendant_offset_iter = mut_base(flow).abs_descendants.iter_with_offset();
// Pass in the respective static y offset for each descendant.
for (ref mut descendant_link, ref y_offset) in descendant_offset_iter {
let block = descendant_link.as_block();

View file

@ -71,7 +71,7 @@ impl ApplicableDeclarationsCacheEntry {
impl PartialEq for ApplicableDeclarationsCacheEntry {
fn eq(&self, other: &ApplicableDeclarationsCacheEntry) -> bool {
let this_as_query = ApplicableDeclarationsCacheQuery::new(self.declarations.as_slice());
let this_as_query = ApplicableDeclarationsCacheQuery::new(&*self.declarations);
this_as_query.eq(other)
}
}
@ -79,7 +79,7 @@ impl Eq for ApplicableDeclarationsCacheEntry {}
impl<H: Hasher+Writer> Hash<H> for ApplicableDeclarationsCacheEntry {
fn hash(&self, state: &mut H) {
let tmp = ApplicableDeclarationsCacheQuery::new(self.declarations.as_slice());
let tmp = ApplicableDeclarationsCacheQuery::new(&*self.declarations);
tmp.hash(state);
}
}
@ -643,7 +643,7 @@ impl<'ln> MatchMethods for LayoutNode<'ln> {
if applicable_declarations.before.len() > 0 {
damage = damage | self.cascade_node_pseudo_element(
Some(layout_data.shared_data.style.as_ref().unwrap()),
applicable_declarations.before.as_slice(),
&*applicable_declarations.before,
&mut layout_data.data.before_style,
applicable_declarations_cache,
false);
@ -651,7 +651,7 @@ impl<'ln> MatchMethods for LayoutNode<'ln> {
if applicable_declarations.after.len() > 0 {
damage = damage | self.cascade_node_pseudo_element(
Some(layout_data.shared_data.style.as_ref().unwrap()),
applicable_declarations.after.as_slice(),
&*applicable_declarations.after,
&mut layout_data.data.after_style,
applicable_declarations_cache,
false);

View file

@ -468,9 +468,7 @@ impl FragmentDisplayListBuilding for Fragment {
position_to_offset(gradient.stops[i - 1].position.unwrap(), length)
};
let (end_index, end_offset) =
match gradient.stops
.as_slice()
.slice_from(i)
match gradient.stops[i..]
.iter()
.enumerate()
.find(|&(_, ref stop)| stop.position.is_some()) {

View file

@ -638,16 +638,16 @@ impl Descendants {
/// Return an iterator over the descendant flows.
pub fn iter<'a>(&'a mut self) -> DescendantIter<'a> {
DescendantIter {
iter: self.descendant_links.slice_from_mut(0).iter_mut(),
iter: self.descendant_links.iter_mut(),
}
}
/// Return an iterator over (descendant, static y offset).
pub fn iter_with_offset<'a>(&'a mut self) -> DescendantOffsetIter<'a> {
let descendant_iter = DescendantIter {
iter: self.descendant_links.slice_from_mut(0).iter_mut(),
iter: self.descendant_links.iter_mut(),
};
descendant_iter.zip(self.static_block_offsets.slice_from_mut(0).iter_mut())
descendant_iter.zip(self.static_block_offsets.iter_mut())
}
}

View file

@ -1484,7 +1484,7 @@ impl Fragment {
/// A helper method that uses the breaking strategy described by `slice_iterator` (at present,
/// either natural word breaking or character breaking) to split this fragment.
fn calculate_split_position_using_breaking_strategy<'a,I>(&self,
mut slice_iterator: I,
slice_iterator: I,
max_inline_size: Au,
flags: SplitOptions)
-> Option<SplitResult>

View file

@ -14,11 +14,11 @@ use serialize::json;
use std::borrow::ToOwned;
use std::cell::RefCell;
use std::old_io::File;
use std::sync::atomic::{AtomicUint, Ordering, ATOMIC_UINT_INIT};
use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
thread_local!(static STATE_KEY: RefCell<Option<State>> = RefCell::new(None));
static mut DEBUG_ID_COUNTER: AtomicUint = ATOMIC_UINT_INIT;
static mut DEBUG_ID_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT;
pub struct Scope;

View file

@ -2,12 +2,25 @@
* 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/. */
#![feature(thread_local, unsafe_destructor, box_syntax, plugin, int_uint)]
#![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(thread_local)]
#![feature(unicode)]
#![feature(unsafe_destructor)]
#![deny(unsafe_blocks)]
#![allow(unrooted_must_root)]
#![allow(missing_copy_implementations)]
#![allow(unstable)]
#[macro_use]
extern crate log;