mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Replace OpaqueNodeMethods::from_{threadsafe_,}layout_node by opaque methods.
This commit is contained in:
parent
6247a96761
commit
2ea32829af
6 changed files with 20 additions and 37 deletions
|
@ -170,6 +170,11 @@ impl<'ln> LayoutNode<'ln> {
|
|||
&self.node
|
||||
}
|
||||
|
||||
/// Converts self into an `OpaqueNode`.
|
||||
pub fn opaque(&self) -> OpaqueNode {
|
||||
OpaqueNodeMethods::from_jsmanaged(unsafe { self.get_jsmanaged() })
|
||||
}
|
||||
|
||||
/// Resets layout data and styles for the node.
|
||||
///
|
||||
/// FIXME(pcwalton): Do this as part of fragment building instead of in a traversal.
|
||||
|
@ -197,8 +202,7 @@ impl<'ln> LayoutNode<'ln> {
|
|||
match shared.reflow_root {
|
||||
None => panic!("layout_parent_node(): This layout has no access to the DOM!"),
|
||||
Some(reflow_root) => {
|
||||
let opaque_node: OpaqueNode = OpaqueNodeMethods::from_layout_node(&self);
|
||||
if opaque_node == reflow_root {
|
||||
if self.opaque() == reflow_root {
|
||||
None
|
||||
} else {
|
||||
self.parent_node()
|
||||
|
@ -208,8 +212,7 @@ impl<'ln> LayoutNode<'ln> {
|
|||
}
|
||||
|
||||
pub fn debug_id(self) -> usize {
|
||||
let opaque: OpaqueNode = OpaqueNodeMethods::from_layout_node(&self);
|
||||
opaque.to_untrusted_node_address().0 as usize
|
||||
self.opaque().to_untrusted_node_address().0 as usize
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -644,6 +647,11 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
|||
self.node.get_jsmanaged()
|
||||
}
|
||||
|
||||
/// Converts self into an `OpaqueNode`.
|
||||
pub fn opaque(&self) -> OpaqueNode {
|
||||
OpaqueNodeMethods::from_jsmanaged(unsafe { self.get_jsmanaged() })
|
||||
}
|
||||
|
||||
/// Returns the type ID of this node.
|
||||
/// Returns `None` if this is a pseudo-element; otherwise, returns `Some`.
|
||||
pub fn type_id(&self) -> Option<NodeTypeId> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue