mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Remove 'LayoutNode.pad' field.
This commit is contained in:
parent
183cdc95c6
commit
6841cc6df8
2 changed files with 12 additions and 14 deletions
|
@ -16,7 +16,7 @@ use layout::flow_ref::FlowRef;
|
|||
use layout::layout_task::{AssignHeightsAndStoreOverflowTraversal, AssignWidthsTraversal};
|
||||
use layout::layout_task::{BubbleWidthsTraversal};
|
||||
use layout::util::{LayoutDataAccess, LayoutDataWrapper, OpaqueNodeMethods};
|
||||
use layout::wrapper::{layout_node_to_unsafe_layout_node, LayoutNode, PostorderNodeMutTraversal};
|
||||
use layout::wrapper::{layout_node_to_unsafe_layout_node, layout_node_from_unsafe_layout_node, LayoutNode, PostorderNodeMutTraversal};
|
||||
use layout::wrapper::{ThreadSafeLayoutNode, UnsafeLayoutNode};
|
||||
|
||||
use gfx::display_list::OpaqueNode;
|
||||
|
@ -219,7 +219,7 @@ fn recalc_style_for_node(unsafe_layout_node: UnsafeLayoutNode,
|
|||
let layout_context: &mut LayoutContext = mem::transmute(*proxy.user_data());
|
||||
|
||||
// Get a real layout node.
|
||||
let node: LayoutNode = ::std::intrinsics::transmute(unsafe_layout_node);
|
||||
let node: LayoutNode = layout_node_from_unsafe_layout_node(&unsafe_layout_node);
|
||||
|
||||
// Initialize layout data.
|
||||
//
|
||||
|
@ -309,9 +309,7 @@ fn construct_flows(mut unsafe_layout_node: UnsafeLayoutNode,
|
|||
};
|
||||
|
||||
// Get a real layout node.
|
||||
let node: LayoutNode = unsafe {
|
||||
mem::transmute(unsafe_layout_node)
|
||||
};
|
||||
let node: LayoutNode = layout_node_from_unsafe_layout_node(&unsafe_layout_node);
|
||||
|
||||
// Construct flows for this node.
|
||||
{
|
||||
|
|
|
@ -139,10 +139,6 @@ pub struct LayoutNode<'a> {
|
|||
|
||||
/// Being chained to a ContravariantLifetime prevents `LayoutNode`s from escaping.
|
||||
pub chain: ContravariantLifetime<'a>,
|
||||
|
||||
/// Padding to ensure the transmute `JS<T>` -> `LayoutNode`, `LayoutNode` -> `UnsafeLayoutNode`,
|
||||
/// and `UnsafeLayoutNode` -> others.
|
||||
pad: uint
|
||||
}
|
||||
|
||||
impl<'ln> Clone for LayoutNode<'ln> {
|
||||
|
@ -150,7 +146,6 @@ impl<'ln> Clone for LayoutNode<'ln> {
|
|||
LayoutNode {
|
||||
node: self.node.clone(),
|
||||
chain: self.chain,
|
||||
pad: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +163,6 @@ impl<'ln> TLayoutNode for LayoutNode<'ln> {
|
|||
LayoutNode {
|
||||
node: node.transmute_copy(),
|
||||
chain: self.chain,
|
||||
pad: 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,7 +199,6 @@ impl<'ln> LayoutNode<'ln> {
|
|||
f(LayoutNode {
|
||||
node: node,
|
||||
chain: ContravariantLifetime,
|
||||
pad: 0,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -440,7 +433,6 @@ impl<'ln> TLayoutNode for ThreadSafeLayoutNode<'ln> {
|
|||
node: LayoutNode {
|
||||
node: node.transmute_copy(),
|
||||
chain: self.node.chain,
|
||||
pad: 0,
|
||||
},
|
||||
pseudo: Normal,
|
||||
}
|
||||
|
@ -753,6 +745,14 @@ pub type UnsafeLayoutNode = (uint, uint);
|
|||
|
||||
pub fn layout_node_to_unsafe_layout_node(node: &LayoutNode) -> UnsafeLayoutNode {
|
||||
unsafe {
|
||||
mem::transmute_copy(node)
|
||||
let ptr: uint = mem::transmute_copy(node);
|
||||
(ptr, 0)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn layout_node_from_unsafe_layout_node(node: &UnsafeLayoutNode) -> LayoutNode {
|
||||
unsafe {
|
||||
let (node, _) = *node;
|
||||
mem::transmute(node)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue