| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 if (r->isTextField()) | 159 if (r->isTextField()) |
| 160 toLayoutTextControlSingleLine(r)->capsLockStateMayHaveChanged(); | 160 toLayoutTextControlSingleLine(r)->capsLockStateMayHaveChanged(); |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 void KeyboardEventManager::defaultKeyboardEventHandler( | 165 void KeyboardEventManager::defaultKeyboardEventHandler( |
| 166 KeyboardEvent* event, Node* possibleFocusedNode) | 166 KeyboardEvent* event, Node* possibleFocusedNode) |
| 167 { | 167 { |
| 168 if (event->type() == EventTypeNames::keydown) { | 168 if (event->type() == EventTypeNames::keydown) { |
| 169 // Clear caret blinking suspended state to make sure that caret blinks | |
| 170 // when we type again after long pressing on an empty input field. | |
| 171 if (m_frame && m_frame->selection().isCaretBlinkingSuspended()) | |
| 172 m_frame->selection().setCaretBlinkingSuspended(false); | |
| 173 | |
| 174 m_frame->editor().handleKeyboardEvent(event); | 169 m_frame->editor().handleKeyboardEvent(event); |
| 175 if (event->defaultHandled()) | 170 if (event->defaultHandled()) |
| 176 return; | 171 return; |
| 177 if (event->keyIdentifier() == "U+0009") { | 172 if (event->keyIdentifier() == "U+0009") { |
| 178 defaultTabEventHandler(event); | 173 defaultTabEventHandler(event); |
| 179 } else if (event->keyIdentifier() == "U+0008") { | 174 } else if (event->keyIdentifier() == "U+0008") { |
| 180 defaultBackspaceEventHandler(event); | 175 defaultBackspaceEventHandler(event); |
| 181 } else if (event->keyIdentifier() == "U+001B") { | 176 } else if (event->keyIdentifier() == "U+001B") { |
| 182 defaultEscapeEventHandler(event); | 177 defaultEscapeEventHandler(event); |
| 183 } else { | 178 } else { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 if (HTMLDialogElement* dialog = m_frame->document()->activeModalDialog()) | 286 if (HTMLDialogElement* dialog = m_frame->document()->activeModalDialog()) |
| 292 dialog->dispatchEvent(Event::createCancelable(EventTypeNames::cancel)); | 287 dialog->dispatchEvent(Event::createCancelable(EventTypeNames::cancel)); |
| 293 } | 288 } |
| 294 | 289 |
| 295 DEFINE_TRACE(KeyboardEventManager) | 290 DEFINE_TRACE(KeyboardEventManager) |
| 296 { | 291 { |
| 297 visitor->trace(m_frame); | 292 visitor->trace(m_frame); |
| 298 } | 293 } |
| 299 | 294 |
| 300 } // namespace blink | 295 } // namespace blink |
| OLD | NEW |