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

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: Fix macOS test 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
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 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1923 controller_->UpdateContextMenu(context_menu_contents_.get()); 1923 controller_->UpdateContextMenu(context_menu_contents_.get());
1924 } 1924 }
1925 context_menu_runner_.reset( 1925 context_menu_runner_.reset(
1926 new MenuRunner(context_menu_contents_.get(), 1926 new MenuRunner(context_menu_contents_.get(),
1927 MenuRunner::HAS_MNEMONICS | MenuRunner::CONTEXT_MENU)); 1927 MenuRunner::HAS_MNEMONICS | MenuRunner::CONTEXT_MENU));
1928 } 1928 }
1929 1929
1930 void Textfield::TrackMouseClicks(const ui::MouseEvent& event) { 1930 void Textfield::TrackMouseClicks(const ui::MouseEvent& event) {
1931 if (event.IsOnlyLeftMouseButton()) { 1931 if (event.IsOnlyLeftMouseButton()) {
1932 base::TimeDelta time_delta = event.time_stamp() - last_click_time_; 1932 base::TimeDelta time_delta = event.time_stamp() - last_click_time_;
1933 if (time_delta.InMilliseconds() <= GetDoubleClickInterval() && 1933 if (!last_click_time_.is_null() &&
1934 time_delta.InMilliseconds() <= GetDoubleClickInterval() &&
1934 !ExceededDragThreshold(event.location() - last_click_location_)) { 1935 !ExceededDragThreshold(event.location() - last_click_location_)) {
1935 // Upon clicking after a triple click, the count should go back to double 1936 // Upon clicking after a triple click, the count should go back to double
1936 // click and alternate between double and triple. This assignment maps 1937 // click and alternate between double and triple. This assignment maps
1937 // 0 to 1, 1 to 2, 2 to 1. 1938 // 0 to 1, 1 to 2, 2 to 1.
1938 aggregated_clicks_ = (aggregated_clicks_ % 2) + 1; 1939 aggregated_clicks_ = (aggregated_clicks_ % 2) + 1;
1939 } else { 1940 } else {
1940 aggregated_clicks_ = 0; 1941 aggregated_clicks_ = 0;
1941 } 1942 }
1942 last_click_time_ = event.time_stamp(); 1943 last_click_time_ = event.time_stamp();
1943 last_click_location_ = event.location(); 1944 last_click_location_ = event.location();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 RequestFocus(); 1996 RequestFocus();
1996 model_->MoveCursorTo(mouse); 1997 model_->MoveCursorTo(mouse);
1997 if (!selection_clipboard_text.empty()) { 1998 if (!selection_clipboard_text.empty()) {
1998 model_->InsertText(selection_clipboard_text); 1999 model_->InsertText(selection_clipboard_text);
1999 UpdateAfterChange(true, true); 2000 UpdateAfterChange(true, true);
2000 } 2001 }
2001 OnAfterUserAction(); 2002 OnAfterUserAction();
2002 } 2003 }
2003 2004
2004 } // namespace views 2005 } // namespace views
OLDNEW
« ui/events/test/event_generator.cc ('K') | « ui/message_center/message_center.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698