diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2014-02-26 22:58:00 -0800 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2014-02-27 11:23:06 -0800 |
commit | 3c288a5b80ff53061e44101a746c2ebd2a081fb0 (patch) | |
tree | 91ae336e2f1adc9a6d2cae788a9da4ec266e2d84 /src/components/script/dom/node.rs | |
parent | 94a12469f05f8f00092a88ff1ae11fc33c086bbb (diff) | |
download | servo-3c288a5b80ff53061e44101a746c2ebd2a081fb0.tar.gz servo-3c288a5b80ff53061e44101a746c2ebd2a081fb0.zip |
layout: Stop racing on the JSManaged borrow flags
Diffstat (limited to 'src/components/script/dom/node.rs')
-rw-r--r-- | src/components/script/dom/node.rs | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/components/script/dom/node.rs b/src/components/script/dom/node.rs index 419b02c844a..1aa4a0ff825 100644 --- a/src/components/script/dom/node.rs +++ b/src/components/script/dom/node.rs @@ -332,7 +332,7 @@ impl NodeHelpers for JS<Node> { fn parent_node(&self) -> Option<JS<Node>> { self.get().parent_node.clone() } - + fn first_child(&self) -> Option<JS<Node>> { self.get().first_child.clone() } @@ -1590,6 +1590,31 @@ impl Node { pub fn set_hover_state(&mut self, state: bool) { self.flags.set_is_in_hover_state(state); } + + #[inline] + pub fn parent_node_ref<'a>(&'a self) -> Option<&'a JS<Node>> { + self.parent_node.as_ref() + } + + #[inline] + pub fn first_child_ref<'a>(&'a self) -> Option<&'a JS<Node>> { + self.first_child.as_ref() + } + + #[inline] + pub fn last_child_ref<'a>(&'a self) -> Option<&'a JS<Node>> { + self.last_child.as_ref() + } + + #[inline] + pub fn prev_sibling_ref<'a>(&'a self) -> Option<&'a JS<Node>> { + self.prev_sibling.as_ref() + } + + #[inline] + pub fn next_sibling_ref<'a>(&'a self) -> Option<&'a JS<Node>> { + self.next_sibling.as_ref() + } } impl Reflectable for Node { |