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

Unified Diff: third_party/WebKit/Source/core/html/forms/TypeAhead.cpp

Issue 2542693002: Use WTF::TimeTicks to represent timestamp in Platform/Core event types (Closed)
Patch Set: rebase Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/forms/TypeAhead.cpp
diff --git a/third_party/WebKit/Source/core/html/forms/TypeAhead.cpp b/third_party/WebKit/Source/core/html/forms/TypeAhead.cpp
index 8de4b83bba4e6697efd0048f4f6317b434d13245..4d19fc3402aed2dc682f4d67af665677f2d37092 100644
--- a/third_party/WebKit/Source/core/html/forms/TypeAhead.cpp
+++ b/third_party/WebKit/Source/core/html/forms/TypeAhead.cpp
@@ -37,9 +37,9 @@ using namespace WTF::Unicode;
namespace blink {
TypeAhead::TypeAhead(TypeAheadDataSource* dataSource)
- : m_dataSource(dataSource), m_lastTypeTime(0), m_repeatingChar(0) {}
+ : m_dataSource(dataSource), m_repeatingChar(0) {}
-static const double typeAheadTimeout = 1; // in seconds
+static const TimeDelta typeAheadTimeout = TimeDelta::FromSecondsD(1);
static String stripLeadingWhiteSpace(const String& string) {
unsigned length = string.length();
@@ -58,7 +58,7 @@ int TypeAhead::handleEvent(KeyboardEvent* event, MatchModeFlags matchMode) {
return -1;
int optionCount = m_dataSource->optionCount();
- double delta = event->platformTimeStamp() - m_lastTypeTime;
+ TimeDelta delta = event->platformTimeStamp() - m_lastTypeTime;
m_lastTypeTime = event->platformTimeStamp();
UChar c = event->charCode();
@@ -118,12 +118,12 @@ int TypeAhead::handleEvent(KeyboardEvent* event, MatchModeFlags matchMode) {
}
bool TypeAhead::hasActiveSession(KeyboardEvent* event) {
- double delta = event->platformTimeStamp() - m_lastTypeTime;
+ TimeDelta delta = event->platformTimeStamp() - m_lastTypeTime;
return delta <= typeAheadTimeout;
}
void TypeAhead::resetSession() {
- m_lastTypeTime = 0;
+ m_lastTypeTime = TimeTicks();
m_buffer.clear();
}
« no previous file with comments | « third_party/WebKit/Source/core/html/forms/TypeAhead.h ('k') | third_party/WebKit/Source/core/input/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698