Make parallel DOM traversal and style calculation operate on TNode instead of LayoutNode.

This commit is contained in:
Bobby Holley 2015-12-31 11:05:17 -08:00
parent 238a8786de
commit ebc5eb1b98
4 changed files with 30 additions and 12 deletions

View file

@ -275,6 +275,14 @@ impl<'ln> TNode<'ln> for ServoLayoutNode<'ln> {
self.node.next_sibling_ref().map(|node| self.new_with_this_lifetime(&node))
}
}
fn style(&self) -> Ref<Arc<ComputedValues>> {
Ref::map(self.borrow_data().unwrap(), |data| data.style.as_ref().unwrap())
}
fn unstyle(self) {
self.mutate_data().unwrap().style = None;
}
}
impl<'ln> LayoutNode<'ln> for ServoLayoutNode<'ln> {
@ -696,6 +704,8 @@ pub trait ThreadSafeLayoutNode<'ln> : Clone + Copy + Sized {
/// Returns the style results for the given node. If CSS selector matching
/// has not yet been performed, fails.
///
/// Unlike the version on TNode, this handles pseudo-elements.
#[inline]
fn style(&self) -> Ref<Arc<ComputedValues>> {
Ref::map(self.borrow_layout_data().unwrap(), |data| {
@ -709,6 +719,8 @@ pub trait ThreadSafeLayoutNode<'ln> : Clone + Copy + Sized {
}
/// Removes the style from this node.
///
/// Unlike the version on TNode, this handles pseudo-elements.
fn unstyle(self) {
let mut data = self.mutate_layout_data().unwrap();
let style =