From 2ea1e201ca15c579be2406d75e032d3678cc103d Mon Sep 17 00:00:00 2001 From: "kin%netscape.com" Date: Tue, 12 Jun 2001 20:46:57 +0000 Subject: [PATCH] Fix for bug #83946 (Crash/freeze when backspacing over signature lines) Fixed infinite loop in PriorVisibleNode() and NextVisibleNode() which would happen when aNode was a node that could have children, but didn't have any, and it's prior/next siblings weren't eNormalWS. r=jfrancis@netscape.com sr=sfraser@netscape.com a=asa@mozilla.org git-svn-id: svn://10.0.0.236/trunk@96964 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/editor/base/nsWSRunObject.cpp | 16 ++++++---------- mozilla/editor/libeditor/html/nsWSRunObject.cpp | 16 ++++++---------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/mozilla/editor/base/nsWSRunObject.cpp b/mozilla/editor/base/nsWSRunObject.cpp index 1624abac11f..1c16b2ac418 100644 --- a/mozilla/editor/base/nsWSRunObject.cpp +++ b/mozilla/editor/base/nsWSRunObject.cpp @@ -536,11 +536,7 @@ nsWSRunObject::PriorVisibleNode(nsIDOMNode *aNode, // is there a visible run there or earlier? while (run) { - if (run->mType != eNormalWS) - { - run = run->mLeft; - } - else + if (run->mType == eNormalWS) { WSPoint point; res = GetCharBefore(aNode, aOffset, &point); @@ -566,6 +562,8 @@ nsWSRunObject::PriorVisibleNode(nsIDOMNode *aNode, } // else if no text node then keep looking. We should eventually fall out of loop } + + run = run->mLeft; } // if we get here then nothing in ws data to find. return start reason @@ -594,11 +592,7 @@ nsWSRunObject::NextVisibleNode (nsIDOMNode *aNode, // is there a visible run there or later? while (run) { - if (run->mType != eNormalWS) - { - run = run->mRight; - } - else + if (run->mType == eNormalWS) { WSPoint point; res = GetCharAfter(aNode, aOffset, &point); @@ -624,6 +618,8 @@ nsWSRunObject::NextVisibleNode (nsIDOMNode *aNode, } // else if no text node then keep looking. We should eventually fall out of loop } + + run = run->mRight; } // if we get here then nothing in ws data to find. return end reason diff --git a/mozilla/editor/libeditor/html/nsWSRunObject.cpp b/mozilla/editor/libeditor/html/nsWSRunObject.cpp index 1624abac11f..1c16b2ac418 100644 --- a/mozilla/editor/libeditor/html/nsWSRunObject.cpp +++ b/mozilla/editor/libeditor/html/nsWSRunObject.cpp @@ -536,11 +536,7 @@ nsWSRunObject::PriorVisibleNode(nsIDOMNode *aNode, // is there a visible run there or earlier? while (run) { - if (run->mType != eNormalWS) - { - run = run->mLeft; - } - else + if (run->mType == eNormalWS) { WSPoint point; res = GetCharBefore(aNode, aOffset, &point); @@ -566,6 +562,8 @@ nsWSRunObject::PriorVisibleNode(nsIDOMNode *aNode, } // else if no text node then keep looking. We should eventually fall out of loop } + + run = run->mLeft; } // if we get here then nothing in ws data to find. return start reason @@ -594,11 +592,7 @@ nsWSRunObject::NextVisibleNode (nsIDOMNode *aNode, // is there a visible run there or later? while (run) { - if (run->mType != eNormalWS) - { - run = run->mRight; - } - else + if (run->mType == eNormalWS) { WSPoint point; res = GetCharAfter(aNode, aOffset, &point); @@ -624,6 +618,8 @@ nsWSRunObject::NextVisibleNode (nsIDOMNode *aNode, } // else if no text node then keep looking. We should eventually fall out of loop } + + run = run->mRight; } // if we get here then nothing in ws data to find. return end reason