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

Side by Side Diff: third_party/WebKit/Source/core/input/KeyboardEventManager.cpp

Issue 2121843002: Don't perform the default action when keyCode is 229. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add const definition Created 4 years, 5 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 | « no previous file | 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "KeyboardEventManager.h" 5 #include "KeyboardEventManager.h"
6 6
7 #include "core/dom/Element.h" 7 #include "core/dom/Element.h"
8 #include "core/editing/Editor.h" 8 #include "core/editing/Editor.h"
9 #include "core/events/KeyboardEvent.h" 9 #include "core/events/KeyboardEvent.h"
10 #include "core/html/HTMLDialogElement.h" 10 #include "core/html/HTMLDialogElement.h"
11 #include "core/input/EventHandler.h" 11 #include "core/input/EventHandler.h"
12 #include "core/layout/LayoutObject.h" 12 #include "core/layout/LayoutObject.h"
13 #include "core/layout/LayoutTextControlSingleLine.h" 13 #include "core/layout/LayoutTextControlSingleLine.h"
14 #include "core/loader/FrameLoaderClient.h" 14 #include "core/loader/FrameLoaderClient.h"
15 #include "core/page/ChromeClient.h" 15 #include "core/page/ChromeClient.h"
16 #include "core/page/FocusController.h" 16 #include "core/page/FocusController.h"
17 #include "core/page/Page.h" 17 #include "core/page/Page.h"
18 #include "core/page/SpatialNavigation.h" 18 #include "core/page/SpatialNavigation.h"
19 #include "platform/PlatformKeyboardEvent.h" 19 #include "platform/PlatformKeyboardEvent.h"
20 #include "platform/UserGestureIndicator.h" 20 #include "platform/UserGestureIndicator.h"
21 #include "platform/WindowsKeyboardCodes.h" 21 #include "platform/WindowsKeyboardCodes.h"
22 22
23 namespace blink { 23 namespace blink {
24 24
25 namespace { 25 namespace {
26 26
27 const int kVKeyProcessKey = 229;
28
27 WebFocusType focusDirectionForKey(const String& key) 29 WebFocusType focusDirectionForKey(const String& key)
28 { 30 {
29 WebFocusType retVal = WebFocusTypeNone; 31 WebFocusType retVal = WebFocusTypeNone;
30 if (key == "ArrowDown") 32 if (key == "ArrowDown")
31 retVal = WebFocusTypeDown; 33 retVal = WebFocusTypeDown;
32 else if (key == "ArrowUp") 34 else if (key == "ArrowUp")
33 retVal = WebFocusTypeUp; 35 retVal = WebFocusTypeUp;
34 else if (key == "ArrowLeft") 36 else if (key == "ArrowLeft")
35 retVal = WebFocusTypeLeft; 37 retVal = WebFocusTypeLeft;
36 else if (key == "ArrowRight") 38 else if (key == "ArrowRight")
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 157 }
156 } 158 }
157 159
158 void KeyboardEventManager::defaultKeyboardEventHandler( 160 void KeyboardEventManager::defaultKeyboardEventHandler(
159 KeyboardEvent* event, Node* possibleFocusedNode) 161 KeyboardEvent* event, Node* possibleFocusedNode)
160 { 162 {
161 if (event->type() == EventTypeNames::keydown) { 163 if (event->type() == EventTypeNames::keydown) {
162 m_frame->editor().handleKeyboardEvent(event); 164 m_frame->editor().handleKeyboardEvent(event);
163 if (event->defaultHandled()) 165 if (event->defaultHandled())
164 return; 166 return;
167
168 // Do not perform the default action when inside a IME composition conte xt.
169 // TODO(dtapuska): Replace this with isComposing support. crbug.com/6256 86
170 if (event->keyCode() == kVKeyProcessKey)
171 return;
165 if (event->key() == "Tab") { 172 if (event->key() == "Tab") {
166 defaultTabEventHandler(event); 173 defaultTabEventHandler(event);
167 } else if (event->key() == "Backspace") { 174 } else if (event->key() == "Backspace") {
168 defaultBackspaceEventHandler(event); 175 defaultBackspaceEventHandler(event);
169 } else if (event->key() == "Escape") { 176 } else if (event->key() == "Escape") {
170 defaultEscapeEventHandler(event); 177 defaultEscapeEventHandler(event);
171 } else { 178 } else {
172 WebFocusType type = focusDirectionForKey(event->key()); 179 WebFocusType type = focusDirectionForKey(event->key());
173 if (type != WebFocusTypeNone) 180 if (type != WebFocusTypeNone)
174 defaultArrowEventHandler(type, event); 181 defaultArrowEventHandler(type, event);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 if (HTMLDialogElement* dialog = m_frame->document()->activeModalDialog()) 286 if (HTMLDialogElement* dialog = m_frame->document()->activeModalDialog())
280 dialog->dispatchEvent(Event::createCancelable(EventTypeNames::cancel)); 287 dialog->dispatchEvent(Event::createCancelable(EventTypeNames::cancel));
281 } 288 }
282 289
283 DEFINE_TRACE(KeyboardEventManager) 290 DEFINE_TRACE(KeyboardEventManager)
284 { 291 {
285 visitor->trace(m_frame); 292 visitor->trace(m_frame);
286 } 293 }
287 294
288 } // namespace blink 295 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698