Bug 823990 - Autocomplete results should not disappear for no results when minResults == 0. r=mak
authorBrian R. Bondy <netzen@gmail.com>
Wed, 30 Jan 2013 13:17:38 -0500
changeset 120394 ed412c2a599d8b5094a26dfa258286c64b3eb644
parent 120393 2d6e2f861e19223eec179d045c95375615ade49e
child 120395 722643e05bb7b54afd7fc5a3030029755033bc4e
push id24251
push userryanvm@gmail.com
push dateThu, 31 Jan 2013 20:56:22 +0000
treeherdermozilla-central@683b08dc1afd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs823990
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 823990 - Autocomplete results should not disappear for no results when minResults == 0. r=mak
toolkit/components/autocomplete/nsAutoCompleteController.cpp
--- a/toolkit/components/autocomplete/nsAutoCompleteController.cpp
+++ b/toolkit/components/autocomplete/nsAutoCompleteController.cpp
@@ -582,17 +582,21 @@ nsAutoCompleteController::HandleDelete(b
     }
 
     // Invalidate the popup.
     popup->Invalidate();
   } else {
     // 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;
 }
 
 nsresult 
 nsAutoCompleteController::GetResultAt(int32_t aIndex, nsIAutoCompleteResult** aResult,
                                       int32_t* aRowIndex)
@@ -1339,20 +1343,23 @@ nsAutoCompleteController::ProcessResult(
     }
 
     // Refresh the popup view to display the new search results
     nsCOMPtr<nsIAutoCompletePopup> popup;
     input->GetPopup(getter_AddRefs(popup));
     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();
     }
   }
 
   if (result == nsIAutoCompleteResult::RESULT_SUCCESS ||
       result == nsIAutoCompleteResult::RESULT_SUCCESS_ONGOING) {