From 1eb8900f486e681888f0e5dccd7e677cd17ecadd Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 29 Oct 2015 16:54:20 +0100 Subject: [PATCH] Simplify LayoutDocument::root_node. --- components/layout/wrapper.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 9a936433d79..72973633067 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -369,11 +369,7 @@ impl<'le> LayoutDocument<'le> { } pub fn root_node(&self) -> Option> { - let mut node = self.as_node().first_child(); - while node.is_some() && !node.unwrap().is_element() { - node = node.unwrap().next_sibling(); - } - node + self.as_node().children().find(LayoutNode::is_element) } pub fn drain_event_state_changes(&self) -> Vec<(LayoutElement, EventState)> {