Bug 172956. Backspace should go back in page. r=dean, sr=alecf

This commit is contained in:
aaronl%netscape.com 2002-10-08 17:53:18 +00:00
Родитель ea1b415a15
Коммит 1805338f9a
2 изменённых файлов: 11 добавлений и 7 удалений

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

@ -544,8 +544,10 @@ nsTypeAheadFind::KeyPress(nsIDOMEvent* aEvent)
// ----------- Back space ------------------------- // ----------- Back space -------------------------
if (keyCode == nsIDOMKeyEvent::DOM_VK_BACK_SPACE) { if (keyCode == nsIDOMKeyEvent::DOM_VK_BACK_SPACE) {
aEvent->PreventDefault(); // Prevent normal processing of this keystroke if (HandleBackspace()) {
HandleBackspace(); aEvent->PreventDefault(); // Prevent normal processing of this keystroke
}
return NS_OK; return NS_OK;
} }
@ -563,7 +565,7 @@ nsTypeAheadFind::KeyPress(nsIDOMEvent* aEvent)
} }
void PRBool
nsTypeAheadFind::HandleBackspace() nsTypeAheadFind::HandleBackspace()
{ {
// In normal type ahead find, remove a printable char from // In normal type ahead find, remove a printable char from
@ -579,7 +581,7 @@ nsTypeAheadFind::HandleBackspace()
mFocusedDocSelection->GetRangeAt(0, getter_AddRefs(mStartFindRange)); mFocusedDocSelection->GetRangeAt(0, getter_AddRefs(mStartFindRange));
} }
else { else {
return; // No find string to backspace in! return PR_FALSE; // No find string to backspace in!
} }
} }
@ -594,7 +596,7 @@ nsTypeAheadFind::HandleBackspace()
mFocusedDocSelection->CollapseToStart(); mFocusedDocSelection->CollapseToStart();
CancelFind(); CancelFind();
return; return PR_TRUE;
} }
// ---------- Multiple chars in string ---------- // ---------- Multiple chars in string ----------
@ -632,7 +634,7 @@ nsTypeAheadFind::HandleBackspace()
} }
} }
if (!presShell) { if (!presShell) {
return; return PR_FALSE;
} }
// Set the selection to the where the first character was found // Set the selection to the where the first character was found
// so that find starts from there // so that find starts from there
@ -654,6 +656,8 @@ nsTypeAheadFind::HandleBackspace()
mIsFindingText = PR_FALSE; mIsFindingText = PR_FALSE;
SaveFind(); SaveFind();
return PR_TRUE; // Backspace handled
} }

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

@ -128,7 +128,7 @@ protected:
// Helper methods // Helper methods
nsresult HandleChar(PRUnichar aChar); nsresult HandleChar(PRUnichar aChar);
void HandleBackspace(); PRBool HandleBackspace();
void SaveFind(); void SaveFind();
nsresult GetWebBrowserFind(nsIWebBrowserFind **aWebBrowserFind); nsresult GetWebBrowserFind(nsIWebBrowserFind **aWebBrowserFind);
void StartTimeout(); void StartTimeout();