Auto merge of #18620 - emilio:bye-unsafe-node, r=glennw

style: Remove UnsafeNode.

No longer needed since a while ago.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18620)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-09-24 20:04:58 -05:00 committed by GitHub
commit 4628db1495
5 changed files with 3 additions and 43 deletions

View file

@ -35,8 +35,6 @@ use std::ops::Deref;
use stylist::Stylist;
use traversal_flags::{TraversalFlags, self};
pub use style_traits::UnsafeNode;
/// An opaque handle to a node, which, unlike UnsafeNode, cannot be transformed
/// back into a non-opaque representation. The only safe operation that can be
/// performed on this node is to compare it to another opaque handle or to another
@ -105,12 +103,6 @@ pub trait TNode : Sized + Copy + Clone + Debug + NodeInfo {
/// syntax.
type ConcreteChildrenIterator: Iterator<Item = Self>;
/// Convert this node in an `UnsafeNode`.
fn to_unsafe(&self) -> UnsafeNode;
/// Get a node back from an `UnsafeNode`.
unsafe fn from_unsafe(n: &UnsafeNode) -> Self;
/// Get this node's parent node.
fn parent_node(&self) -> Option<Self>;

View file

@ -20,7 +20,7 @@ use applicable_declarations::ApplicableDeclarationBlock;
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use context::{QuirksMode, SharedStyleContext, PostAnimationTasks, UpdateAnimationsTasks};
use data::ElementData;
use dom::{LayoutIterator, NodeInfo, TElement, TNode, UnsafeNode};
use dom::{LayoutIterator, NodeInfo, TElement, TNode};
use dom::{OpaqueNode, PresentationalHintsSynthesizer};
use element_state::{ElementState, DocumentState, NS_DOCUMENT_STATE_WINDOW_INACTIVE};
use error_reporting::ParseErrorReporter;
@ -246,14 +246,6 @@ impl<'ln> TNode for GeckoNode<'ln> {
type ConcreteElement = GeckoElement<'ln>;
type ConcreteChildrenIterator = GeckoChildrenIterator<'ln>;
fn to_unsafe(&self) -> UnsafeNode {
(self.0 as *const _ as usize, 0)
}
unsafe fn from_unsafe(n: &UnsafeNode) -> Self {
GeckoNode(&*(n.0 as *mut RawGeckoNode))
}
fn parent_node(&self) -> Option<Self> {
unsafe { self.0.mParent.as_ref().map(GeckoNode) }
}