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

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

Issue 2007083002: Validate that ui::Event::time_stamp comes from the same clock as TimeTicks::Now (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@453559-use-timeticks-ui-event
Patch Set: Address feedback Created 4 years, 6 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 | « ui/message_center/message_center.gyp ('k') | 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 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after
1861 controller_->UpdateContextMenu(context_menu_contents_.get()); 1861 controller_->UpdateContextMenu(context_menu_contents_.get());
1862 } 1862 }
1863 context_menu_runner_.reset( 1863 context_menu_runner_.reset(
1864 new MenuRunner(context_menu_contents_.get(), 1864 new MenuRunner(context_menu_contents_.get(),
1865 MenuRunner::HAS_MNEMONICS | MenuRunner::CONTEXT_MENU)); 1865 MenuRunner::HAS_MNEMONICS | MenuRunner::CONTEXT_MENU));
1866 } 1866 }
1867 1867
1868 void Textfield::TrackMouseClicks(const ui::MouseEvent& event) { 1868 void Textfield::TrackMouseClicks(const ui::MouseEvent& event) {
1869 if (event.IsOnlyLeftMouseButton()) { 1869 if (event.IsOnlyLeftMouseButton()) {
1870 base::TimeDelta time_delta = event.time_stamp() - last_click_time_; 1870 base::TimeDelta time_delta = event.time_stamp() - last_click_time_;
1871 if (time_delta.InMilliseconds() <= GetDoubleClickInterval() && 1871 if (!last_click_time_.is_null() &&
1872 time_delta.InMilliseconds() <= GetDoubleClickInterval() &&
1872 !ExceededDragThreshold(event.location() - last_click_location_)) { 1873 !ExceededDragThreshold(event.location() - last_click_location_)) {
1873 // Upon clicking after a triple click, the count should go back to double 1874 // Upon clicking after a triple click, the count should go back to double
1874 // click and alternate between double and triple. This assignment maps 1875 // click and alternate between double and triple. This assignment maps
1875 // 0 to 1, 1 to 2, 2 to 1. 1876 // 0 to 1, 1 to 2, 2 to 1.
1876 aggregated_clicks_ = (aggregated_clicks_ % 2) + 1; 1877 aggregated_clicks_ = (aggregated_clicks_ % 2) + 1;
1877 } else { 1878 } else {
1878 aggregated_clicks_ = 0; 1879 aggregated_clicks_ = 0;
1879 } 1880 }
1880 last_click_time_ = event.time_stamp(); 1881 last_click_time_ = event.time_stamp();
1881 last_click_location_ = event.location(); 1882 last_click_location_ = event.location();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 RequestFocus(); 1934 RequestFocus();
1934 model_->MoveCursorTo(mouse); 1935 model_->MoveCursorTo(mouse);
1935 if (!selection_clipboard_text.empty()) { 1936 if (!selection_clipboard_text.empty()) {
1936 model_->InsertText(selection_clipboard_text); 1937 model_->InsertText(selection_clipboard_text);
1937 UpdateAfterChange(true, true); 1938 UpdateAfterChange(true, true);
1938 } 1939 }
1939 OnAfterUserAction(); 1940 OnAfterUserAction();
1940 } 1941 }
1941 1942
1942 } // namespace views 1943 } // namespace views
OLDNEW
« no previous file with comments | « ui/message_center/message_center.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698