Attempt to fix crashes using arrow-key scrolling in autocomplete. Bug 306067, r+sr=dbaron.

This commit is contained in:
bryner%brianryner.com 2005-10-12 23:03:58 +00:00
parent 20f0378e89
commit dd8f7f450f

View File

@ -391,13 +391,15 @@ nsAutoCompleteController::HandleKeyNavigation(PRUint16 aKey, PRBool *_retval)
PRBool page = aKey == nsIAutoCompleteController::KEY_PAGE_UP ||
aKey == nsIAutoCompleteController::KEY_PAGE_DOWN ? PR_TRUE : PR_FALSE;
// Fill in the value of the textbox with whatever is selected in the popup
// if the completeSelectedIndex attribute is set. We check this before
// calling SelectBy since that can null out mInput in some cases.
PRBool completeSelection;
mInput->GetCompleteSelectedIndex(&completeSelection);
// Instruct the result view to scroll by the given amount and direction
popup->SelectBy(reverse, page);
// Fill in the value of the textbox with whatever is selected in the popup
// if the completeSelectedIndex attribute is set
PRBool completeSelection;
mInput->GetCompleteSelectedIndex(&completeSelection);
if (completeSelection)
{
PRInt32 selectedIndex;