summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/editor_client_impl.cc6
-rw-r--r--webkit/glue/webview_delegate.h13
-rw-r--r--webkit/glue/webview_impl.cc11
3 files changed, 21 insertions, 9 deletions
diff --git a/webkit/glue/editor_client_impl.cc b/webkit/glue/editor_client_impl.cc
index 4106ff6..e1187f7 100644
--- a/webkit/glue/editor_client_impl.cc
+++ b/webkit/glue/editor_client_impl.cc
@@ -643,7 +643,11 @@ void EditorClientImpl::handleKeyboardEvent(WebCore::KeyboardEvent* evt) {
ShowFormAutofillForNode(evt->target()->toNode());
}
- if (handleEditingKeyboardEvent(evt))
+ // Calls WebViewDelegate's HandleCurrentKeyboardEvent() first to give it a
+ // chance to handle the keyboard event. Bypass handleEditingKeyboardEvent(),
+ // if WebViewDelegate handles the event.
+ WebViewDelegate* d = web_view_->delegate();
+ if ((d && d->HandleCurrentKeyboardEvent()) || handleEditingKeyboardEvent(evt))
evt->setDefaultHandled();
}
diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h
index c5c6b6a..2e4c333 100644
--- a/webkit/glue/webview_delegate.h
+++ b/webkit/glue/webview_delegate.h
@@ -415,6 +415,19 @@ class WebViewDelegate : virtual public WebKit::WebWidgetClient {
// Called when an item was added to the history
virtual void DidAddHistoryItem() { }
+ // The "CurrentKeyboardEvent" refers to the keyboard event passed to
+ // WebView's handleInputEvent method.
+ //
+ // This method is called in response to WebView's handleInputEvent() when
+ // the default action for the current keyboard event is not suppressed by the
+ // page, to give WebViewDelegate a chance to handle the keyboard event
+ // specially.
+ //
+ // Returns true if the keyboard event was handled by WebViewDelegate.
+ virtual bool HandleCurrentKeyboardEvent() {
+ return false;
+ }
+
protected:
~WebViewDelegate() { }
};
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index f82c6c7..2ff98d2 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -635,15 +635,10 @@ bool WebViewImpl::KeyEvent(const WebKeyboardEvent& event) {
PlatformKeyboardEventBuilder evt(event);
- if (WebInputEvent::RawKeyDown == event.type) {
- if (handler->keyEvent(evt) && !evt.isSystemKey()) {
+ if (handler->keyEvent(evt)) {
+ if (WebInputEvent::RawKeyDown == event.type && !evt.isSystemKey())
suppress_next_keypress_event_ = true;
- return true;
- }
- } else {
- if (handler->keyEvent(evt)) {
- return true;
- }
+ return true;
}
return KeyEventDefault(event);