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

Side by Side Diff: ui/views/controls/textfield/textfield.cc

Issue 2399603002: views: don't send OnKeypressUnhandled for all keys (Closed)
Patch Set: Created 4 years, 2 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 (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 "ui/views/controls/textfield/textfield.h" 5 #include "ui/views/controls/textfield/textfield.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 } 677 }
678 #endif 678 #endif
679 679
680 if (edit_command == ui::TextEditCommand::INVALID_COMMAND) 680 if (edit_command == ui::TextEditCommand::INVALID_COMMAND)
681 edit_command = GetCommandForKeyEvent(event); 681 edit_command = GetCommandForKeyEvent(event);
682 682
683 if (!handled && IsTextEditCommandEnabled(edit_command)) { 683 if (!handled && IsTextEditCommandEnabled(edit_command)) {
684 ExecuteTextEditCommand(edit_command); 684 ExecuteTextEditCommand(edit_command);
685 handled = true; 685 handled = true;
686 } 686 }
687
688 if (!handled)
sky 2016/10/06 15:58:12 Should this instead check handled || event.handled
Elly Fong-Jones 2016/10/06 16:20:05 I don't think so - for example, when you tab away
689 OnKeypressUnhandled();
690 return handled; 687 return handled;
691 } 688 }
692 689
693 bool Textfield::OnKeyReleased(const ui::KeyEvent& event) { 690 bool Textfield::OnKeyReleased(const ui::KeyEvent& event) {
694 return controller_ && controller_->HandleKeyEvent(this, event); 691 return controller_ && controller_->HandleKeyEvent(this, event);
695 } 692 }
696 693
697 void Textfield::OnGestureEvent(ui::GestureEvent* event) { 694 void Textfield::OnGestureEvent(ui::GestureEvent* event) {
698 switch (event->type()) { 695 switch (event->type()) {
699 case ui::ET_GESTURE_TAP_DOWN: 696 case ui::ET_GESTURE_TAP_DOWN:
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
2059 } 2056 }
2060 2057
2061 void Textfield::OnCursorBlinkTimerFired() { 2058 void Textfield::OnCursorBlinkTimerFired() {
2062 DCHECK(ShouldBlinkCursor()); 2059 DCHECK(ShouldBlinkCursor());
2063 gfx::RenderText* render_text = GetRenderText(); 2060 gfx::RenderText* render_text = GetRenderText();
2064 render_text->set_cursor_visible(!render_text->cursor_visible()); 2061 render_text->set_cursor_visible(!render_text->cursor_visible());
2065 RepaintCursor(); 2062 RepaintCursor();
2066 } 2063 }
2067 2064
2068 } // namespace views 2065 } // namespace views
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