From 4d9d482ba61032d8eed052d840e671de5919bfac Mon Sep 17 00:00:00 2001 From: "mjudge@netscape.com" Date: Wed, 22 Sep 1999 06:12:44 +0000 Subject: [PATCH] recursion failing finding the same frame we started with sometimes with generated content from style. simple 2 line check to avoind this. dagley said ok to check in red tree since not hurting anyone. --- layout/generic/nsFrame.cpp | 11 ++++++++++- layout/html/base/src/nsFrame.cpp | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 56a53741b2be..bc9ab0e05f82 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -2023,7 +2023,16 @@ nsFrame::PeekOffset(nsPeekOffsetStruct *aPos) edgeCase, //start from thisLine &(aPos->mResultFrame) ); - doneLooping = PR_TRUE; //do not continue with while loop + if (aPos->mResultFrame == this)//we came back to same spot! keep going + { + aPos->mResultFrame = nsnull; + if (aPos->mDirection == eDirPrevious) + thisLine--; + else + thisLine++; + } + else + doneLooping = PR_TRUE; //do not continue with while loop if (NS_SUCCEEDED(result) && aPos->mResultFrame){ result = aPos->mResultFrame->QueryInterface(nsILineIterator::GetIID(),getter_AddRefs(it)); if (NS_SUCCEEDED(result) && it)//we have struck another block element! diff --git a/layout/html/base/src/nsFrame.cpp b/layout/html/base/src/nsFrame.cpp index 56a53741b2be..bc9ab0e05f82 100644 --- a/layout/html/base/src/nsFrame.cpp +++ b/layout/html/base/src/nsFrame.cpp @@ -2023,7 +2023,16 @@ nsFrame::PeekOffset(nsPeekOffsetStruct *aPos) edgeCase, //start from thisLine &(aPos->mResultFrame) ); - doneLooping = PR_TRUE; //do not continue with while loop + if (aPos->mResultFrame == this)//we came back to same spot! keep going + { + aPos->mResultFrame = nsnull; + if (aPos->mDirection == eDirPrevious) + thisLine--; + else + thisLine++; + } + else + doneLooping = PR_TRUE; //do not continue with while loop if (NS_SUCCEEDED(result) && aPos->mResultFrame){ result = aPos->mResultFrame->QueryInterface(nsILineIterator::GetIID(),getter_AddRefs(it)); if (NS_SUCCEEDED(result) && it)//we have struck another block element!