diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-02-08 21:00:43 -0700 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-02-08 21:00:43 -0700 |
commit | 1a47f176ffb059a7a3f29f94485859163cb1284b (patch) | |
tree | 88c31b2899c1ac3ccd9d20c4904d48d54067e59e /components/layout/util.rs | |
parent | 13b49ddf446871e7c544bd0b5d6457168c84de46 (diff) | |
parent | 18b49fd68ed56c586b4d16b12a7e12ce5a50ffa8 (diff) | |
download | servo-1a47f176ffb059a7a3f29f94485859163cb1284b.tar.gz servo-1a47f176ffb059a7a3f29f94485859163cb1284b.zip |
auto merge of #4869 : Ms2ger/servo/layout-unsafe, r=jdm
Diffstat (limited to 'components/layout/util.rs')
-rw-r--r-- | components/layout/util.rs | 15 |
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) } } |