summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-14 18:34:20 +0000
committermsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-14 18:34:20 +0000
commita67fc5c4c8b24182315e1e16e87c8b47e2eafcb5 (patch)
treec3f534db175974c9175837d97f3edb262edb33f5
parent106e9838456b44c86401d99cd4484cf648378751 (diff)
downloadchromium_src-a67fc5c4c8b24182315e1e16e87c8b47e2eafcb5.zip
chromium_src-a67fc5c4c8b24182315e1e16e87c8b47e2eafcb5.tar.gz
chromium_src-a67fc5c4c8b24182315e1e16e87c8b47e2eafcb5.tar.bz2
Ignore character messages for VKEY_RETURN sent on CTRL+M.
Add a RenderWidgetHostViewAura flag for allowing VKEY_RETURN. Only forward the event when its ET_KEY_PRESSED was observed. Matches RenderWidgetHostViewWin::OnKeyEvent from r31869. BUG=315547 TEST=CTRL+M doesn't invoke web content form submission, etc. R=nona@chromium.org,jochen@chromium.org,ben@chromium.org Review URL: https://codereview.chromium.org/68453007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235194 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc6
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.h3
2 files changed, 8 insertions, 1 deletions
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 49af65b..bb10b06 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -458,6 +458,7 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host)
text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT),
can_compose_inline_(true),
has_composition_text_(false),
+ accept_return_character_(false),
last_output_surface_id_(0),
pending_delegated_ack_count_(0),
skipped_frames_(false),
@@ -2166,7 +2167,8 @@ void RenderWidgetHostViewAura::InsertChar(char16 ch, int flags) {
return;
}
- if (host_) {
+ // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547
+ if (host_ && (accept_return_character_ || ch != ui::VKEY_RETURN)) {
double now = ui::EventTimeForNow().InSecondsF();
// Send a blink::WebInputEvent::Char event to |host_|.
NativeWebKeyboardEvent webkit_event(ui::ET_KEY_PRESSED,
@@ -2596,6 +2598,8 @@ void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) {
ui::EventTimeForNow().InSecondsF());
host_->ForwardKeyboardEvent(webkit_event);
} else {
+ if (event->key_code() == ui::VKEY_RETURN)
+ accept_return_character_ = event->type() == ui::ET_KEY_PRESSED;
NativeWebKeyboardEvent webkit_event(event);
host_->ForwardKeyboardEvent(webkit_event);
}
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h
index ec94e3f..af1d972 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.h
+++ b/content/browser/renderer_host/render_widget_host_view_aura.h
@@ -613,6 +613,9 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
// Indicates if there is onging composition text.
bool has_composition_text_;
+ // Whether return characters should be passed on to the RenderWidgetHostImpl.
+ bool accept_return_character_;
+
// Current tooltip text.
string16 tooltip_;