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

Side by Side Diff: content/renderer/render_widget.cc

Issue 518123002: Always guard against IME events for all KeyPress. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: don't block events for <tab> Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event, 927 void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event,
928 const ui::LatencyInfo& latency_info, 928 const ui::LatencyInfo& latency_info,
929 bool is_keyboard_shortcut) { 929 bool is_keyboard_shortcut) {
930 base::AutoReset<bool> handling_input_event_resetter( 930 base::AutoReset<bool> handling_input_event_resetter(
931 &handling_input_event_, true); 931 &handling_input_event_, true);
932 if (!input_event) 932 if (!input_event)
933 return; 933 return;
934 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter( 934 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter(
935 &handling_event_type_, input_event->type); 935 &handling_event_type_, input_event->type);
936 #if defined(OS_ANDROID) 936 #if defined(OS_ANDROID)
937 // On Android, when the delete key or forward delete key is pressed using IME, 937 // On Android, when a key is pressed or sent from the Keyboard using IME,
938 // |AdapterInputConnection| generates input key events to make sure all JS 938 // |AdapterInputConnection| generates input key events to make sure all JS
939 // listeners that monitor KeyUp and KeyDown events receive the proper key 939 // listeners that monitor KeyUp and KeyDown events receive the proper key
940 // code. Since this input key event comes from IME, we need to set the 940 // code. Since this input key event comes from IME, we need to set the
941 // IME event guard here to make sure it does not interfere with other IME 941 // IME event guard here to make sure it does not interfere with other IME
942 // events. 942 // events.
943 scoped_ptr<ImeEventGuard> ime_event_guard_maybe; 943 scoped_ptr<ImeEventGuard> ime_event_guard_maybe;
944 if (WebInputEvent::isKeyboardEventType(input_event->type)) { 944 if (WebInputEvent::isKeyboardEventType(input_event->type)) {
945 const WebKeyboardEvent& key_event = 945 const WebKeyboardEvent& key_event =
946 *static_cast<const WebKeyboardEvent*>(input_event); 946 *static_cast<const WebKeyboardEvent*>(input_event);
947 if (key_event.nativeKeyCode == AKEYCODE_FORWARD_DEL || 947 // Some keys are special and it's essential that no events get blocked.
948 key_event.nativeKeyCode == AKEYCODE_DEL) { 948 if (key_event.nativeKeyCode != AKEYCODE_TAB)
949 ime_event_guard_maybe.reset(new ImeEventGuard(this)); 949 ime_event_guard_maybe.reset(new ImeEventGuard(this));
950 }
951 } 950 }
952 #endif 951 #endif
953 952
954 base::AutoReset<const ui::LatencyInfo*> resetter(&current_event_latency_info_, 953 base::AutoReset<const ui::LatencyInfo*> resetter(&current_event_latency_info_,
955 &latency_info); 954 &latency_info);
956 955
957 base::TimeTicks start_time; 956 base::TimeTicks start_time;
958 if (base::TimeTicks::IsHighResNowFastAndReliable()) 957 if (base::TimeTicks::IsHighResNowFastAndReliable())
959 start_time = base::TimeTicks::HighResNow(); 958 start_time = base::TimeTicks::HighResNow();
960 959
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2175 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2177 video_hole_frames_.AddObserver(frame); 2176 video_hole_frames_.AddObserver(frame);
2178 } 2177 }
2179 2178
2180 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2179 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2181 video_hole_frames_.RemoveObserver(frame); 2180 video_hole_frames_.RemoveObserver(frame);
2182 } 2181 }
2183 #endif // defined(VIDEO_HOLE) 2182 #endif // defined(VIDEO_HOLE)
2184 2183
2185 } // namespace content 2184 } // namespace content
OLDNEW
« no previous file with comments | « content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698