Hoist style() and unstyle() into TNode.

This commit is contained in:
Bobby Holley 2016-01-12 13:15:37 -08:00
parent e977a6e69a
commit 77b1027646
3 changed files with 7 additions and 10 deletions

View file

@ -160,10 +160,14 @@ 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(&self) -> Ref<Arc<ComputedValues>>;
fn style(&self) -> Ref<Arc<ComputedValues>> {
Ref::map(self.borrow_data().unwrap(), |data| data.style.as_ref().unwrap())
}
/// Removes the style from this node.
fn unstyle(self);
fn unstyle(self) {
self.mutate_data().unwrap().style = None;
}
}
pub trait TDocument<'ld> : Sized + Copy + Clone {