mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Remove UnsafeNode.
No longer needed since a while ago.
This commit is contained in:
parent
3db1776326
commit
e3c58df155
5 changed files with 3 additions and 43 deletions
|
@ -17,21 +17,13 @@ use servo_config::opts;
|
|||
use smallvec::SmallVec;
|
||||
use std::mem;
|
||||
use std::sync::atomic::{AtomicIsize, Ordering};
|
||||
use style::dom::UnsafeNode;
|
||||
use traversal::{AssignBSizes, AssignISizes, BubbleISizes};
|
||||
use traversal::{PostorderFlowTraversal, PreorderFlowTraversal};
|
||||
|
||||
/// Traversal chunk size.
|
||||
const CHUNK_SIZE: usize = 16;
|
||||
|
||||
pub type FlowList = SmallVec<[UnsafeNode; CHUNK_SIZE]>;
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn static_assertion(node: UnsafeNode) {
|
||||
unsafe {
|
||||
let _: UnsafeFlow = ::std::intrinsics::transmute(node);
|
||||
}
|
||||
}
|
||||
pub type FlowList = SmallVec<[UnsafeFlow; CHUNK_SIZE]>;
|
||||
|
||||
/// Vtable + pointer representation of a Flow trait object.
|
||||
pub type UnsafeFlow = (usize, usize);
|
||||
|
|
|
@ -61,7 +61,6 @@ use std::fmt;
|
|||
use std::fmt::Debug;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::marker::PhantomData;
|
||||
use std::mem::transmute;
|
||||
use std::sync::atomic::Ordering;
|
||||
use style::CaseSensitivityExt;
|
||||
use style::applicable_declarations::ApplicableDeclarationBlock;
|
||||
|
@ -70,7 +69,7 @@ use style::computed_values::display;
|
|||
use style::context::SharedStyleContext;
|
||||
use style::data::ElementData;
|
||||
use style::dom::{LayoutIterator, NodeInfo, OpaqueNode};
|
||||
use style::dom::{PresentationalHintsSynthesizer, TElement, TNode, UnsafeNode};
|
||||
use style::dom::{PresentationalHintsSynthesizer, TElement, TNode};
|
||||
use style::element_state::*;
|
||||
use style::font_metrics::ServoMetricsProvider;
|
||||
use style::properties::{ComputedValues, PropertyDeclarationBlock};
|
||||
|
@ -162,17 +161,6 @@ impl<'ln> TNode for ServoLayoutNode<'ln> {
|
|||
type ConcreteElement = ServoLayoutElement<'ln>;
|
||||
type ConcreteChildrenIterator = ServoChildrenIterator<'ln>;
|
||||
|
||||
fn to_unsafe(&self) -> UnsafeNode {
|
||||
unsafe {
|
||||
(self.node.unsafe_get() as usize, 0)
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn from_unsafe(n: &UnsafeNode) -> Self {
|
||||
let (node, _) = *n;
|
||||
transmute(node)
|
||||
}
|
||||
|
||||
fn parent_node(&self) -> Option<Self> {
|
||||
unsafe {
|
||||
self.node.parent_node_ref().map(|node| self.new_with_this_lifetime(&node))
|
||||
|
|
|
@ -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>;
|
||||
|
||||
|
|
|
@ -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) }
|
||||
}
|
||||
|
|
|
@ -39,10 +39,6 @@ use selectors::parser::SelectorParseError;
|
|||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum DevicePixel {}
|
||||
|
||||
/// Opaque type stored in type-unsafe work queues for parallel layout.
|
||||
/// Must be transmutable to and from `TNode`.
|
||||
pub type UnsafeNode = (usize, usize);
|
||||
|
||||
/// Represents a mobile style pinch zoom factor.
|
||||
/// TODO(gw): Once WR supports pinch zoom, use a type directly from webrender_api.
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue