mirror of
https://github.com/servo/servo.git
synced 2025-06-20 23:28:59 +01:00
Move is_root() into AbstractNode
This commit is contained in:
parent
ae79f5351d
commit
a9a5e90787
2 changed files with 6 additions and 7 deletions
|
@ -356,14 +356,8 @@ impl LayoutTreeBuilder {
|
||||||
sibling_generator: Option<@mut BoxGenerator>)
|
sibling_generator: Option<@mut BoxGenerator>)
|
||||||
-> Option<(@mut BoxGenerator, @mut BoxGenerator)> {
|
-> Option<(@mut BoxGenerator, @mut BoxGenerator)> {
|
||||||
|
|
||||||
fn is_root(node: AbstractNode<LayoutView>) -> bool {
|
|
||||||
match node.parent_node() {
|
|
||||||
None => true,
|
|
||||||
Some(_) => false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let display = if node.is_element() {
|
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'
|
CSSDisplayNone => return None, // tree ends here if 'display: none'
|
||||||
// TODO(eatkinson) these are hacks so that the code doesn't crash
|
// TODO(eatkinson) these are hacks so that the code doesn't crash
|
||||||
// when unsupported display values are used. They should be deleted
|
// when unsupported display values are used. They should be deleted
|
||||||
|
|
|
@ -264,6 +264,11 @@ impl<'self, View> AbstractNode<View> {
|
||||||
self.with_base(|b| b.next_sibling)
|
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
|
// Downcasting borrows
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue