Bug 823990 - Autocomplete results should not disappear for no results when minResults == 0. r=mak

This commit is contained in:
Brian R. Bondy
2013-01-30 13:17:38 -05:00
parent 0a06b71653
commit 3b86d0e220

View File

@@ -587,7 +587,11 @@ nsAutoCompleteController::HandleDelete(bool *_retval)
// Nothing left in the popup, clear any pending search timers and
// close the popup.
ClearSearchTimer();
ClosePopup();
uint32_t minResults;
input->GetMinResultsForPopup(&minResults);
if (minResults) {
ClosePopup();
}
}
return NS_OK;
@@ -1344,10 +1348,13 @@ nsAutoCompleteController::ProcessResult(int32_t aSearchIndex, nsIAutoCompleteRes
NS_ENSURE_TRUE(popup != nullptr, NS_ERROR_FAILURE);
popup->Invalidate();
uint32_t minResults;
input->GetMinResultsForPopup(&minResults);
// Make sure the popup is open, if necessary, since we now have at least one
// search result ready to display. Don't force the popup closed if we might
// get results in the future to avoid unnecessarily canceling searches.
if (mRowCount) {
if (mRowCount || !minResults) {
OpenPopup();
} else if (result != nsIAutoCompleteResult::RESULT_NOMATCH_ONGOING) {
ClosePopup();