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

Unified Diff: third_party/google_input_tools/src/chrome/os/inputview/handler/util.js

Issue 1046933003: Updates google-input-tools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/google_input_tools/src/chrome/os/inputview/handler/util.js
diff --git a/third_party/google_input_tools/src/chrome/os/inputview/handler/util.js b/third_party/google_input_tools/src/chrome/os/inputview/handler/util.js
index 3c96560a6f6c74885a4bfe24549c56bceceb9140..9902944bd32f38aa69f8d47ccdd56b4390fdb95b 100644
--- a/third_party/google_input_tools/src/chrome/os/inputview/handler/util.js
+++ b/third_party/google_input_tools/src/chrome/os/inputview/handler/util.js
@@ -14,12 +14,27 @@
goog.provide('i18n.input.chrome.inputview.handler.Util');
goog.require('goog.dom');
-
+goog.require('goog.events.EventType');
goog.scope(function() {
var Util = i18n.input.chrome.inputview.handler.Util;
+/**
+ * The mouse event identifier.
+ *
+ * @type {number}
+ */
+Util.MOUSE_EVENT_IDENTIFIER = -1;
+
+
+/**
+ * Represents invalid event identifier.
+ *
+ * @type {number}
+ */
+Util.INVALID_EVENT_IDENTIFIER = -2;
+
/**
* Gets the view.
@@ -40,4 +55,28 @@ Util.getView = function(target) {
return view;
};
+
+/**
+ * Gets the identifier from |e|. If |e| is a MouseEvent, returns -1.
+ *
+ * @param {!Event|!Touch|!goog.events.BrowserEvent} e The event.
+ * @return {number} .
+ *
+ */
+Util.getEventIdentifier = function(e) {
+ var nativeEvt = e.getBrowserEvent ? e.getBrowserEvent() : e;
+ if (nativeEvt.changedTouches) {
+ if (e.type == goog.events.EventType.TOUCHMOVE) {
+ console.error('TouchMove is not expected.');
+ }
+ // TouchStart and TouchEnd should only contains one Touch in changedTouches.
+ // The spec didn't have this restriction but it is safe to assume it in
+ // Chrome.
+ nativeEvt = nativeEvt.changedTouches[0];
+ }
+ return nativeEvt.identifier === undefined ?
+ Util.MOUSE_EVENT_IDENTIFIER : nativeEvt.identifier;
+};
+
+
}); // goog.scope

Powered by Google App Engine
This is Rietveld 408576698