aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/util.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/layout/util.rs')
-rw-r--r--components/layout/util.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/components/layout/util.rs b/components/layout/util.rs
index 270c796781e..a5e8328118f 100644
--- a/components/layout/util.rs
+++ b/components/layout/util.rs
@@ -2,6 +2,8 @@
* 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/. */
+#![allow(unsafe_blocks)]
+
use construct::ConstructionResult;
use incremental::RestyleDamage;
use parallel::DomParallelInfo;
@@ -9,7 +11,7 @@ use wrapper::{LayoutNode, TLayoutNode, ThreadSafeLayoutNode};
use gfx::display_list::OpaqueNode;
use gfx;
-use libc::uintptr_t;
+use libc::{c_void, uintptr_t};
use script::dom::bindings::js::LayoutJS;
use script::dom::node::{Node, SharedLayoutData};
use script::layout_interface::{LayoutChan, TrustedNodeAddress};
@@ -141,9 +143,7 @@ impl OpaqueNodeMethods for OpaqueNode {
fn from_thread_safe_layout_node(node: &ThreadSafeLayoutNode) -> OpaqueNode {
unsafe {
- let abstract_node = node.get_jsmanaged();
- let ptr: uintptr_t = abstract_node.get_jsobject() as uintptr_t;
- OpaqueNode(ptr)
+ OpaqueNodeMethods::from_jsmanaged(node.get_jsmanaged())
}
}
@@ -161,11 +161,8 @@ impl OpaqueNodeMethods for OpaqueNode {
}
fn to_untrusted_node_address(&self) -> UntrustedNodeAddress {
- unsafe {
- let OpaqueNode(addr) = *self;
- let addr: UntrustedNodeAddress = mem::transmute(addr);
- addr
- }
+ let OpaqueNode(addr) = *self;
+ UntrustedNodeAddress(addr as *const c_void)
}
}