mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Remove lifetimes from T{Node,Element,Document}.
This commit is contained in:
parent
881d6b4220
commit
b1878bd925
10 changed files with 84 additions and 94 deletions
|
@ -28,7 +28,7 @@ pub struct RecalcStyleAndConstructFlows<'lc> {
|
|||
root: OpaqueNode,
|
||||
}
|
||||
|
||||
impl<'lc, 'ln> DomTraversalContext<'ln, ServoLayoutNode<'ln>> for RecalcStyleAndConstructFlows<'lc> {
|
||||
impl<'lc, 'ln> DomTraversalContext<ServoLayoutNode<'ln>> for RecalcStyleAndConstructFlows<'lc> {
|
||||
type SharedContext = SharedLayoutContext;
|
||||
#[allow(unsafe_code)]
|
||||
fn new<'a>(shared: &'a Self::SharedContext, root: OpaqueNode) -> Self {
|
||||
|
|
|
@ -79,7 +79,7 @@ pub type NonOpaqueStyleAndLayoutData = *mut RefCell<PrivateLayoutData>;
|
|||
/// A wrapper so that layout can access only the methods that it should have access to. Layout must
|
||||
/// only ever see these and must never see instances of `LayoutJS`.
|
||||
|
||||
pub trait LayoutNode<'ln> : TNode<'ln> {
|
||||
pub trait LayoutNode<'ln> : TNode {
|
||||
type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'ln>;
|
||||
fn to_threadsafe(&self) -> Self::ConcreteThreadSafeLayoutNode;
|
||||
|
||||
|
@ -130,7 +130,7 @@ impl<'ln> ServoLayoutNode<'ln> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'ln> TNode<'ln> for ServoLayoutNode<'ln> {
|
||||
impl<'ln> TNode for ServoLayoutNode<'ln> {
|
||||
type ConcreteElement = ServoLayoutElement<'ln>;
|
||||
type ConcreteDocument = ServoLayoutDocument<'ln>;
|
||||
type ConcreteRestyleDamage = RestyleDamage;
|
||||
|
@ -364,7 +364,7 @@ pub struct ServoLayoutDocument<'ld> {
|
|||
chain: PhantomData<&'ld ()>,
|
||||
}
|
||||
|
||||
impl<'ld> TDocument<'ld> for ServoLayoutDocument<'ld> {
|
||||
impl<'ld> TDocument for ServoLayoutDocument<'ld> {
|
||||
type ConcreteNode = ServoLayoutNode<'ld>;
|
||||
type ConcreteElement = ServoLayoutElement<'ld>;
|
||||
|
||||
|
@ -398,7 +398,7 @@ pub struct ServoLayoutElement<'le> {
|
|||
chain: PhantomData<&'le ()>,
|
||||
}
|
||||
|
||||
impl<'le> TElement<'le> for ServoLayoutElement<'le> {
|
||||
impl<'le> TElement for ServoLayoutElement<'le> {
|
||||
type ConcreteNode = ServoLayoutNode<'le>;
|
||||
type ConcreteDocument = ServoLayoutDocument<'le>;
|
||||
|
||||
|
@ -406,7 +406,7 @@ impl<'le> TElement<'le> for ServoLayoutElement<'le> {
|
|||
ServoLayoutNode::from_layout_js(self.element.upcast())
|
||||
}
|
||||
|
||||
fn style_attribute(&self) -> &'le Option<PropertyDeclarationBlock> {
|
||||
fn style_attribute(&self) -> &Option<PropertyDeclarationBlock> {
|
||||
unsafe {
|
||||
&*self.element.style_attribute()
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ use selectors::Element;
|
|||
use selectors::matching::DeclarationBlock;
|
||||
use smallvec::VecLike;
|
||||
use std::cell::{Ref, RefMut};
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::BitOr;
|
||||
use std::sync::Arc;
|
||||
use string_cache::{Atom, Namespace};
|
||||
|
@ -48,9 +47,9 @@ pub trait TRestyleDamage : BitOr<Output=Self> + Copy {
|
|||
fn rebuild_and_reflow() -> Self;
|
||||
}
|
||||
|
||||
pub trait TNode<'ln> : Sized + Copy + Clone {
|
||||
type ConcreteElement: TElement<'ln, ConcreteNode = Self, ConcreteDocument = Self::ConcreteDocument>;
|
||||
type ConcreteDocument: TDocument<'ln, ConcreteNode = Self, ConcreteElement = Self::ConcreteElement>;
|
||||
pub trait TNode : Sized + Copy + Clone {
|
||||
type ConcreteElement: TElement<ConcreteNode = Self, ConcreteDocument = Self::ConcreteDocument>;
|
||||
type ConcreteDocument: TDocument<ConcreteNode = Self, ConcreteElement = Self::ConcreteElement>;
|
||||
type ConcreteRestyleDamage: TRestyleDamage;
|
||||
|
||||
fn to_unsafe(&self) -> UnsafeNode;
|
||||
|
@ -65,22 +64,20 @@ pub trait TNode<'ln> : Sized + Copy + Clone {
|
|||
|
||||
fn dump(self);
|
||||
|
||||
fn traverse_preorder(self) -> TreeIterator<'ln, Self> {
|
||||
fn traverse_preorder(self) -> TreeIterator<Self> {
|
||||
TreeIterator::new(self)
|
||||
}
|
||||
|
||||
/// Returns an iterator over this node's children.
|
||||
fn children(self) -> ChildrenIterator<'ln, Self> {
|
||||
fn children(self) -> ChildrenIterator<Self> {
|
||||
ChildrenIterator {
|
||||
current: self.first_child(),
|
||||
phantom: PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
fn rev_children(self) -> ReverseChildrenIterator<'ln, Self> {
|
||||
fn rev_children(self) -> ReverseChildrenIterator<Self> {
|
||||
ReverseChildrenIterator {
|
||||
current: self.last_child(),
|
||||
phantom: PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,7 +166,7 @@ pub trait TNode<'ln> : Sized + Copy + Clone {
|
|||
|
||||
/// Returns the style results for the given node. If CSS selector matching
|
||||
/// has not yet been performed, fails.
|
||||
fn style(&'ln self) -> Ref<Arc<ComputedValues>> {
|
||||
fn style(&self) -> Ref<Arc<ComputedValues>> {
|
||||
Ref::map(self.borrow_data().unwrap(), |data| data.style.as_ref().unwrap())
|
||||
}
|
||||
|
||||
|
@ -179,9 +176,9 @@ pub trait TNode<'ln> : Sized + Copy + Clone {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait TDocument<'ld> : Sized + Copy + Clone {
|
||||
type ConcreteNode: TNode<'ld, ConcreteElement = Self::ConcreteElement, ConcreteDocument = Self>;
|
||||
type ConcreteElement: TElement<'ld, ConcreteNode = Self::ConcreteNode, ConcreteDocument = Self>;
|
||||
pub trait TDocument : Sized + Copy + Clone {
|
||||
type ConcreteNode: TNode<ConcreteElement = Self::ConcreteElement, ConcreteDocument = Self>;
|
||||
type ConcreteElement: TElement<ConcreteNode = Self::ConcreteNode, ConcreteDocument = Self>;
|
||||
|
||||
fn as_node(&self) -> Self::ConcreteNode;
|
||||
|
||||
|
@ -190,13 +187,13 @@ pub trait TDocument<'ld> : Sized + Copy + Clone {
|
|||
fn drain_modified_elements(&self) -> Vec<(Self::ConcreteElement, ElementSnapshot)>;
|
||||
}
|
||||
|
||||
pub trait TElement<'le> : Sized + Copy + Clone + ElementExt {
|
||||
type ConcreteNode: TNode<'le, ConcreteElement = Self, ConcreteDocument = Self::ConcreteDocument>;
|
||||
type ConcreteDocument: TDocument<'le, ConcreteNode = Self::ConcreteNode, ConcreteElement = Self>;
|
||||
pub trait TElement : Sized + Copy + Clone + ElementExt {
|
||||
type ConcreteNode: TNode<ConcreteElement = Self, ConcreteDocument = Self::ConcreteDocument>;
|
||||
type ConcreteDocument: TDocument<ConcreteNode = Self::ConcreteNode, ConcreteElement = Self>;
|
||||
|
||||
fn as_node(&self) -> Self::ConcreteNode;
|
||||
|
||||
fn style_attribute(&self) -> &'le Option<PropertyDeclarationBlock>;
|
||||
fn style_attribute(&self) -> &Option<PropertyDeclarationBlock>;
|
||||
|
||||
fn get_state(&self) -> ElementState;
|
||||
|
||||
|
@ -248,25 +245,22 @@ pub trait TElement<'le> : Sized + Copy + Clone + ElementExt {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct TreeIterator<'a, ConcreteNode> where ConcreteNode: TNode<'a> {
|
||||
pub struct TreeIterator<ConcreteNode> where ConcreteNode: TNode {
|
||||
stack: Vec<ConcreteNode>,
|
||||
// Satisfy the compiler about the unused lifetime.
|
||||
phantom: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
impl<'a, ConcreteNode> TreeIterator<'a, ConcreteNode> where ConcreteNode: TNode<'a> {
|
||||
fn new(root: ConcreteNode) -> TreeIterator<'a, ConcreteNode> {
|
||||
impl<ConcreteNode> TreeIterator<ConcreteNode> where ConcreteNode: TNode {
|
||||
fn new(root: ConcreteNode) -> TreeIterator<ConcreteNode> {
|
||||
let mut stack = vec!();
|
||||
stack.push(root);
|
||||
TreeIterator {
|
||||
stack: stack,
|
||||
phantom: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, ConcreteNode> Iterator for TreeIterator<'a, ConcreteNode>
|
||||
where ConcreteNode: TNode<'a> {
|
||||
impl<ConcreteNode> Iterator for TreeIterator<ConcreteNode>
|
||||
where ConcreteNode: TNode {
|
||||
type Item = ConcreteNode;
|
||||
fn next(&mut self) -> Option<ConcreteNode> {
|
||||
let ret = self.stack.pop();
|
||||
|
@ -275,14 +269,12 @@ impl<'a, ConcreteNode> Iterator for TreeIterator<'a, ConcreteNode>
|
|||
}
|
||||
}
|
||||
|
||||
pub struct ChildrenIterator<'a, ConcreteNode> where ConcreteNode: TNode<'a> {
|
||||
pub struct ChildrenIterator<ConcreteNode> where ConcreteNode: TNode {
|
||||
current: Option<ConcreteNode>,
|
||||
// Satisfy the compiler about the unused lifetime.
|
||||
phantom: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
impl<'a, ConcreteNode> Iterator for ChildrenIterator<'a, ConcreteNode>
|
||||
where ConcreteNode: TNode<'a> {
|
||||
impl<ConcreteNode> Iterator for ChildrenIterator<ConcreteNode>
|
||||
where ConcreteNode: TNode {
|
||||
type Item = ConcreteNode;
|
||||
fn next(&mut self) -> Option<ConcreteNode> {
|
||||
let node = self.current;
|
||||
|
@ -291,14 +283,12 @@ impl<'a, ConcreteNode> Iterator for ChildrenIterator<'a, ConcreteNode>
|
|||
}
|
||||
}
|
||||
|
||||
pub struct ReverseChildrenIterator<'a, ConcreteNode> where ConcreteNode: TNode<'a> {
|
||||
pub struct ReverseChildrenIterator<ConcreteNode> where ConcreteNode: TNode {
|
||||
current: Option<ConcreteNode>,
|
||||
// Satisfy the compiler about the unused lifetime.
|
||||
phantom: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
impl<'a, ConcreteNode> Iterator for ReverseChildrenIterator<'a, ConcreteNode>
|
||||
where ConcreteNode: TNode<'a> {
|
||||
impl<ConcreteNode> Iterator for ReverseChildrenIterator<ConcreteNode>
|
||||
where ConcreteNode: TNode {
|
||||
type Item = ConcreteNode;
|
||||
fn next(&mut self) -> Option<ConcreteNode> {
|
||||
let node = self.current;
|
||||
|
|
|
@ -29,7 +29,7 @@ use util::vec::ForgetfulSink;
|
|||
|
||||
/// High-level interface to CSS selector matching.
|
||||
|
||||
fn create_common_style_affecting_attributes_from_element<'le, E: TElement<'le>>(element: &E)
|
||||
fn create_common_style_affecting_attributes_from_element<E: TElement>(element: &E)
|
||||
-> CommonStyleAffectingAttributes {
|
||||
let mut flags = CommonStyleAffectingAttributes::empty();
|
||||
for attribute_info in &common_style_affecting_attributes() {
|
||||
|
@ -212,7 +212,7 @@ impl StyleSharingCandidate {
|
|||
/// the style sharing candidate or `None` if this node is ineligible for
|
||||
/// style sharing.
|
||||
#[allow(unsafe_code)]
|
||||
fn new<'le, E: TElement<'le>>(element: &E) -> Option<StyleSharingCandidate> {
|
||||
fn new<E: TElement>(element: &E) -> Option<StyleSharingCandidate> {
|
||||
let parent_element = match element.parent_element() {
|
||||
None => return None,
|
||||
Some(parent_element) => parent_element,
|
||||
|
@ -254,11 +254,11 @@ impl StyleSharingCandidate {
|
|||
link: element.is_link(),
|
||||
namespace: (*element.get_namespace()).clone(),
|
||||
common_style_affecting_attributes:
|
||||
create_common_style_affecting_attributes_from_element::<'le, E>(&element)
|
||||
create_common_style_affecting_attributes_from_element::<E>(&element)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn can_share_style_with<'a, E: TElement<'a>>(&self, element: &E) -> bool {
|
||||
pub fn can_share_style_with<E: TElement>(&self, element: &E) -> bool {
|
||||
if *element.get_local_name() != self.local_name {
|
||||
return false
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ impl StyleSharingCandidateCache {
|
|||
self.cache.iter()
|
||||
}
|
||||
|
||||
pub fn insert_if_possible<'le, E: TElement<'le>>(&mut self, element: &E) {
|
||||
pub fn insert_if_possible<E: TElement>(&mut self, element: &E) {
|
||||
match StyleSharingCandidate::new(element) {
|
||||
None => {}
|
||||
Some(candidate) => self.cache.insert(candidate, ())
|
||||
|
@ -364,7 +364,7 @@ pub enum StyleSharingResult<ConcreteRestyleDamage: TRestyleDamage> {
|
|||
StyleWasShared(usize, ConcreteRestyleDamage),
|
||||
}
|
||||
|
||||
trait PrivateMatchMethods<'ln>: TNode<'ln>
|
||||
trait PrivateMatchMethods: TNode
|
||||
where <Self::ConcreteElement as Element>::Impl: SelectorImplExt {
|
||||
fn cascade_node_pseudo_element(&self,
|
||||
context: &SharedStyleContext<<Self::ConcreteElement as Element>::Impl>,
|
||||
|
@ -483,10 +483,10 @@ trait PrivateMatchMethods<'ln>: TNode<'ln>
|
|||
}
|
||||
}
|
||||
|
||||
impl<'ln, N: TNode<'ln>> PrivateMatchMethods<'ln> for N
|
||||
impl<N: TNode> PrivateMatchMethods for N
|
||||
where <N::ConcreteElement as Element>::Impl: SelectorImplExt {}
|
||||
|
||||
trait PrivateElementMatchMethods<'le>: TElement<'le> {
|
||||
trait PrivateElementMatchMethods: TElement {
|
||||
fn share_style_with_candidate_if_possible(&self,
|
||||
parent_node: Option<Self::ConcreteNode>,
|
||||
candidate: &StyleSharingCandidate)
|
||||
|
@ -516,9 +516,9 @@ trait PrivateElementMatchMethods<'le>: TElement<'le> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'le, E: TElement<'le>> PrivateElementMatchMethods<'le> for E {}
|
||||
impl<E: TElement> PrivateElementMatchMethods for E {}
|
||||
|
||||
pub trait ElementMatchMethods<'le> : TElement<'le>
|
||||
pub trait ElementMatchMethods : TElement
|
||||
where Self::Impl: SelectorImplExt {
|
||||
fn match_element(&self,
|
||||
stylist: &Stylist<Self::Impl>,
|
||||
|
@ -552,7 +552,7 @@ pub trait ElementMatchMethods<'le> : TElement<'le>
|
|||
style_sharing_candidate_cache:
|
||||
&mut StyleSharingCandidateCache,
|
||||
parent: Option<Self::ConcreteNode>)
|
||||
-> StyleSharingResult<<Self::ConcreteNode as TNode<'le>>::ConcreteRestyleDamage> {
|
||||
-> StyleSharingResult<<Self::ConcreteNode as TNode>::ConcreteRestyleDamage> {
|
||||
if opts::get().disable_share_style_cache {
|
||||
return StyleSharingResult::CannotShare
|
||||
}
|
||||
|
@ -570,7 +570,7 @@ pub trait ElementMatchMethods<'le> : TElement<'le>
|
|||
// Yay, cache hit. Share the style.
|
||||
let node = self.as_node();
|
||||
let style = &mut node.mutate_data().unwrap().style;
|
||||
let damage = <<Self as TElement<'le>>::ConcreteNode as TNode<'le>>
|
||||
let damage = <<Self as TElement>::ConcreteNode as TNode>
|
||||
::ConcreteRestyleDamage::compute((*style).as_ref(), &*shared_style);
|
||||
*style = Some(shared_style);
|
||||
return StyleSharingResult::StyleWasShared(i, damage)
|
||||
|
@ -583,10 +583,10 @@ pub trait ElementMatchMethods<'le> : TElement<'le>
|
|||
}
|
||||
}
|
||||
|
||||
impl<'le, E: TElement<'le>> ElementMatchMethods<'le> for E
|
||||
impl<E: TElement> ElementMatchMethods for E
|
||||
where E::Impl: SelectorImplExt {}
|
||||
|
||||
pub trait MatchMethods<'ln> : TNode<'ln> {
|
||||
pub trait MatchMethods : TNode {
|
||||
// The below two functions are copy+paste because I can't figure out how to
|
||||
// write a function which takes a generic function. I don't think it can
|
||||
// be done.
|
||||
|
@ -716,4 +716,4 @@ pub trait MatchMethods<'ln> : TNode<'ln> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'ln, N: TNode<'ln>> MatchMethods<'ln> for N {}
|
||||
impl<N: TNode> MatchMethods for N {}
|
||||
|
|
|
@ -39,10 +39,10 @@ pub fn run_queue_with_custom_work_data_type<To, F, SharedContext: Sync>(
|
|||
queue.run(shared);
|
||||
}
|
||||
|
||||
pub fn traverse_dom<'ln, N, C>(root: N,
|
||||
pub fn traverse_dom<N, C>(root: N,
|
||||
queue_data: &C::SharedContext,
|
||||
queue: &mut WorkQueue<C::SharedContext, WorkQueueData>)
|
||||
where N: TNode<'ln>, C: DomTraversalContext<'ln, N> {
|
||||
where N: TNode, C: DomTraversalContext<N> {
|
||||
run_queue_with_custom_work_data_type(queue, |queue| {
|
||||
queue.push(WorkUnit {
|
||||
fun: top_down_dom::<N, C>,
|
||||
|
@ -53,9 +53,9 @@ pub fn traverse_dom<'ln, N, C>(root: N,
|
|||
|
||||
/// A parallel top-down DOM traversal.
|
||||
#[inline(always)]
|
||||
fn top_down_dom<'ln, N, C>(unsafe_nodes: UnsafeNodeList,
|
||||
fn top_down_dom<N, C>(unsafe_nodes: UnsafeNodeList,
|
||||
proxy: &mut WorkerProxy<C::SharedContext, UnsafeNodeList>)
|
||||
where N: TNode<'ln>, C: DomTraversalContext<'ln, N> {
|
||||
where N: TNode, C: DomTraversalContext<N> {
|
||||
let context = C::new(proxy.user_data(), unsafe_nodes.1);
|
||||
|
||||
let mut discovered_child_nodes = Vec::new();
|
||||
|
@ -105,10 +105,10 @@ fn top_down_dom<'ln, N, C>(unsafe_nodes: UnsafeNodeList,
|
|||
///
|
||||
/// The only communication between siblings is that they both
|
||||
/// fetch-and-subtract the parent's children count.
|
||||
fn bottom_up_dom<'ln, N, C>(root: OpaqueNode,
|
||||
fn bottom_up_dom<N, C>(root: OpaqueNode,
|
||||
unsafe_node: UnsafeNode,
|
||||
proxy: &mut WorkerProxy<C::SharedContext, UnsafeNodeList>)
|
||||
where N: TNode<'ln>, C: DomTraversalContext<'ln, N> {
|
||||
where N: TNode, C: DomTraversalContext<N> {
|
||||
let context = C::new(proxy.user_data(), root);
|
||||
|
||||
// Get a real layout node.
|
||||
|
|
|
@ -248,7 +248,7 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
|
|||
/// The returned boolean indicates whether the style is *shareable*; that is, whether the
|
||||
/// matched selectors are simple enough to allow the matching logic to be reduced to the logic
|
||||
/// in `css::matching::PrivateMatchMethods::candidate_element_allows_for_style_sharing`.
|
||||
pub fn push_applicable_declarations<'le, E, V>(
|
||||
pub fn push_applicable_declarations<E, V>(
|
||||
&self,
|
||||
element: &E,
|
||||
parent_bf: Option<&BloomFilter>,
|
||||
|
@ -256,7 +256,7 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
|
|||
pseudo_element: Option<Impl::PseudoElement>,
|
||||
applicable_declarations: &mut V)
|
||||
-> bool
|
||||
where E: Element<Impl=Impl> + TElement<'le>,
|
||||
where E: Element<Impl=Impl> + TElement,
|
||||
V: VecLike<DeclarationBlock> {
|
||||
assert!(!self.is_device_dirty);
|
||||
assert!(style_attribute.is_none() || pseudo_element.is_none(),
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
use dom::TNode;
|
||||
use traversal::DomTraversalContext;
|
||||
|
||||
pub fn traverse_dom<'ln, N, C>(root: N,
|
||||
pub fn traverse_dom<N, C>(root: N,
|
||||
shared: &C::SharedContext)
|
||||
where N: TNode<'ln>,
|
||||
C: DomTraversalContext<'ln, N> {
|
||||
fn doit<'a, 'ln, N, C>(context: &'a C, node: N)
|
||||
where N: TNode<'ln>, C: DomTraversalContext<'ln, N> {
|
||||
where N: TNode,
|
||||
C: DomTraversalContext<N> {
|
||||
fn doit<'a, N, C>(context: &'a C, node: N)
|
||||
where N: TNode, C: DomTraversalContext<N> {
|
||||
context.process_preorder(node);
|
||||
|
||||
for kid in node.children() {
|
||||
|
|
|
@ -43,11 +43,11 @@ thread_local!(
|
|||
///
|
||||
/// If one does not exist, a new one will be made for you. If it is out of date,
|
||||
/// it will be cleared and reused.
|
||||
fn take_thread_local_bloom_filter<'ln, N, Impl: SelectorImplExt>(parent_node: Option<N>,
|
||||
fn take_thread_local_bloom_filter<N, Impl: SelectorImplExt>(parent_node: Option<N>,
|
||||
root: OpaqueNode,
|
||||
context: &SharedStyleContext<Impl>)
|
||||
-> Box<BloomFilter>
|
||||
where N: TNode<'ln> {
|
||||
where N: TNode {
|
||||
STYLE_BLOOM.with(|style_bloom| {
|
||||
match (parent_node, style_bloom.borrow_mut().take()) {
|
||||
// Root node. Needs new bloom filter.
|
||||
|
@ -90,10 +90,10 @@ pub fn put_thread_local_bloom_filter<Impl: SelectorImplExt>(bf: Box<BloomFilter>
|
|||
}
|
||||
|
||||
/// "Ancestors" in this context is inclusive of ourselves.
|
||||
fn insert_ancestors_into_bloom_filter<'ln, N>(bf: &mut Box<BloomFilter>,
|
||||
fn insert_ancestors_into_bloom_filter<N>(bf: &mut Box<BloomFilter>,
|
||||
mut n: N,
|
||||
root: OpaqueNode)
|
||||
where N: TNode<'ln> {
|
||||
where N: TNode {
|
||||
debug!("[{}] Inserting ancestors.", tid());
|
||||
let mut ancestors = 0;
|
||||
loop {
|
||||
|
@ -108,7 +108,7 @@ fn insert_ancestors_into_bloom_filter<'ln, N>(bf: &mut Box<BloomFilter>,
|
|||
debug!("[{}] Inserted {} ancestors.", tid(), ancestors);
|
||||
}
|
||||
|
||||
pub trait DomTraversalContext<'ln, N: TNode<'ln>> {
|
||||
pub trait DomTraversalContext<N: TNode> {
|
||||
type SharedContext: Sync + 'static;
|
||||
fn new<'a>(&'a Self::SharedContext, OpaqueNode) -> Self;
|
||||
fn process_preorder(&self, node: N);
|
||||
|
@ -119,10 +119,10 @@ pub trait DomTraversalContext<'ln, N: TNode<'ln>> {
|
|||
/// layout computation. This computes the styles applied to each node.
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
pub fn recalc_style_at<'a, 'ln, N, C>(context: &'a C,
|
||||
pub fn recalc_style_at<'a, N, C>(context: &'a C,
|
||||
root: OpaqueNode,
|
||||
node: N)
|
||||
where N: TNode<'ln>,
|
||||
where N: TNode,
|
||||
C: StyleContext<'a, <N::ConcreteElement as Element>::Impl>,
|
||||
<N::ConcreteElement as Element>::Impl: SelectorImplExt + 'a {
|
||||
// Initialize layout data.
|
||||
|
|
|
@ -64,7 +64,7 @@ pub struct RecalcStyleOnly<'lc> {
|
|||
root: OpaqueNode,
|
||||
}
|
||||
|
||||
impl<'lc, 'ln, N: TNode<'ln>> DomTraversalContext<'ln, N> for RecalcStyleOnly<'lc>
|
||||
impl<'lc, N: TNode> DomTraversalContext<N> for RecalcStyleOnly<'lc>
|
||||
where N::ConcreteElement: ::selectors::Element<Impl=GeckoSelectorImpl> {
|
||||
type SharedContext = SharedStyleContext;
|
||||
#[allow(unsafe_code)]
|
||||
|
|
|
@ -88,7 +88,7 @@ impl BitOr for DummyRestyleDamage {
|
|||
|
||||
|
||||
|
||||
impl<'ln> TNode<'ln> for GeckoNode<'ln> {
|
||||
impl<'ln> TNode for GeckoNode<'ln> {
|
||||
type ConcreteDocument = GeckoDocument<'ln>;
|
||||
type ConcreteElement = GeckoElement<'ln>;
|
||||
type ConcreteRestyleDamage = DummyRestyleDamage;
|
||||
|
@ -268,7 +268,7 @@ impl<'ld> GeckoDocument<'ld> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'ld> TDocument<'ld> for GeckoDocument<'ld> {
|
||||
impl<'ld> TDocument for GeckoDocument<'ld> {
|
||||
type ConcreteNode = GeckoNode<'ld>;
|
||||
type ConcreteElement = GeckoElement<'ld>;
|
||||
|
||||
|
@ -309,7 +309,7 @@ impl<'le> GeckoElement<'le> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'le> TElement<'le> for GeckoElement<'le> {
|
||||
impl<'le> TElement for GeckoElement<'le> {
|
||||
type ConcreteNode = GeckoNode<'le>;
|
||||
type ConcreteDocument = GeckoDocument<'le>;
|
||||
|
||||
|
@ -317,7 +317,7 @@ impl<'le> TElement<'le> for GeckoElement<'le> {
|
|||
unsafe { GeckoNode::from_raw(self.element as *mut RawGeckoNode) }
|
||||
}
|
||||
|
||||
fn style_attribute(&self) -> &'le Option<PropertyDeclarationBlock> {
|
||||
fn style_attribute(&self) -> &Option<PropertyDeclarationBlock> {
|
||||
panic!("Requires signature modification - only implemented in stylo branch");
|
||||
/*
|
||||
// FIXME(bholley): We should do what Servo does here. Gecko needs to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue