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

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

Issue 2952763002: SearchBoxView now enables/disables cursor based on user interaction. (Closed)
Patch Set: Addressed Comments, refactored. Created 3 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
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/command_line.h" 10 #include "base/command_line.h"
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 } 689 }
690 690
691 void Textfield::OnGestureEvent(ui::GestureEvent* event) { 691 void Textfield::OnGestureEvent(ui::GestureEvent* event) {
692 switch (event->type()) { 692 switch (event->type()) {
693 case ui::ET_GESTURE_TAP_DOWN: 693 case ui::ET_GESTURE_TAP_DOWN:
694 RequestFocus(); 694 RequestFocus();
695 ShowImeIfNeeded(); 695 ShowImeIfNeeded();
696 event->SetHandled(); 696 event->SetHandled();
697 break; 697 break;
698 case ui::ET_GESTURE_TAP: 698 case ui::ET_GESTURE_TAP:
699 DCHECK(controller_);
700 if (controller_->HandleGestureEvent(this, *event)) {
oshima 2017/06/29 16:58:50 controller_ may be null, so just check like other
newcomer 2017/06/30 21:47:23 Done.
701 event->SetHandled();
702 return;
703 }
699 if (event->details().tap_count() == 1) { 704 if (event->details().tap_count() == 1) {
700 // If tap is on the selection and touch handles are not present, handles 705 // If tap is on the selection and touch handles are not present, handles
701 // should be shown without changing selection. Otherwise, cursor should 706 // should be shown without changing selection. Otherwise, cursor should
702 // be moved to the tap location. 707 // be moved to the tap location.
703 if (touch_selection_controller_ || 708 if (touch_selection_controller_ ||
704 !GetRenderText()->IsPointInSelection(event->location())) { 709 !GetRenderText()->IsPointInSelection(event->location())) {
705 OnBeforeUserAction(); 710 OnBeforeUserAction();
706 MoveCursorTo(event->location(), false); 711 MoveCursorTo(event->location(), false);
707 OnAfterUserAction(); 712 OnAfterUserAction();
708 } 713 }
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
2120 cursor_blink_timer_.Stop(); 2125 cursor_blink_timer_.Stop();
2121 } 2126 }
2122 2127
2123 void Textfield::OnCursorBlinkTimerFired() { 2128 void Textfield::OnCursorBlinkTimerFired() {
2124 DCHECK(ShouldBlinkCursor()); 2129 DCHECK(ShouldBlinkCursor());
2125 cursor_view_.SetVisible(!cursor_view_.visible()); 2130 cursor_view_.SetVisible(!cursor_view_.visible());
2126 UpdateCursorViewPosition(); 2131 UpdateCursorViewPosition();
2127 } 2132 }
2128 2133
2129 } // namespace views 2134 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698