diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs index d903862c136..ab7f9027d5e 100644 --- a/components/script/dom/range.rs +++ b/components/script/dom/range.rs @@ -52,6 +52,12 @@ pub struct Range { associated_selections: DomRefCell>>, } +pub struct ContainedChildren { + first_partially_contained_child: Option>, + last_partially_contained_child: Option>, + contained_children: Vec>, +} + impl Range { fn new_inherited( start_container: &Node, @@ -149,13 +155,7 @@ impl Range { } /// - fn contained_children( - &self, - ) -> Fallible<( - Option>, - Option>, - Vec>, - )> { + fn contained_children(&self) -> Fallible { let start_node = self.start_container(); let end_node = self.end_container(); // Steps 5-6. @@ -192,11 +192,11 @@ impl Range { return Err(Error::HierarchyRequest); } - Ok(( - first_contained_child, - last_contained_child, + Ok(ContainedChildren { + first_partially_contained_child: first_contained_child, + last_partially_contained_child: last_contained_child, contained_children, - )) + }) } /// @@ -583,8 +583,11 @@ impl RangeMethods for Range { } // Steps 5-12. - let (first_contained_child, last_contained_child, contained_children) = - self.contained_children()?; + let ContainedChildren { + first_partially_contained_child: first_contained_child, + last_partially_contained_child: last_contained_child, + contained_children, + } = self.contained_children()?; if let Some(child) = first_contained_child { // Step 13. @@ -697,8 +700,11 @@ impl RangeMethods for Range { } // Steps 5-12. - let (first_contained_child, last_contained_child, contained_children) = - self.contained_children()?; + let ContainedChildren { + first_partially_contained_child: first_contained_child, + last_partially_contained_child: last_contained_child, + contained_children, + } = self.contained_children()?; let (new_node, new_offset) = if start_node.is_inclusive_ancestor_of(&end_node) { // Step 13.