Fix for bug #20106: [DOGFOOD] caret dissapears after some edit operations

Modified nsRangeList::GetFrameForNodeOffset() to handle case where aOffset
is >= to number of children.
r=mjudge@netscape.com


git-svn-id: svn://10.0.0.236/trunk@55438 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
kin%netscape.com 1999-12-06 20:10:18 +00:00
parent ec87243cd6
commit 238a3616c4

View File

@ -1519,10 +1519,25 @@ nsRangeList::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
{
if (aOffset >= 0)
{
if (mHint == HINTLEFT && aOffset >0)//we should back up a little
if (mHint == HINTLEFT && aOffset > 0)//we should back up a little
result = aNode->ChildAt(aOffset-1, aNode);
else
result = aNode->ChildAt(aOffset, aNode);
else {
PRInt32 childCount = 0;
PRInt32 offset = aOffset;
result = aNode->ChildCount(childCount);
if (NS_FAILED(result))
return result;
if (childCount <= 0)
return NS_ERROR_FAILURE;
if (aOffset >= childCount)
offset = childCount - 1;
result = aNode->ChildAt(offset, aNode);
}
if (NS_FAILED(result))
return result;
if (!aNode) //out of bounds?