Bug 334829: FindFrameWithContent() can't find certain frames

If the hint frame's location in the frame tree doesn't match its element's location in the content tree, the hint is useless, and we don't correctly reboot the search without the hint. Add a flag to make the reboot work.
Patch courtesy of Danger Inc., r=dbaron, sr=bzbarsky
This commit is contained in:
jag%tty.nl 2006-04-21 11:13:41 +00:00
Родитель f1aaf4fbdb
Коммит 42dfc1651e
1 изменённых файлов: 16 добавлений и 8 удалений

Просмотреть файл

@ -11260,11 +11260,16 @@ nsCSSFrameConstructor::FindFrameWithContent(nsFrameManager* aFrameManager,
// Search for the frame in each child list that aParentFrame supports
nsIAtom* listName = nsnull;
PRInt32 listIndex = 0;
PRBool searchAgain;
do {
#ifdef NOISY_FINDFRAME
FFWC_doLoop++;
#endif
nsIFrame* kidFrame=nsnull;
nsIFrame* kidFrame = nsnull;
searchAgain = PR_FALSE;
// if we were given an hint, try to use it here to find a good
// previous frame to start our search (|kidFrame|).
if (aHint) {
@ -11356,17 +11361,20 @@ nsCSSFrameConstructor::FindFrameWithContent(nsFrameManager* aFrameManager,
}
if (aHint) {
// If we get here, and we had a hint, then we didn't find a
// frame. The hint may have been a floated or absolutely
// positioned frame, in which case we'd be off in the weeds
// looking through something other than primary frame
// list. Reboot the search from scratch, without the hint, but
// using the null child list again.
// If we get here, and we had a hint, then we didn't find a frame.
// The hint may have been a frame whose location in the frame tree
// doesn't match the location of its corresponding element in the
// DOM tree, e.g. a floated or absolutely positioned frame, or e.g.
// a <col> frame, in which case we'd be off in the weeds looking
// through something other than the primary frame list.
// Reboot the search from scratch, without the hint, but using the
// null child list again.
aHint = nsnull;
searchAgain = PR_TRUE;
} else {
listName = aParentFrame->GetAdditionalChildListName(listIndex++);
}
} while(listName);
} while(listName || searchAgain);
// We didn't find a matching frame. If aFrame has a next-in-flow,
// then continue looking there