From c474a4fae772ecba8d895742f8373bfa4304f393 Mon Sep 17 00:00:00 2001 From: "bryner%netscape.com" Date: Sat, 31 May 2003 18:43:50 +0000 Subject: [PATCH] Fix backspace to go back and forward on win32 (bug 207175). Patch (mostly) by noririty@jcom.home.ne.jp. --- browser/base/content/browser.js | 23 +++++++++++++++++++++++ browser/base/content/browser.xul | 9 ++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index ec34ff38de31..b68f7672529c 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -591,6 +591,29 @@ function BrowserBack() } } +#ifdef XP_WIN +function BrowserHandleBackspace() +{ + // The order of seeing keystrokes is this: + // 1) Chrome, 2) Typeahead, 3) [platform]HTMLBindings.xml + // Rather than have typeaheadfind responsible for making VK_BACK + // go back in history, we handle backspace it here as follows: + // When backspace is pressed, it might mean back + // in typeaheadfind if that's active, or it might mean back in history + + var typeAhead = null; + const TYPE_AHEAD_FIND_CONTRACTID = "@mozilla.org/typeaheadfind;1"; + if (TYPE_AHEAD_FIND_CONTRACTID in Components.classes) { + typeAhead = Components.classes[TYPE_AHEAD_FIND_CONTRACTID] + .getService(Components.interfaces.nsITypeAheadFind); + } + + if (!typeAhead || !typeAhead.backOneChar()) { + BrowserBack(); + } +} +#endif + function BrowserForward() { try { diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 6d79c76301cd..3cd6dab94f36 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -103,6 +103,10 @@ +#ifdef XP_WIN + +#endif + @@ -216,7 +220,10 @@ - +#ifdef XP_WIN + + +#endif