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

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

Issue 22638016: Views Textfield: multiple clicks should alternate between double and triple click behavior (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added comment Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/views/controls/textfield/native_textfield_views_unittest.cc » ('j') | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/native_textfield_views.h" 5 #include "ui/views/controls/textfield/native_textfield_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 controller->OnAfterPaste(); 1402 controller->OnAfterPaste();
1403 } 1403 }
1404 return success; 1404 return success;
1405 } 1405 }
1406 1406
1407 void NativeTextfieldViews::TrackMouseClicks(const ui::MouseEvent& event) { 1407 void NativeTextfieldViews::TrackMouseClicks(const ui::MouseEvent& event) {
1408 if (event.IsOnlyLeftMouseButton()) { 1408 if (event.IsOnlyLeftMouseButton()) {
1409 base::TimeDelta time_delta = event.time_stamp() - last_click_time_; 1409 base::TimeDelta time_delta = event.time_stamp() - last_click_time_;
1410 if (time_delta.InMilliseconds() <= GetDoubleClickInterval() && 1410 if (time_delta.InMilliseconds() <= GetDoubleClickInterval() &&
1411 !ExceededDragThresholdFromLastClickLocation(event)) { 1411 !ExceededDragThresholdFromLastClickLocation(event)) {
1412 aggregated_clicks_ = (aggregated_clicks_ + 1) % 3; 1412 // Upon clicking after a triple click, the count should go back to double
1413 // click and alternate between double and triple. This assignment maps
1414 // 0 to 1, 1 to 2, 2 to 1.
1415 aggregated_clicks_ = (aggregated_clicks_ % 2) + 1;
1413 } else { 1416 } else {
1414 aggregated_clicks_ = 0; 1417 aggregated_clicks_ = 0;
1415 } 1418 }
1416 last_click_time_ = event.time_stamp(); 1419 last_click_time_ = event.time_stamp();
1417 last_click_location_ = event.location(); 1420 last_click_location_ = event.location();
1418 } 1421 }
1419 } 1422 }
1420 1423
1421 void NativeTextfieldViews::HandleMousePressEvent(const ui::MouseEvent& event) { 1424 void NativeTextfieldViews::HandleMousePressEvent(const ui::MouseEvent& event) {
1422 if (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) 1425 if (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton())
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 if (index != -1) { 1497 if (index != -1) {
1495 obscured_reveal_timer_.Start( 1498 obscured_reveal_timer_.Start(
1496 FROM_HERE, 1499 FROM_HERE,
1497 duration, 1500 duration,
1498 base::Bind(&NativeTextfieldViews::RevealObscuredChar, 1501 base::Bind(&NativeTextfieldViews::RevealObscuredChar,
1499 base::Unretained(this), -1, base::TimeDelta())); 1502 base::Unretained(this), -1, base::TimeDelta()));
1500 } 1503 }
1501 } 1504 }
1502 1505
1503 } // namespace views 1506 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/textfield/native_textfield_views_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698