From f2a4076904ffc0b542cf339fe9783a00db8eb8fc Mon Sep 17 00:00:00 2001 From: "mjudge%netscape.com" Date: Wed, 22 Sep 1999 01:20:29 +0000 Subject: [PATCH] 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 --- mozilla/layout/base/src/nsRangeList.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mozilla/layout/base/src/nsRangeList.cpp b/mozilla/layout/base/src/nsRangeList.cpp index 92155874a66..b0c9e338360 100644 --- a/mozilla/layout/base/src/nsRangeList.cpp +++ b/mozilla/layout/base/src/nsRangeList.cpp @@ -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;