mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
Use usize and u32 for LayerId.
This commit is contained in:
parent
ac3c076892
commit
37c271a260
3 changed files with 6 additions and 9 deletions
|
@ -1869,11 +1869,11 @@ impl Flow for BlockFlow {
|
|||
self.fragment.border_box - self.fragment.style().logical_border_width()
|
||||
}
|
||||
|
||||
fn layer_id(&self, fragment_index: uint) -> LayerId {
|
||||
fn layer_id(&self, fragment_index: u32) -> LayerId {
|
||||
// FIXME(#2010, pcwalton): This is a hack and is totally bogus in the presence of pseudo-
|
||||
// elements. But until we have incremental reflow we can't do better--we recreate the flow
|
||||
// for every DOM node so otherwise we nuke layers on every reflow.
|
||||
LayerId(self.fragment.node.id() as uint, fragment_index)
|
||||
LayerId(self.fragment.node.id() as usize, fragment_index)
|
||||
}
|
||||
|
||||
fn is_absolute_containing_block(&self) -> bool {
|
||||
|
|
|
@ -311,12 +311,9 @@ pub trait Flow: fmt::Debug + Sync {
|
|||
|
||||
/// Returns a layer ID for the given fragment.
|
||||
#[allow(unsafe_code)]
|
||||
fn layer_id(&self, fragment_id: uint) -> LayerId {
|
||||
unsafe {
|
||||
let obj = mem::transmute::<&&Self, &raw::TraitObject>(&self);
|
||||
let pointer: uint = mem::transmute(obj.data);
|
||||
LayerId(pointer, fragment_id)
|
||||
}
|
||||
fn layer_id(&self, fragment_id: u32) -> LayerId {
|
||||
let obj = unsafe { mem::transmute::<&&Self, &raw::TraitObject>(&self) };
|
||||
LayerId(obj.data as usize, fragment_id)
|
||||
}
|
||||
|
||||
/// Attempts to perform incremental fixup of this flow by replacing its fragment's style with
|
||||
|
|
|
@ -44,7 +44,7 @@ impl Epoch {
|
|||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Copy)]
|
||||
pub struct LayerId(pub uint, pub uint);
|
||||
pub struct LayerId(pub usize, pub u32);
|
||||
|
||||
impl Debug for LayerId {
|
||||
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue