| 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
|
|
|