mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Use LayoutJS<T> in layout crate.
This commit is contained in:
parent
e2bd9eadd8
commit
6b1e2bd11c
4 changed files with 50 additions and 42 deletions
|
@ -10,7 +10,7 @@ use wrapper::{LayoutNode, TLayoutNode, ThreadSafeLayoutNode};
|
|||
use gfx::display_list::OpaqueNode;
|
||||
use gfx;
|
||||
use libc::uintptr_t;
|
||||
use script::dom::bindings::js::JS;
|
||||
use script::dom::bindings::js::{JS, LayoutJS};
|
||||
use script::dom::bindings::utils::Reflectable;
|
||||
use script::dom::node::{Node, SharedLayoutData};
|
||||
use script::layout_interface::{LayoutChan, TrustedNodeAddress};
|
||||
|
@ -126,7 +126,7 @@ pub trait OpaqueNodeMethods {
|
|||
fn from_script_node(node: TrustedNodeAddress) -> Self;
|
||||
|
||||
/// Converts a DOM node to an `OpaqueNode'.
|
||||
fn from_jsmanaged(node: &JS<Node>) -> Self;
|
||||
fn from_jsmanaged(node: &LayoutJS<Node>) -> Self;
|
||||
|
||||
/// Converts this node to an `UntrustedNodeAddress`. An `UntrustedNodeAddress` is just the type
|
||||
/// of node that script expects to receive in a hit test.
|
||||
|
@ -150,11 +150,11 @@ impl OpaqueNodeMethods for OpaqueNode {
|
|||
|
||||
fn from_script_node(node: TrustedNodeAddress) -> OpaqueNode {
|
||||
unsafe {
|
||||
OpaqueNodeMethods::from_jsmanaged(&JS::from_trusted_node_address(node))
|
||||
OpaqueNodeMethods::from_jsmanaged(&JS::from_trusted_node_address(node).to_layout())
|
||||
}
|
||||
}
|
||||
|
||||
fn from_jsmanaged(node: &JS<Node>) -> OpaqueNode {
|
||||
fn from_jsmanaged(node: &LayoutJS<Node>) -> OpaqueNode {
|
||||
unsafe {
|
||||
let ptr: uintptr_t = mem::transmute(node.reflector().get_jsobject());
|
||||
OpaqueNode(ptr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue