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

Unified Diff: third_party/google_input_tools/src/chrome/os/inputview/controller.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/controller.js
diff --git a/third_party/google_input_tools/src/chrome/os/inputview/controller.js b/third_party/google_input_tools/src/chrome/os/inputview/controller.js
index e754caec72264a50484b9d0a14b0cadd7683fc39..4cd26fb4fc67415021064cc5fc70dee6c91f0f64 100644
--- a/third_party/google_input_tools/src/chrome/os/inputview/controller.js
+++ b/third_party/google_input_tools/src/chrome/os/inputview/controller.js
@@ -40,6 +40,7 @@ goog.require('i18n.input.chrome.inputview.SizeSpec');
goog.require('i18n.input.chrome.inputview.SpecNodeName');
goog.require('i18n.input.chrome.inputview.StateType');
goog.require('i18n.input.chrome.inputview.SwipeDirection');
+goog.require('i18n.input.chrome.inputview.elements.Element');
goog.require('i18n.input.chrome.inputview.elements.ElementType');
goog.require('i18n.input.chrome.inputview.elements.content.Candidate');
goog.require('i18n.input.chrome.inputview.elements.content.CandidateView');
@@ -687,7 +688,8 @@ Controller.prototype.onPointerEvent_ = function(e) {
// keyboard window bounds. For other cases, we expect a view associated with a
// pointer up event.
if (e.type == EventType.POINTER_UP && !e.view) {
- if (this.container_.altDataView.isVisible()) {
+ if (this.container_.altDataView.isVisible() &&
+ e.identifier == this.container_.altDataView.identifier) {
var altDataView = this.container_.altDataView;
var ch = altDataView.getHighlightedCharacter();
if (ch) {
@@ -707,14 +709,6 @@ Controller.prototype.onPointerEvent_ = function(e) {
if (e.view) {
this.handlePointerAction_(e.view, e);
- } else if (e.type == EventType.POINTER_DOWN) {
- var tabbableKeysets = [
- Controller.HANDWRITING_VIEW_CODE_,
- Controller.EMOJI_VIEW_CODE_];
- if (goog.array.contains(tabbableKeysets, this.currentKeyset_)) {
- this.resetAll_();
- this.switchToKeyset(this.container_.currentKeysetView.fromKeyset);
- }
}
};
@@ -745,7 +739,7 @@ Controller.prototype.onDragEvent_ = function(e) {
Controller.prototype.handleSwipeAction_ = function(view, e) {
var direction = e.direction;
if (this.container_.altDataView.isVisible()) {
- this.container_.altDataView.highlightItem(e.x, e.y);
+ this.container_.altDataView.highlightItem(e.x, e.y, e.identifier);
return;
}
if (view.type == ElementType.BACKSPACE_KEY) {
@@ -770,7 +764,6 @@ Controller.prototype.handleSwipeAction_ = function(view, e) {
}
if (view.type == ElementType.COMPACT_KEY) {
-
view = /** @type {!i18n.input.chrome.inputview.elements.content.
CompactKey} */ (view);
if ((direction & i18n.input.chrome.inputview.SwipeDirection.UP) &&
@@ -842,6 +835,17 @@ Controller.prototype.handlePointerAction_ = function(view, e) {
this.container_.gestureCanvasView.startStroke(e);
}
+ if (this.adapter_.isGestureTypingEnabled() &&
+ e.type == EventType.POINTER_UP) {
+ this.container_.gestureCanvasView.endStroke(e);
+ }
+
+ // Do not trigger other actives when gesturing.
+ if (this.adapter_.isGestureTypingEnabled() &&
+ this.container_.gestureCanvasView.isGesturing) {
+ return;
+ }
+
// Listen for DOUBLE_CLICK as well to capture secondary taps on the spacebar.
if (e.type == EventType.POINTER_UP || e.type == EventType.DOUBLE_CLICK) {
this.recordStatsForClosing_(
@@ -853,6 +857,17 @@ Controller.prototype.handlePointerAction_ = function(view, e) {
this.handleSwipeAction_(view, e);
}
switch (view.type) {
+ case ElementType.KEYBOARD_CONTAINER_VIEW:
+ if (e.type == EventType.POINTER_DOWN) {
+ var tabbableKeysets = [
+ Controller.HANDWRITING_VIEW_CODE_,
+ Controller.EMOJI_VIEW_CODE_];
+ if (goog.array.contains(tabbableKeysets, this.currentKeyset_)) {
+ this.resetAll_();
+ this.switchToKeyset(this.container_.currentKeysetView.fromKeyset);
+ }
+ }
+ return;
case ElementType.BACK_BUTTON:
case ElementType.BACK_TO_KEYBOARD:
if (e.type == EventType.POINTER_OUT || e.type == EventType.POINTER_UP) {
@@ -906,10 +921,7 @@ Controller.prototype.handlePointerAction_ = function(view, e) {
case ElementType.ALTDATA_VIEW:
view = /** @type {!i18n.input.chrome.inputview.elements.content.
AltDataView} */ (view);
- if (e.type == EventType.POINTER_DOWN &&
- e.target == view.getCoverElement()) {
- view.hide();
- } else if (e.type == EventType.POINTER_UP) {
+ if (e.type == EventType.POINTER_UP && e.identifier == view.identifier) {
var ch = view.getHighlightedCharacter();
if (ch) {
this.adapter_.sendKeyDownAndUpEvent(ch, view.triggeredBy.id,
@@ -925,7 +937,7 @@ Controller.prototype.handlePointerAction_ = function(view, e) {
case ElementType.MENU_ITEM:
view = /** @type {!i18n.input.chrome.inputview.elements.content.
MenuItem} */ (view);
- if (e.type == EventType.CLICK) {
+ if (e.type == EventType.POINTER_UP) {
this.executeCommand_.apply(this, view.getCommand());
this.container_.menuView.hide();
this.soundController_.onKeyUp(view.type);
@@ -940,7 +952,7 @@ Controller.prototype.handlePointerAction_ = function(view, e) {
view = /** @type {!i18n.input.chrome.inputview.elements.content.
MenuView} */ (view);
- if (e.type == EventType.POINTER_DOWN &&
+ if (e.type == EventType.CLICK &&
e.target == view.getCoverElement()) {
view.hide();
}
@@ -1070,7 +1082,8 @@ Controller.prototype.handlePointerEventForSoftKey_ = function(softKey, e) {
CharacterKey} */ (softKey);
if (e.type == EventType.LONG_PRESS) {
this.container_.altDataView.show(
- key, goog.i18n.bidi.isRtlLanguage(this.languageCode_));
+ key, goog.i18n.bidi.isRtlLanguage(this.languageCode_),
+ e.identifier);
} else if (e.type == EventType.POINTER_UP) {
this.model_.stateManager.triggerChording();
var ch = key.getActiveCharacter();
@@ -1225,7 +1238,8 @@ Controller.prototype.handlePointerEventForSoftKey_ = function(softKey, e) {
CompactKey} */(softKey);
if (e.type == EventType.LONG_PRESS) {
this.container_.altDataView.show(
- key, goog.i18n.bidi.isRtlLanguage(this.languageCode_));
+ key, goog.i18n.bidi.isRtlLanguage(this.languageCode_),
+ e.identifier);
} else if (e.type == EventType.POINTER_UP) {
this.model_.stateManager.triggerChording();
var ch = key.getActiveCharacter();
@@ -1632,9 +1646,13 @@ Controller.prototype.clearCandidates_ = function() {
this.currentKeyset_ == Controller.EMOJI_VIEW_CODE_)) {
this.container_.candidateView.switchToIcon(
CandidateView.IconType.BACK, true);
- } else {
+ } else if (this.currentKeyset_ != Controller.HANDWRITING_VIEW_CODE_ &&
+ this.currentKeyset_ != Controller.EMOJI_VIEW_CODE_) {
this.container_.candidateView.switchToIcon(CandidateView.IconType.VOICE,
this.adapter_.isVoiceInputEnabled);
+ } else {
+ this.container_.candidateView.switchToIcon(CandidateView.IconType.VOICE,
+ false);
}
};
@@ -1862,7 +1880,7 @@ Controller.prototype.resize = function(opt_ignoreWindowResize) {
return;
}
- this.container_.resize(screen.width, height, widthPercent,
+ this.container_.setContainerSize(screen.width, height, widthPercent,
candidateViewHeight);
this.container_.candidateView.setToolbarVisible(this.shouldShowToolBar_());
if (this.container_.currentKeysetView) {

Powered by Google App Engine
This is Rietveld 408576698