mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Hoist style() and unstyle() into TNode.
This commit is contained in:
parent
e977a6e69a
commit
77b1027646
3 changed files with 7 additions and 10 deletions
|
@ -275,14 +275,6 @@ impl<'ln> TNode<'ln> for ServoLayoutNode<'ln> {
|
||||||
self.node.next_sibling_ref().map(|node| self.new_with_this_lifetime(&node))
|
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> {
|
impl<'ln> LayoutNode<'ln> for ServoLayoutNode<'ln> {
|
||||||
|
|
|
@ -160,10 +160,14 @@ pub trait TNode<'ln> : Sized + Copy + Clone {
|
||||||
|
|
||||||
/// Returns the style results for the given node. If CSS selector matching
|
/// Returns the style results for the given node. If CSS selector matching
|
||||||
/// has not yet been performed, fails.
|
/// 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.
|
/// 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 {
|
pub trait TDocument<'ld> : Sized + Copy + Clone {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
|
#![feature(cell_extras)]
|
||||||
#![feature(concat_idents)]
|
#![feature(concat_idents)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
#![feature(custom_attribute)]
|
#![feature(custom_attribute)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue