aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/node.rs
diff options
context:
space:
mode:
authorbors-servo <release+servo@mozilla.com>2013-08-01 15:42:26 -0700
committerbors-servo <release+servo@mozilla.com>2013-08-01 15:42:26 -0700
commit1d04d5f1bc90d7ddd27718fe7ea2b9866f94d79b (patch)
tree77b0021787f706cf03c3d2fe8fb84991f8e1b948 /src/components/script/dom/node.rs
parentbb51a9d6fb784e71ac279e501e21064fe6bdad5b (diff)
parentb266b5a949103b0c0f11a38a0506c232723f7692 (diff)
downloadservo-1d04d5f1bc90d7ddd27718fe7ea2b9866f94d79b.tar.gz
servo-1d04d5f1bc90d7ddd27718fe7ea2b9866f94d79b.zip
auto merge of #646 : kmcallister/servo/incremental-layout, r=metajack
This is a first attempt at incremental layout. When recomputing styles, we compare old and new CSS properties to determine which layout steps can be skipped. Since I'm new to Servo I'm not sure that my code matches the idioms of the project. Please don't hold back with review comments :)
Diffstat (limited to 'src/components/script/dom/node.rs')
-rw-r--r--src/components/script/dom/node.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/components/script/dom/node.rs b/src/components/script/dom/node.rs
index d9ee80edaa1..edd108e6881 100644
--- a/src/components/script/dom/node.rs
+++ b/src/components/script/dom/node.rs
@@ -264,6 +264,11 @@ impl<'self, View> AbstractNode<View> {
self.with_base(|b| b.next_sibling)
}
+ /// Is this node a root?
+ pub fn is_root(self) -> bool {
+ self.parent_node().is_none()
+ }
+
//
// Downcasting borrows
//
@@ -415,10 +420,7 @@ impl<'self, View> AbstractNode<View> {
impl<View> Iterator<AbstractNode<View>> for AbstractNodeChildrenIterator<View> {
pub fn next(&mut self) -> Option<AbstractNode<View>> {
let node = self.current_node;
- self.current_node = match self.current_node {
- None => None,
- Some(node) => node.next_sibling(),
- };
+ self.current_node = self.current_node.chain(|node| node.next_sibling());
node
}
}