Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2644843004: Send keyboard-derived commands only if the key events are sent (Closed)
Patch Set: add TODO Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index ea327016baa84a793aad9b7723328e1707c905a8..ef37e66b240997b71f749a4012f43c8ce5b25e68 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -1179,6 +1179,12 @@ void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo(
void RenderWidgetHostImpl::ForwardKeyboardEvent(
const NativeWebKeyboardEvent& key_event) {
+ ForwardKeyboardEventWithCommands(key_event, nullptr);
+}
+
+void RenderWidgetHostImpl::ForwardKeyboardEventWithCommands(
+ const NativeWebKeyboardEvent& key_event,
+ const std::vector<EditCommand>* commands) {
TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardKeyboardEvent");
if (owner_delegate_ &&
!owner_delegate_->MayRenderWidgetForwardKeyboardEvent(key_event)) {
@@ -1245,6 +1251,15 @@ void RenderWidgetHostImpl::ForwardKeyboardEvent(
latency_info);
key_event_with_latency.event.isBrowserShortcut = is_shortcut;
DispatchInputEventWithLatencyInfo(key_event, &key_event_with_latency.latency);
+ // TODO(foolip): |InputRouter::SendKeyboardEvent()| may filter events, in
+ // which the commands will be treated as belonging to the next key event.
+ // InputMsg_SetEditCommandsForNextKeyEvent should only be sent if
+ // InputMsg_HandleInputEvent is, but has to be sent first.
+ // https://crbug.com/684298
+ if (commands && !commands->empty()) {
+ Send(
+ new InputMsg_SetEditCommandsForNextKeyEvent(GetRoutingID(), *commands));
+ }
input_router_->SendKeyboardEvent(key_event_with_latency);
}
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698