diff --git a/src/servo/util/tree.rs b/src/servo/util/tree.rs index 1436a92707e..2f58c8c4d56 100644 --- a/src/servo/util/tree.rs +++ b/src/servo/util/tree.rs @@ -34,6 +34,26 @@ pub fn each_child>(ops: &O, node: &T, f: fn(&T) -> bool) } } +pub fn first_child>(ops: &O, node: &T) -> Option { + ops.with_tree_fields(node, |tf| tf.first_child) +} + +pub fn last_child>(ops: &O, node: &T) -> Option { + ops.with_tree_fields(node, |tf| tf.last_child) +} + +pub fn next_sibling>(ops: &O, node: &T) -> Option { + ops.with_tree_fields(node, |tf| tf.next_sibling) +} + +pub fn prev_sibling>(ops: &O, node: &T) -> Option { + ops.with_tree_fields(node, |tf| tf.prev_sibling) +} + +pub fn parent>(ops: &O, node: &T) -> Option { + ops.with_tree_fields(node, |tf| tf.parent) +} + pub fn empty() -> Tree { {mut parent: None, mut first_child: None,