fix for bug #406487: After selecting auto-complete entry and then correcting it, pressing enter still loads auto-complete r=gavin, a=blocking-firefox-3+

This commit is contained in:
sspitzer@mozilla.org 2007-12-12 14:55:29 -08:00
Родитель b83053919d
Коммит 4cb27903c1
1 изменённых файлов: 13 добавлений и 2 удалений

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

@ -1290,8 +1290,19 @@ nsAutoCompleteController::ClearResults()
mRowCount = 0;
mResults->Clear();
mMatchCounts.Clear();
if (oldRowCount != 0 && mTree)
if (oldRowCount != 0) {
if (mTree)
mTree->RowCountChanged(0, -oldRowCount);
else if (mInput) {
nsCOMPtr<nsIAutoCompletePopup> popup;
mInput->GetPopup(getter_AddRefs(popup));
NS_ENSURE_TRUE(popup != nsnull, NS_ERROR_FAILURE);
// if we had a tree, RowCountChanged() would have cleared the selection
// when the selected row was removed. But since we don't have a tree,
// we need to clear the selection manually.
popup->SetSelectedIndex(-1);
}
}
return NS_OK;
}