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

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

Issue 2952763002: SearchBoxView now enables/disables cursor based on user interaction. (Closed)
Patch Set: rebased. 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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 } 682 }
683 683
684 void Textfield::OnGestureEvent(ui::GestureEvent* event) { 684 void Textfield::OnGestureEvent(ui::GestureEvent* event) {
685 switch (event->type()) { 685 switch (event->type()) {
686 case ui::ET_GESTURE_TAP_DOWN: 686 case ui::ET_GESTURE_TAP_DOWN:
687 RequestFocus(); 687 RequestFocus();
688 ShowImeIfNeeded(); 688 ShowImeIfNeeded();
689 event->SetHandled(); 689 event->SetHandled();
690 break; 690 break;
691 case ui::ET_GESTURE_TAP: 691 case ui::ET_GESTURE_TAP:
692 if (controller_ && controller_->HandleGestureEvent(this, *event)) {
693 event->SetHandled();
694 return;
695 }
692 if (event->details().tap_count() == 1) { 696 if (event->details().tap_count() == 1) {
693 // If tap is on the selection and touch handles are not present, handles 697 // If tap is on the selection and touch handles are not present, handles
694 // should be shown without changing selection. Otherwise, cursor should 698 // should be shown without changing selection. Otherwise, cursor should
695 // be moved to the tap location. 699 // be moved to the tap location.
696 if (touch_selection_controller_ || 700 if (touch_selection_controller_ ||
697 !GetRenderText()->IsPointInSelection(event->location())) { 701 !GetRenderText()->IsPointInSelection(event->location())) {
698 OnBeforeUserAction(); 702 OnBeforeUserAction();
699 MoveCursorTo(event->location(), false); 703 MoveCursorTo(event->location(), false);
700 OnAfterUserAction(); 704 OnAfterUserAction();
701 } 705 }
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
2114 cursor_blink_timer_.Stop(); 2118 cursor_blink_timer_.Stop();
2115 } 2119 }
2116 2120
2117 void Textfield::OnCursorBlinkTimerFired() { 2121 void Textfield::OnCursorBlinkTimerFired() {
2118 DCHECK(ShouldBlinkCursor()); 2122 DCHECK(ShouldBlinkCursor());
2119 UpdateCursorViewPosition(); 2123 UpdateCursorViewPosition();
2120 cursor_view_.SetVisible(!cursor_view_.visible()); 2124 cursor_view_.SetVisible(!cursor_view_.visible());
2121 } 2125 }
2122 2126
2123 } // namespace views 2127 } // namespace views
OLDNEW
« no previous file with comments | « ui/app_list/views/search_result_page_view.h ('k') | ui/views/controls/textfield/textfield_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698