mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 02:25:34 +00:00
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.
This commit is contained in:
parent
0e5bf09301
commit
ebc32d984f
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user