зеркало из https://github.com/mozilla/pjs.git
Bug 509048 - hitting enter after a paste into the location bar does nothing (r=gavin)
This commit is contained in:
Родитель
b41814d3c7
Коммит
e5b07bbc9a
|
@ -75,7 +75,6 @@ NS_INTERFACE_TABLE_HEAD(nsAutoCompleteController)
|
|||
NS_INTERFACE_MAP_END
|
||||
|
||||
nsAutoCompleteController::nsAutoCompleteController() :
|
||||
mEnterAfterSearch(0),
|
||||
mDefaultIndexCompleted(PR_FALSE),
|
||||
mBackspaced(PR_FALSE),
|
||||
mPopupClosedByCompositionStart(PR_FALSE),
|
||||
|
@ -150,7 +149,6 @@ nsAutoCompleteController::SetInput(nsIAutoCompleteInput *aInput)
|
|||
|
||||
// Reset all search state members to default values
|
||||
mSearchString = newValue;
|
||||
mEnterAfterSearch = 0;
|
||||
mDefaultIndexCompleted = PR_FALSE;
|
||||
mBackspaced = PR_FALSE;
|
||||
mSearchStatus = nsIAutoCompleteController::STATUS_NONE;
|
||||
|
@ -284,12 +282,8 @@ nsAutoCompleteController::HandleEnter(PRBool aIsPopupSelection, PRBool *_retval)
|
|||
}
|
||||
}
|
||||
|
||||
// clear the search timer only if we are not searching.
|
||||
// if we are searching, EnterMatch() will not handle the enter
|
||||
// immediately. instead, we will handle it on the next result we process
|
||||
// but we need the search timer to fire to kick of that search
|
||||
if (mSearchStatus != nsIAutoCompleteController::STATUS_SEARCHING)
|
||||
ClearSearchTimer();
|
||||
// Stop the search, and handle the enter.
|
||||
StopSearch();
|
||||
EnterMatch(aIsPopupSelection);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1080,14 +1074,6 @@ nsAutoCompleteController::ClearSearchTimer()
|
|||
nsresult
|
||||
nsAutoCompleteController::EnterMatch(PRBool aIsPopupSelection)
|
||||
{
|
||||
// If a search is still ongoing, bail out of this function
|
||||
// and let the search finish, and tell it to come back here when it's done
|
||||
if (mSearchStatus == nsIAutoCompleteController::STATUS_SEARCHING) {
|
||||
mEnterAfterSearch = aIsPopupSelection ? 2 : 1;
|
||||
return NS_OK;
|
||||
}
|
||||
mEnterAfterSearch = 0;
|
||||
|
||||
nsCOMPtr<nsIAutoCompleteInput> input(mInput);
|
||||
nsCOMPtr<nsIAutoCompletePopup> popup;
|
||||
input->GetPopup(getter_AddRefs(popup));
|
||||
|
@ -1277,11 +1263,6 @@ nsAutoCompleteController::ProcessResult(PRInt32 aSearchIndex, nsIAutoCompleteRes
|
|||
// If this is the last search to return, cleanup
|
||||
PostSearchCleanup();
|
||||
}
|
||||
else if (mEnterAfterSearch) {
|
||||
// since we still have searches ongoing (mSearchesOngoing != 0)
|
||||
// and the user has hit enter, stop the searches
|
||||
StopSearch();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1309,11 +1290,6 @@ nsAutoCompleteController::PostSearchCleanup()
|
|||
// notify the input that the search is complete
|
||||
input->OnSearchComplete();
|
||||
|
||||
// if mEnterAfterSearch was set, then the user hit enter while the
|
||||
// search was ongoing, so we need to enter a match now that the search is done
|
||||
if (mEnterAfterSearch)
|
||||
EnterMatch(mEnterAfterSearch == 2);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1343,7 +1319,7 @@ nsAutoCompleteController::ClearResults()
|
|||
nsresult
|
||||
nsAutoCompleteController::CompleteDefaultIndex(PRInt32 aSearchIndex)
|
||||
{
|
||||
if (mDefaultIndexCompleted || mEnterAfterSearch || mBackspaced || mRowCount == 0 || mSearchString.Length() == 0)
|
||||
if (mDefaultIndexCompleted || mBackspaced || mRowCount == 0 || mSearchString.Length() == 0)
|
||||
return NS_OK;
|
||||
|
||||
PRInt32 selectionStart;
|
||||
|
|
|
@ -109,10 +109,6 @@ protected:
|
|||
nsCOMPtr<nsITreeBoxObject> mTree;
|
||||
|
||||
nsString mSearchString;
|
||||
// whether EnterMatch was called while a search was ongoing. Values:
|
||||
// 0 - EnterMatch not called, 1 - called with false aIsPopupSelection
|
||||
// 2 - called with true aIsPopupSelection
|
||||
PRInt8 mEnterAfterSearch;
|
||||
PRPackedBool mDefaultIndexCompleted;
|
||||
PRPackedBool mBackspaced;
|
||||
PRPackedBool mPopupClosedByCompositionStart;
|
||||
|
|
Загрузка…
Ссылка в новой задаче