Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 void KeyboardEventManager::defaultKeyboardEventHandler( | 158 void KeyboardEventManager::defaultKeyboardEventHandler( |
| 159 KeyboardEvent* event, Node* possibleFocusedNode) | 159 KeyboardEvent* event, Node* possibleFocusedNode) |
| 160 { | 160 { |
| 161 if (event->type() == EventTypeNames::keydown) { | 161 if (event->type() == EventTypeNames::keydown) { |
| 162 m_frame->editor().handleKeyboardEvent(event); | 162 m_frame->editor().handleKeyboardEvent(event); |
| 163 if (event->defaultHandled()) | 163 if (event->defaultHandled()) |
| 164 return; | 164 return; |
| 165 | |
| 166 // Do not perform the default action when inside a IME composition conte xt. | |
| 167 // TODO(dtapuska): Replace this with isComposing support. crbug.com/6256 86 | |
| 168 if (event->keyCode() == 229) | |
|
bokan
2016/07/04 22:52:06
Does this keyCode have a name of some kind that we
| |
| 169 return; | |
| 165 if (event->key() == "Tab") { | 170 if (event->key() == "Tab") { |
| 166 defaultTabEventHandler(event); | 171 defaultTabEventHandler(event); |
| 167 } else if (event->key() == "Backspace") { | 172 } else if (event->key() == "Backspace") { |
| 168 defaultBackspaceEventHandler(event); | 173 defaultBackspaceEventHandler(event); |
| 169 } else if (event->key() == "Escape") { | 174 } else if (event->key() == "Escape") { |
| 170 defaultEscapeEventHandler(event); | 175 defaultEscapeEventHandler(event); |
| 171 } else { | 176 } else { |
| 172 WebFocusType type = focusDirectionForKey(event->key()); | 177 WebFocusType type = focusDirectionForKey(event->key()); |
| 173 if (type != WebFocusTypeNone) | 178 if (type != WebFocusTypeNone) |
| 174 defaultArrowEventHandler(type, event); | 179 defaultArrowEventHandler(type, event); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 if (HTMLDialogElement* dialog = m_frame->document()->activeModalDialog()) | 284 if (HTMLDialogElement* dialog = m_frame->document()->activeModalDialog()) |
| 280 dialog->dispatchEvent(Event::createCancelable(EventTypeNames::cancel)); | 285 dialog->dispatchEvent(Event::createCancelable(EventTypeNames::cancel)); |
| 281 } | 286 } |
| 282 | 287 |
| 283 DEFINE_TRACE(KeyboardEventManager) | 288 DEFINE_TRACE(KeyboardEventManager) |
| 284 { | 289 { |
| 285 visitor->trace(m_frame); | 290 visitor->trace(m_frame); |
| 286 } | 291 } |
| 287 | 292 |
| 288 } // namespace blink | 293 } // namespace blink |
| OLD | NEW |