From 25e7e29995a3546fb8030d8cda6010b031351954 Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Sat, 18 Jul 1998 18:18:53 +0000 Subject: [PATCH] changed GetNextContent to pas back next leaf node content --- content/base/src/nsDocument.cpp | 9 +++++++-- layout/base/src/nsDocument.cpp | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index f4fc7a0548e..9a49e546355 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -1169,10 +1169,15 @@ nsIContent* nsDocument::GetNextContent(nsIContent *aContent) const { PRInt32 index = parent->IndexOf(aContent); PRInt32 count = parent->ChildCount(); - if (index+1 < count) + if (index+1 < count) { result = parent->ChildAt(index+1); - else + // Get first child down the tree + while (result->ChildCount() > 0) { + result = result->ChildAt(0); + } + } else { result = GetNextContent(parent); + } } } return result; diff --git a/layout/base/src/nsDocument.cpp b/layout/base/src/nsDocument.cpp index f4fc7a0548e..9a49e546355 100644 --- a/layout/base/src/nsDocument.cpp +++ b/layout/base/src/nsDocument.cpp @@ -1169,10 +1169,15 @@ nsIContent* nsDocument::GetNextContent(nsIContent *aContent) const { PRInt32 index = parent->IndexOf(aContent); PRInt32 count = parent->ChildCount(); - if (index+1 < count) + if (index+1 < count) { result = parent->ChildAt(index+1); - else + // Get first child down the tree + while (result->ChildCount() > 0) { + result = result->ChildAt(0); + } + } else { result = GetNextContent(parent); + } } } return result;