From 2c863a555bdbfda6daa2597286ac351a6b4e0b63 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Tue, 29 Jul 2003 23:49:41 +0000 Subject: [PATCH] Fix selection regression. Bug 214343, r=caillon, sr=jst git-svn-id: svn://10.0.0.236/trunk@145363 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsContentUtils.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mozilla/content/base/src/nsContentUtils.cpp b/mozilla/content/base/src/nsContentUtils.cpp index 637adf19051..84ac0fecf75 100644 --- a/mozilla/content/base/src/nsContentUtils.cpp +++ b/mozilla/content/base/src/nsContentUtils.cpp @@ -1015,12 +1015,14 @@ nsContentUtils::GetAncestorsAndOffsets(nsIDOMNode* aNode, aAncestorOffsets->AppendElement(NS_INT32_TO_PTR(aOffset)); // insert all the ancestors - nsIContent* ancestor = content->GetParent(); - while (ancestor) { - ancestor->IndexOf(content, offset); - aAncestorNodes->AppendElement(ancestor); + nsIContent* child = content; + nsIContent* parent = child->GetParent(); + while (parent) { + parent->IndexOf(child, offset); + aAncestorNodes->AppendElement(parent); aAncestorOffsets->AppendElement(NS_INT32_TO_PTR(offset)); - ancestor = ancestor->GetParent(); + child = parent; + parent = parent->GetParent(); } return NS_OK;