summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/global_keyboard_shortcuts_mac.mm2
-rw-r--r--chrome/browser/ime_input.cc2
-rw-r--r--chrome/browser/ime_input.h2
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.mm7
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_mac.mm3
-rw-r--r--chrome/common/native_web_keyboard_event.h6
-rw-r--r--chrome/common/native_web_keyboard_event_mac.mm14
7 files changed, 28 insertions, 8 deletions
diff --git a/chrome/browser/global_keyboard_shortcuts_mac.mm b/chrome/browser/global_keyboard_shortcuts_mac.mm
index 2ea5d66..3379b5a 100644
--- a/chrome/browser/global_keyboard_shortcuts_mac.mm
+++ b/chrome/browser/global_keyboard_shortcuts_mac.mm
@@ -40,6 +40,8 @@ const KeyboardShortcutData* GetBrowserKeyboardShortcutTable
static const KeyboardShortcutData keyboard_shortcuts[] = {
{true, false, false, kVK_LeftArrow, IDC_BACK},
{true, false, false, kVK_RightArrow, IDC_FORWARD},
+ {false, false, false, kVK_Delete, IDC_BACK},
+ {false, true, false, kVK_Delete, IDC_FORWARD},
};
*num_entries = arraysize(keyboard_shortcuts);
diff --git a/chrome/browser/ime_input.cc b/chrome/browser/ime_input.cc
index d592d84..21b5229 100644
--- a/chrome/browser/ime_input.cc
+++ b/chrome/browser/ime_input.cc
@@ -176,7 +176,7 @@ void ImeInput::GetCaret(HIMC imm_context, LPARAM lparam,
// (It contains only one hangul character);
// * Chinese IMEs: the caret is a blinking line,
// (i.e. they do not need to retrieve the target selection);
- // * Japanese IMEs: the caret is a selection (or undelined) block,
+ // * Japanese IMEs: the caret is a selection (or underlined) block,
// (which can contain one or more Japanese characters).
int target_start = -1;
int target_end = -1;
diff --git a/chrome/browser/ime_input.h b/chrome/browser/ime_input.h
index 2f1d1b9..b26c277 100644
--- a/chrome/browser/ime_input.h
+++ b/chrome/browser/ime_input.h
@@ -93,7 +93,7 @@ class ImeInput {
ImeInput();
~ImeInput();
- // Retrieves whether or not there is an ongiong composition.
+ // Retrieves whether or not there is an ongoing composition.
bool is_composing() const { return is_composing_; }
// Retrieves the input language from Windows and update it.
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
index 4a05273..f19243b 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
@@ -588,8 +588,11 @@ void RenderWidgetHostViewMac::SetBackground(const SkBitmap& background) {
// while an input method is composing a text.
// Gmail checks this code in its onkeydown handler to stop auto-completing
// e-mail addresses while composing a CJK text.
- if ([theEvent type] == NSKeyDown && renderWidgetHostView_->im_composing_)
- event.windowsKeyCode = 0xE5;
+ if ([theEvent type] == NSKeyDown && renderWidgetHostView_->im_composing_) {
+ event.windowsKeyCode = 0xE5; // VKEY_PROCESSKEY
+ event.setKeyIdentifierFromWindowsKeyCode();
+ event.skip_in_browser = true;
+ }
// Dispatch this keyboard event to the renderer.
if (renderWidgetHostView_->render_widget_host_) {
diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.mm b/chrome/browser/tab_contents/tab_contents_view_mac.mm
index 3740a49..0dd47738 100644
--- a/chrome/browser/tab_contents/tab_contents_view_mac.mm
+++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm
@@ -311,6 +311,9 @@ void TabContentsViewMac::Observe(NotificationType type,
}
- (void)processKeyboardEvent:(NativeWebKeyboardEvent*)wkEvent {
+ if (wkEvent->skip_in_browser)
+ return;
+
NSEvent* event = wkEvent->os_event;
if ([event type] == NSKeyDown && ([event modifierFlags] & NSCommandKeyMask)) {
diff --git a/chrome/common/native_web_keyboard_event.h b/chrome/common/native_web_keyboard_event.h
index 87f5a90..654c38b 100644
--- a/chrome/common/native_web_keyboard_event.h
+++ b/chrome/common/native_web_keyboard_event.h
@@ -48,6 +48,12 @@ struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent {
MSG os_event;
#elif defined(OS_MACOSX)
NSEvent* os_event;
+
+ // True if the browser should ignore this event if it's not handled by the
+ // renderer. This happens for RawKeyDown events that are created while IME is
+ // active and is necessary to prevent backspace from doing "history back" if
+ // it is hit in ime mode.
+ bool skip_in_browser;
#elif defined(OS_LINUX)
GdkEventKey* os_event;
#endif
diff --git a/chrome/common/native_web_keyboard_event_mac.mm b/chrome/common/native_web_keyboard_event_mac.mm
index b9922bb..59e0ace 100644
--- a/chrome/common/native_web_keyboard_event_mac.mm
+++ b/chrome/common/native_web_keyboard_event_mac.mm
@@ -11,12 +11,14 @@
using WebKit::WebInputEventFactory;
NativeWebKeyboardEvent::NativeWebKeyboardEvent()
- : os_event(NULL) {
+ : os_event(NULL),
+ skip_in_browser(false) {
}
NativeWebKeyboardEvent::NativeWebKeyboardEvent(NSEvent* event)
: WebKeyboardEvent(WebInputEventFactory::keyboardEvent(event)),
- os_event([event retain]) {
+ os_event([event retain]),
+ skip_in_browser(false) {
}
NativeWebKeyboardEvent::NativeWebKeyboardEvent(wchar_t character,
@@ -25,13 +27,15 @@ NativeWebKeyboardEvent::NativeWebKeyboardEvent(wchar_t character,
: WebKeyboardEvent(WebInputEventFactory::keyboardEvent(character,
modifiers,
time_stamp_seconds)),
- os_event(NULL) {
+ os_event(NULL),
+ skip_in_browser(false) {
}
NativeWebKeyboardEvent::NativeWebKeyboardEvent(
const NativeWebKeyboardEvent& other)
: WebKeyboardEvent(other),
- os_event([other.os_event retain]) {
+ os_event([other.os_event retain]),
+ skip_in_browser(other.skip_in_browser) {
}
NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=(
@@ -42,6 +46,8 @@ NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=(
os_event = [other.os_event retain];
[previous release];
+ skip_in_browser = other.skip_in_browser;
+
return *this;
}