OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |