Bug 305239. Fix regression in text entry. r+sr=roc, patch by Uri Bernstein

git-svn-id: svn://10.0.0.236/trunk@178581 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
roc+%cs.cmu.edu
2005-08-22 01:32:03 +00:00
parent 3609c21f0f
commit 4a089a3fff
2 changed files with 18 additions and 9 deletions

View File

@@ -2736,14 +2736,8 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, HINT aHin
if (aNode->IsContentOfType(nsIContent::eELEMENT))
{
PRInt32 childIndex = 0;
PRInt32 numChildren = theNode->GetChildCount();
PRInt32 numChildren = 0;
if (numChildren == 0)
{
*aReturnOffset = 0;
return mShell->GetPrimaryFrameFor(theNode, aReturnFrame);
}
if (aHint == HINTLEFT)
{
if (aOffset > 0)
@@ -2753,8 +2747,15 @@ nsSelection::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, HINT aHin
}
else // HINTRIGHT
{
numChildren = theNode->GetChildCount();
if (aOffset >= numChildren)
childIndex = numChildren - 1;
{
if (numChildren > 0)
childIndex = numChildren - 1;
else
childIndex = 0;
}
else
childIndex = aOffset;
}