diff --git a/src/components/main/layout/box_builder.rs b/src/components/main/layout/box_builder.rs index ff9457f69d4..fd5dfd5bbc1 100644 --- a/src/components/main/layout/box_builder.rs +++ b/src/components/main/layout/box_builder.rs @@ -356,14 +356,8 @@ impl LayoutTreeBuilder { sibling_generator: Option<@mut BoxGenerator>) -> Option<(@mut BoxGenerator, @mut BoxGenerator)> { - fn is_root(node: AbstractNode) -> bool { - match node.parent_node() { - None => true, - Some(_) => false - } - } let display = if node.is_element() { - match node.style().display(is_root(node)) { + match node.style().display(node.is_root()) { CSSDisplayNone => return None, // tree ends here if 'display: none' // TODO(eatkinson) these are hacks so that the code doesn't crash // when unsupported display values are used. They should be deleted diff --git a/src/components/script/dom/node.rs b/src/components/script/dom/node.rs index 8757f08d5d3..edd108e6881 100644 --- a/src/components/script/dom/node.rs +++ b/src/components/script/dom/node.rs @@ -264,6 +264,11 @@ impl<'self, View> AbstractNode { 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 //