fix for nsRangeList get frame for node was not lookin at the node at the "offset" even if the parent node could have children. this would return invalid stuff when get primary frame for content was called.

git-svn-id: svn://10.0.0.236/trunk@48712 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mjudge%netscape.com 1999-09-22 01:20:29 +00:00
parent b3a10c7af2
commit f2a4076904

View File

@ -807,6 +807,7 @@ nsRangeList::HandleKeyEvent(nsGUIEvent *aGuiEvent)
offsetused = mDomSelections[SELECTION_NORMAL]->FetchFocusOffset();
weakNodeUsed = mDomSelections[SELECTION_NORMAL]->FetchFocusNode();
nsIFrame *frame;
result = mDomSelections[SELECTION_NORMAL]->GetPrimaryFrameForFocusNode(&frame);
if (NS_FAILED(result))
@ -1056,6 +1057,20 @@ nsRangeList::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
if (!aNode || !aReturnFrame)
return NS_ERROR_NULL_POINTER;
nsresult result;
PRBool canContainChildren = PR_FALSE;
result = aNode->CanContainChildren(canContainChildren);
if (canContainChildren)
{
if (aOffset >= 0)
{
result = aNode->ChildAt(aOffset, aNode);
if (NS_FAILED(result))
return result;
if (!aNode) //out of bounds?
return NS_ERROR_FAILURE;
}
}
result = mTracker->GetPrimaryFrameFor(aNode, aReturnFrame);
if (NS_FAILED(result))
return result;