OLD | NEW |
1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved. | 1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved. |
2 // limitations under the License. | 2 // limitations under the License. |
3 // See the License for the specific language governing permissions and | 3 // See the License for the specific language governing permissions and |
4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
5 // distributed under the License is distributed on an "AS-IS" BASIS, | 5 // distributed under the License is distributed on an "AS-IS" BASIS, |
6 // Unless required by applicable law or agreed to in writing, software | 6 // Unless required by applicable law or agreed to in writing, software |
7 // | 7 // |
8 // http://www.apache.org/licenses/LICENSE-2.0 | 8 // http://www.apache.org/licenses/LICENSE-2.0 |
9 // | 9 // |
10 // You may obtain a copy of the License at | 10 // You may obtain a copy of the License at |
(...skipping 27 matching lines...) Expand all Loading... |
38 goog.require('i18n.input.chrome.inputview.Settings'); | 38 goog.require('i18n.input.chrome.inputview.Settings'); |
39 goog.require('i18n.input.chrome.inputview.SizeSpec'); | 39 goog.require('i18n.input.chrome.inputview.SizeSpec'); |
40 goog.require('i18n.input.chrome.inputview.SpecNodeName'); | 40 goog.require('i18n.input.chrome.inputview.SpecNodeName'); |
41 goog.require('i18n.input.chrome.inputview.StateType'); | 41 goog.require('i18n.input.chrome.inputview.StateType'); |
42 goog.require('i18n.input.chrome.inputview.SwipeDirection'); | 42 goog.require('i18n.input.chrome.inputview.SwipeDirection'); |
43 goog.require('i18n.input.chrome.inputview.elements.ElementType'); | 43 goog.require('i18n.input.chrome.inputview.elements.ElementType'); |
44 goog.require('i18n.input.chrome.inputview.elements.content.Candidate'); | 44 goog.require('i18n.input.chrome.inputview.elements.content.Candidate'); |
45 goog.require('i18n.input.chrome.inputview.elements.content.CandidateView'); | 45 goog.require('i18n.input.chrome.inputview.elements.content.CandidateView'); |
46 goog.require('i18n.input.chrome.inputview.elements.content.ExpandedCandidateView
'); | 46 goog.require('i18n.input.chrome.inputview.elements.content.ExpandedCandidateView
'); |
47 goog.require('i18n.input.chrome.inputview.elements.content.MenuView'); | 47 goog.require('i18n.input.chrome.inputview.elements.content.MenuView'); |
48 goog.require('i18n.input.chrome.inputview.events.DragEvent'); | |
49 goog.require('i18n.input.chrome.inputview.events.EventType'); | 48 goog.require('i18n.input.chrome.inputview.events.EventType'); |
50 goog.require('i18n.input.chrome.inputview.events.KeyCodes'); | 49 goog.require('i18n.input.chrome.inputview.events.KeyCodes'); |
51 goog.require('i18n.input.chrome.inputview.handler.PointerHandler'); | 50 goog.require('i18n.input.chrome.inputview.handler.PointerHandler'); |
52 goog.require('i18n.input.chrome.inputview.util'); | 51 goog.require('i18n.input.chrome.inputview.util'); |
53 goog.require('i18n.input.chrome.message.ContextType'); | 52 goog.require('i18n.input.chrome.message.ContextType'); |
54 goog.require('i18n.input.chrome.message.Name'); | 53 goog.require('i18n.input.chrome.message.Name'); |
55 goog.require('i18n.input.chrome.message.Type'); | 54 goog.require('i18n.input.chrome.message.Type'); |
56 goog.require('i18n.input.chrome.sounds.SoundController'); | 55 goog.require('i18n.input.chrome.sounds.SoundController'); |
57 goog.require('i18n.input.lang.InputToolCode'); | 56 goog.require('i18n.input.lang.InputToolCode'); |
58 | 57 |
59 | 58 |
60 | 59 |
61 goog.scope(function() { | 60 goog.scope(function() { |
62 var CandidateType = i18n.input.chrome.inputview.elements.content.Candidate.Type; | 61 var CandidateType = i18n.input.chrome.inputview.elements.content.Candidate.Type; |
63 var Candidate = i18n.input.chrome.inputview.elements.content.Candidate; | |
64 var CandidateView = i18n.input.chrome.inputview.elements.content.CandidateView; | 62 var CandidateView = i18n.input.chrome.inputview.elements.content.CandidateView; |
65 var ConditionName = i18n.input.chrome.inputview.ConditionName; | 63 var ConditionName = i18n.input.chrome.inputview.ConditionName; |
66 var ContextType = i18n.input.chrome.message.ContextType; | 64 var ContextType = i18n.input.chrome.message.ContextType; |
67 var Css = i18n.input.chrome.inputview.Css; | 65 var Css = i18n.input.chrome.inputview.Css; |
68 var ElementType = i18n.input.chrome.inputview.elements.ElementType; | 66 var ElementType = i18n.input.chrome.inputview.elements.ElementType; |
69 var EventType = i18n.input.chrome.inputview.events.EventType; | 67 var EventType = i18n.input.chrome.inputview.events.EventType; |
70 var ExpandedCandidateView = i18n.input.chrome.inputview.elements.content. | 68 var ExpandedCandidateView = i18n.input.chrome.inputview.elements.content. |
71 ExpandedCandidateView; | 69 ExpandedCandidateView; |
72 var FeatureName = i18n.input.chrome.inputview.FeatureName; | 70 var FeatureName = i18n.input.chrome.inputview.FeatureName; |
73 var InputToolCode = i18n.input.lang.InputToolCode; | 71 var InputToolCode = i18n.input.lang.InputToolCode; |
74 var KeyCodes = i18n.input.chrome.inputview.events.KeyCodes; | 72 var KeyCodes = i18n.input.chrome.inputview.events.KeyCodes; |
75 var MenuView = i18n.input.chrome.inputview.elements.content.MenuView; | 73 var MenuView = i18n.input.chrome.inputview.elements.content.MenuView; |
76 var Name = i18n.input.chrome.message.Name; | 74 var Name = i18n.input.chrome.message.Name; |
77 var PerfTracker = i18n.input.chrome.inputview.PerfTracker; | 75 var PerfTracker = i18n.input.chrome.inputview.PerfTracker; |
78 var SizeSpec = i18n.input.chrome.inputview.SizeSpec; | 76 var SizeSpec = i18n.input.chrome.inputview.SizeSpec; |
79 var SpecNodeName = i18n.input.chrome.inputview.SpecNodeName; | 77 var SpecNodeName = i18n.input.chrome.inputview.SpecNodeName; |
80 var StateType = i18n.input.chrome.inputview.StateType; | 78 var StateType = i18n.input.chrome.inputview.StateType; |
81 var content = i18n.input.chrome.inputview.elements.content; | |
82 var SoundController = i18n.input.chrome.sounds.SoundController; | 79 var SoundController = i18n.input.chrome.sounds.SoundController; |
83 var Sounds = i18n.input.chrome.sounds.Sounds; | |
84 var Type = i18n.input.chrome.message.Type; | 80 var Type = i18n.input.chrome.message.Type; |
85 var util = i18n.input.chrome.inputview.util; | 81 var util = i18n.input.chrome.inputview.util; |
86 | 82 |
87 | 83 |
88 | 84 |
89 /** | 85 /** |
90 * The controller of the input view keyboard. | 86 * The controller of the input view keyboard. |
91 * | 87 * |
92 * @param {string} keyset The keyboard keyset. | 88 * @param {string} keyset The keyboard keyset. |
93 * @param {string} languageCode The language code for this keyboard. | 89 * @param {string} languageCode The language code for this keyboard. |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 * | 399 * |
404 * @private {string} | 400 * @private {string} |
405 */ | 401 */ |
406 Controller.prototype.passwordKeyset_ = ''; | 402 Controller.prototype.passwordKeyset_ = ''; |
407 | 403 |
408 | 404 |
409 /** | 405 /** |
410 * The soft key map, because key configuration is loaded before layout, | 406 * The soft key map, because key configuration is loaded before layout, |
411 * controller needs this varaible to save it and hook into keyboard view. | 407 * controller needs this varaible to save it and hook into keyboard view. |
412 * | 408 * |
413 * @type {!Array.<!content.SoftKey>} | 409 * @type {!Array.<!i18n.input.chrome.inputview.elements.content.SoftKey>} |
414 * @private | 410 * @private |
415 */ | 411 */ |
416 Controller.prototype.softKeyList_; | 412 Controller.prototype.softKeyList_; |
417 | 413 |
418 | 414 |
419 /** | 415 /** |
420 * The mapping from soft key id to soft key view id. | 416 * The mapping from soft key id to soft key view id. |
421 * | 417 * |
422 * @type {!Object.<string, string>} | 418 * @type {!Object.<string, string>} |
423 * @private | 419 * @private |
424 */ | 420 */ |
425 Controller.prototype.mapping_; | 421 Controller.prototype.mapping_; |
426 | 422 |
427 | 423 |
428 /** | 424 /** |
429 * The dead key. | |
430 * | |
431 * @type {string} | |
432 * @private | |
433 */ | |
434 Controller.prototype.deadKey_ = ''; | |
435 | |
436 | |
437 /** | |
438 * The input tool name. | 425 * The input tool name. |
439 * | 426 * |
440 * @type {string} | 427 * @type {string} |
441 * @private | 428 * @private |
442 */ | 429 */ |
443 Controller.prototype.title_; | 430 Controller.prototype.title_; |
444 | 431 |
445 | 432 |
446 /** | 433 /** |
447 * Registers event handlers. | 434 * Registers event handlers. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 }; | 479 }; |
493 | 480 |
494 | 481 |
495 /** | 482 /** |
496 * Handler for voice module state change. | 483 * Handler for voice module state change. |
497 * | 484 * |
498 * @param {!i18n.input.chrome.message.Event} e . | 485 * @param {!i18n.input.chrome.message.Event} e . |
499 * @private | 486 * @private |
500 */ | 487 */ |
501 Controller.prototype.onVoiceStateChange_ = function(e) { | 488 Controller.prototype.onVoiceStateChange_ = function(e) { |
502 var elem = this.container_.getElement(); | |
503 if (!e.msg[Name.VOICE_STATE]) { | 489 if (!e.msg[Name.VOICE_STATE]) { |
504 this.container_.candidateView.switchToIcon( | 490 this.container_.candidateView.switchToIcon( |
505 CandidateView.IconType.VOICE, true); | 491 CandidateView.IconType.VOICE, true); |
506 this.container_.voiceView.stop(); | 492 this.container_.voiceView.stop(); |
507 } | 493 } |
508 }; | 494 }; |
509 | 495 |
510 | 496 |
511 /** | 497 /** |
512 * Handles the refresh event from adapter. | 498 * Handles the refresh event from adapter. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 } | 589 } |
604 if (!this.adapter_.features.isEnabled(FeatureName.EXPERIMENTAL) && | 590 if (!this.adapter_.features.isEnabled(FeatureName.EXPERIMENTAL) && |
605 keysetMap[ContextType.DEFAULT] == | 591 keysetMap[ContextType.DEFAULT] == |
606 'zhuyin.compact.qwerty') { | 592 'zhuyin.compact.qwerty') { |
607 newKeyset = 'zhuyin'; | 593 newKeyset = 'zhuyin'; |
608 } | 594 } |
609 if (newKeyset) { | 595 if (newKeyset) { |
610 this.setDefaultKeyset_(newKeyset); | 596 this.setDefaultKeyset_(newKeyset); |
611 } | 597 } |
612 this.container_.selectView.setVisible( | 598 this.container_.selectView.setVisible( |
613 this.adapter_.features.isEnabled(FeatureName.GESTURE_EDITTING)); | 599 this.adapter_.features.isEnabled(FeatureName.GESTURE_SELECTION)); |
614 // Loads resources in case the default keyset is changed. | 600 // Loads resources in case the default keyset is changed. |
615 this.loadAllResources_(); | 601 this.loadAllResources_(); |
616 this.maybeCreateViews_(); | 602 this.maybeCreateViews_(); |
617 }; | 603 }; |
618 | 604 |
619 | 605 |
620 /** | 606 /** |
621 * Gets the data for spatial module. | 607 * Gets the data for spatial module. |
622 * | 608 * |
623 * @param {!content.SoftKey} key . | 609 * @param {!i18n.input.chrome.inputview.elements.content.SoftKey} key . |
624 * @param {number} x The x-offset of the touch point. | 610 * @param {number} x The x-offset of the touch point. |
625 * @param {number} y The y-offset of the touch point. | 611 * @param {number} y The y-offset of the touch point. |
626 * @return {!Object} . | 612 * @return {!Object} . |
627 * @private | 613 * @private |
628 */ | 614 */ |
629 Controller.prototype.getSpatialData_ = function(key, x, y) { | 615 Controller.prototype.getSpatialData_ = function(key, x, y) { |
630 var items = []; | 616 var items = []; |
631 items.push([this.getKeyContent_(key), key.estimator.estimateInLogSpace(x, y) | 617 items.push([this.getKeyContent_(key), key.estimator.estimateInLogSpace(x, y) |
632 ]); | 618 ]); |
633 for (var i = 0; i < key.nearbyKeys.length; i++) { | 619 for (var i = 0; i < key.nearbyKeys.length; i++) { |
(...skipping 15 matching lines...) Expand all Loading... |
649 return { | 635 return { |
650 'sources': sources, | 636 'sources': sources, |
651 'possibilities': possibilities | 637 'possibilities': possibilities |
652 }; | 638 }; |
653 }; | 639 }; |
654 | 640 |
655 | 641 |
656 /** | 642 /** |
657 * Gets the key content. | 643 * Gets the key content. |
658 * | 644 * |
659 * @param {!content.SoftKey} key . | 645 * @param {!i18n.input.chrome.inputview.elements.content.SoftKey} key . |
660 * @return {string} . | 646 * @return {string} . |
661 * @private | 647 * @private |
662 */ | 648 */ |
663 Controller.prototype.getKeyContent_ = function(key) { | 649 Controller.prototype.getKeyContent_ = function(key) { |
664 if (key.type == i18n.input.chrome.inputview.elements.ElementType. | 650 if (key.type == i18n.input.chrome.inputview.elements.ElementType. |
665 CHARACTER_KEY) { | 651 CHARACTER_KEY) { |
666 key = /** @type {!content.CharacterKey} */ (key); | 652 key = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 653 CharacterKey} */ (key); |
667 return key.getActiveCharacter(); | 654 return key.getActiveCharacter(); |
668 } | 655 } |
669 if (key.type == i18n.input.chrome.inputview.elements.ElementType. | 656 if (key.type == i18n.input.chrome.inputview.elements.ElementType. |
670 COMPACT_KEY) { | 657 COMPACT_KEY) { |
671 key = /** @type {!content.FunctionalKey} */ (key); | 658 key = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 659 FunctionalKey} */ (key); |
672 return key.text; | 660 return key.text; |
673 } | 661 } |
674 return ''; | 662 return ''; |
675 }; | 663 }; |
676 | 664 |
677 | 665 |
678 /** | 666 /** |
679 * Callback for pointer event. | 667 * Callback for pointer event. |
680 * | 668 * |
681 * @param {!i18n.input.chrome.inputview.events.PointerEvent} e . | 669 * @param {!i18n.input.chrome.inputview.events.PointerEvent} e . |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 } | 750 } |
763 if (view.type == ElementType.BACKSPACE_KEY) { | 751 if (view.type == ElementType.BACKSPACE_KEY) { |
764 if (this.container_.swipeView.isVisible() || | 752 if (this.container_.swipeView.isVisible() || |
765 this.container_.swipeView.isArmed()) { | 753 this.container_.swipeView.isArmed()) { |
766 this.stopBackspaceAutoRepeat_(); | 754 this.stopBackspaceAutoRepeat_(); |
767 return; | 755 return; |
768 } | 756 } |
769 } | 757 } |
770 | 758 |
771 if (view.type == ElementType.CHARACTER_KEY) { | 759 if (view.type == ElementType.CHARACTER_KEY) { |
772 view = /** @type {!content.CharacterKey} */ (view); | 760 view = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 761 CharacterKey} */ (view); |
773 if (direction & i18n.input.chrome.inputview.SwipeDirection.UP || | 762 if (direction & i18n.input.chrome.inputview.SwipeDirection.UP || |
774 direction & i18n.input.chrome.inputview.SwipeDirection.DOWN) { | 763 direction & i18n.input.chrome.inputview.SwipeDirection.DOWN) { |
775 var ch = view.getCharacterByGesture(!!(direction & | 764 var ch = view.getCharacterByGesture(!!(direction & |
776 i18n.input.chrome.inputview.SwipeDirection.UP)); | 765 i18n.input.chrome.inputview.SwipeDirection.UP)); |
777 if (ch) { | 766 if (ch) { |
778 view.flickerredCharacter = ch; | 767 view.flickerredCharacter = ch; |
779 } | 768 } |
780 } | 769 } |
781 } | 770 } |
782 | 771 |
783 if (view.type == ElementType.COMPACT_KEY) { | 772 if (view.type == ElementType.COMPACT_KEY) { |
784 view = /** @type {!content.CompactKey} */ (view); | 773 |
| 774 view = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 775 CompactKey} */ (view); |
785 if ((direction & i18n.input.chrome.inputview.SwipeDirection.UP) && | 776 if ((direction & i18n.input.chrome.inputview.SwipeDirection.UP) && |
786 view.hintText) { | 777 view.hintText) { |
787 view.flickerredCharacter = view.hintText; | 778 view.flickerredCharacter = view.hintText; |
788 } | 779 } |
789 } | 780 } |
790 }; | 781 }; |
791 | 782 |
792 | 783 |
793 /** | 784 /** |
794 * Execute a command. | 785 * Execute a command. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 this.container_.gestureCanvasView.startStroke(e); | 842 this.container_.gestureCanvasView.startStroke(e); |
852 } | 843 } |
853 | 844 |
854 // Listen for DOUBLE_CLICK as well to capture secondary taps on the spacebar. | 845 // Listen for DOUBLE_CLICK as well to capture secondary taps on the spacebar. |
855 if (e.type == EventType.POINTER_UP || e.type == EventType.DOUBLE_CLICK) { | 846 if (e.type == EventType.POINTER_UP || e.type == EventType.DOUBLE_CLICK) { |
856 this.recordStatsForClosing_( | 847 this.recordStatsForClosing_( |
857 'InputMethod.VirtualKeyboard.TapCount', 1, 4095, 4096); | 848 'InputMethod.VirtualKeyboard.TapCount', 1, 4095, 4096); |
858 } | 849 } |
859 | 850 |
860 if (e.type == EventType.SWIPE) { | 851 if (e.type == EventType.SWIPE) { |
861 e = /** @type {!i18n.input.chrome.inputview.events.SwipeEvent} */ (e); | 852 e = /** @type {!i18n.input.chrome.inputview.events.SwipeEvent} */ (e); |
862 this.handleSwipeAction_(view, e); | 853 this.handleSwipeAction_(view, e); |
863 } | 854 } |
864 switch (view.type) { | 855 switch (view.type) { |
865 case ElementType.BACK_BUTTON: | 856 case ElementType.BACK_BUTTON: |
866 case ElementType.BACK_TO_KEYBOARD: | 857 case ElementType.BACK_TO_KEYBOARD: |
867 if (e.type == EventType.POINTER_OUT || e.type == EventType.POINTER_UP) { | 858 if (e.type == EventType.POINTER_OUT || e.type == EventType.POINTER_UP) { |
868 view.setHighlighted(false); | 859 view.setHighlighted(false); |
869 } else if (e.type == EventType.POINTER_DOWN || | 860 } else if (e.type == EventType.POINTER_DOWN || |
870 e.type == EventType.POINTER_OVER) { | 861 e.type == EventType.POINTER_OVER) { |
871 view.setHighlighted(true); | 862 view.setHighlighted(true); |
(...skipping 14 matching lines...) Expand all Loading... |
886 return; | 877 return; |
887 case ElementType.SHRINK_CANDIDATES: | 878 case ElementType.SHRINK_CANDIDATES: |
888 if (e.type == EventType.POINTER_UP) { | 879 if (e.type == EventType.POINTER_UP) { |
889 this.showCandidates_(this.candidatesInfo_.source, | 880 this.showCandidates_(this.candidatesInfo_.source, |
890 this.candidatesInfo_.candidates, | 881 this.candidatesInfo_.candidates, |
891 Controller.CandidatesOperation.SHRINK); | 882 Controller.CandidatesOperation.SHRINK); |
892 this.soundController_.onKeyUp(view.type); | 883 this.soundController_.onKeyUp(view.type); |
893 } | 884 } |
894 return; | 885 return; |
895 case ElementType.CANDIDATE: | 886 case ElementType.CANDIDATE: |
896 view = /** @type {!Candidate} */ (view); | 887 view = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 888 Candidate} */ (view); |
897 if (e.type == EventType.POINTER_UP) { | 889 if (e.type == EventType.POINTER_UP) { |
898 if (view.candidateType == CandidateType.CANDIDATE) { | 890 if (view.candidateType == CandidateType.CANDIDATE) { |
899 this.adapter_.selectCandidate(view.candidate); | 891 this.adapter_.selectCandidate(view.candidate); |
900 } else if (view.candidateType == CandidateType.NUMBER) { | 892 } else if (view.candidateType == CandidateType.NUMBER) { |
901 this.adapter_.commitText(view.candidate[Name.CANDIDATE]); | 893 this.adapter_.commitText(view.candidate[Name.CANDIDATE]); |
902 } | 894 } |
903 this.container_.cleanStroke(); | 895 this.container_.cleanStroke(); |
904 this.soundController_.onKeyUp(ElementType.CANDIDATE); | 896 this.soundController_.onKeyUp(ElementType.CANDIDATE); |
905 } | 897 } |
906 if (e.type == EventType.POINTER_OUT || e.type == EventType.POINTER_UP) { | 898 if (e.type == EventType.POINTER_OUT || e.type == EventType.POINTER_UP) { |
907 view.setHighlighted(false); | 899 view.setHighlighted(false); |
908 } else if (e.type == EventType.POINTER_DOWN || | 900 } else if (e.type == EventType.POINTER_DOWN || |
909 e.type == EventType.POINTER_OVER) { | 901 e.type == EventType.POINTER_OVER) { |
910 view.setHighlighted(true); | 902 view.setHighlighted(true); |
911 } | 903 } |
912 return; | 904 return; |
913 | 905 |
914 case ElementType.ALTDATA_VIEW: | 906 case ElementType.ALTDATA_VIEW: |
915 view = /** @type {!content.AltDataView} */ (view); | 907 view = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 908 AltDataView} */ (view); |
916 if (e.type == EventType.POINTER_DOWN && | 909 if (e.type == EventType.POINTER_DOWN && |
917 e.target == view.getCoverElement()) { | 910 e.target == view.getCoverElement()) { |
918 view.hide(); | 911 view.hide(); |
919 } else if (e.type == EventType.POINTER_UP) { | 912 } else if (e.type == EventType.POINTER_UP) { |
920 var ch = view.getHighlightedCharacter(); | 913 var ch = view.getHighlightedCharacter(); |
921 if (ch) { | 914 if (ch) { |
922 this.adapter_.sendKeyDownAndUpEvent(ch, view.triggeredBy.id, | 915 this.adapter_.sendKeyDownAndUpEvent(ch, view.triggeredBy.id, |
923 view.triggeredBy.keyCode, | 916 view.triggeredBy.keyCode, |
924 {'sources': [ch.toLowerCase()], 'possibilities': [1]}); | 917 {'sources': [ch.toLowerCase()], 'possibilities': [1]}); |
925 } | 918 } |
926 view.hide(); | 919 view.hide(); |
927 this.clearUnstickyState_(); | 920 this.clearUnstickyState_(); |
928 this.soundController_.onKeyUp(view.type); | 921 this.soundController_.onKeyUp(view.type); |
929 } | 922 } |
930 return; | 923 return; |
931 | 924 |
932 case ElementType.MENU_ITEM: | 925 case ElementType.MENU_ITEM: |
933 view = /** @type {!content.MenuItem} */ (view); | 926 view = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 927 MenuItem} */ (view); |
934 if (e.type == EventType.CLICK) { | 928 if (e.type == EventType.CLICK) { |
935 this.executeCommand_.apply(this, view.getCommand()); | 929 this.executeCommand_.apply(this, view.getCommand()); |
936 this.container_.menuView.hide(); | 930 this.container_.menuView.hide(); |
937 this.soundController_.onKeyUp(view.type); | 931 this.soundController_.onKeyUp(view.type); |
938 this.resetAll_(); | 932 this.resetAll_(); |
939 } | 933 } |
940 view.setHighlighted(e.type == EventType.POINTER_DOWN || | 934 view.setHighlighted(e.type == EventType.POINTER_DOWN || |
941 e.type == EventType.POINTER_OVER); | 935 e.type == EventType.POINTER_OVER); |
942 // TODO: Add chrome vox support. | 936 // TODO: Add chrome vox support. |
943 return; | 937 return; |
944 | 938 |
945 case ElementType.MENU_VIEW: | 939 case ElementType.MENU_VIEW: |
946 view = /** @type {!MenuView} */ (view); | 940 view = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 941 MenuView} */ (view); |
947 | 942 |
948 if (e.type == EventType.POINTER_DOWN && | 943 if (e.type == EventType.POINTER_DOWN && |
949 e.target == view.getCoverElement()) { | 944 e.target == view.getCoverElement()) { |
950 view.hide(); | 945 view.hide(); |
951 } | 946 } |
952 return; | 947 return; |
953 | 948 |
954 case ElementType.EMOJI_KEY: | 949 case ElementType.EMOJI_KEY: |
955 if (e.type == EventType.CLICK) { | 950 if (e.type == EventType.CLICK) { |
956 if (!this.container_.currentKeysetView.isDragging && view.text != '') { | 951 if (!this.container_.currentKeysetView.isDragging && view.text != '') { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 // of the key down or up. | 1031 // of the key down or up. |
1037 if (e.type == EventType.POINTER_OVER || e.type == EventType.POINTER_DOWN || | 1032 if (e.type == EventType.POINTER_OVER || e.type == EventType.POINTER_DOWN || |
1038 e.type == EventType.DOUBLE_CLICK) { | 1033 e.type == EventType.DOUBLE_CLICK) { |
1039 view.setHighlighted(true); | 1034 view.setHighlighted(true); |
1040 } else if (e.type == EventType.POINTER_OUT || | 1035 } else if (e.type == EventType.POINTER_OUT || |
1041 e.type == EventType.POINTER_UP || | 1036 e.type == EventType.POINTER_UP || |
1042 e.type == EventType.DOUBLE_CLICK_END) { | 1037 e.type == EventType.DOUBLE_CLICK_END) { |
1043 view.setHighlighted(false); | 1038 view.setHighlighted(false); |
1044 } | 1039 } |
1045 } | 1040 } |
1046 this.handlePointerEventForSoftKey_( | 1041 view = /** @type {!i18n.input.chrome.inputview.elements.content. |
1047 /** @type {!content.SoftKey} */ (view), e); | 1042 SoftKey} */ (view); |
| 1043 this.handlePointerEventForSoftKey_(view, e); |
1048 this.updateContextModifierState_(); | 1044 this.updateContextModifierState_(); |
1049 }; | 1045 }; |
1050 | 1046 |
1051 | 1047 |
1052 /** | 1048 /** |
1053 * Handles softkey of the pointer action. | 1049 * Handles softkey of the pointer action. |
1054 * | 1050 * |
1055 * @param {!content.SoftKey} softKey . | 1051 * @param {!i18n.input.chrome.inputview.elements.content.SoftKey} softKey . |
1056 * @param {!i18n.input.chrome.inputview.events.PointerEvent} e . | 1052 * @param {!i18n.input.chrome.inputview.events.PointerEvent} e . |
1057 * @private | 1053 * @private |
1058 */ | 1054 */ |
1059 Controller.prototype.handlePointerEventForSoftKey_ = function(softKey, e) { | 1055 Controller.prototype.handlePointerEventForSoftKey_ = function(softKey, e) { |
1060 var key; | 1056 var key; |
1061 switch (softKey.type) { | 1057 switch (softKey.type) { |
1062 case ElementType.CANDIDATES_PAGE_UP: | 1058 case ElementType.CANDIDATES_PAGE_UP: |
1063 if (e.type == EventType.POINTER_UP) { | 1059 if (e.type == EventType.POINTER_UP) { |
1064 this.container_.expandedCandidateView.pageUp(); | 1060 this.container_.expandedCandidateView.pageUp(); |
1065 } | 1061 } |
1066 break; | 1062 break; |
1067 case ElementType.CANDIDATES_PAGE_DOWN: | 1063 case ElementType.CANDIDATES_PAGE_DOWN: |
1068 if (e.type == EventType.POINTER_UP) { | 1064 if (e.type == EventType.POINTER_UP) { |
1069 this.container_.expandedCandidateView.pageDown(); | 1065 this.container_.expandedCandidateView.pageDown(); |
1070 } | 1066 } |
1071 break; | 1067 break; |
1072 case ElementType.CHARACTER_KEY: | 1068 case ElementType.CHARACTER_KEY: |
1073 key = /** @type {!content.CharacterKey} */ (softKey); | 1069 key = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 1070 CharacterKey} */ (softKey); |
1074 if (e.type == EventType.LONG_PRESS) { | 1071 if (e.type == EventType.LONG_PRESS) { |
1075 this.container_.altDataView.show( | 1072 this.container_.altDataView.show( |
1076 key, goog.i18n.bidi.isRtlLanguage(this.languageCode_)); | 1073 key, goog.i18n.bidi.isRtlLanguage(this.languageCode_)); |
1077 } else if (e.type == EventType.POINTER_UP) { | 1074 } else if (e.type == EventType.POINTER_UP) { |
1078 this.model_.stateManager.triggerChording(); | 1075 this.model_.stateManager.triggerChording(); |
1079 var ch = key.getActiveCharacter(); | 1076 var ch = key.getActiveCharacter(); |
1080 this.adapter_.sendKeyDownAndUpEvent(ch, key.id, key.keyCode, | 1077 this.adapter_.sendKeyDownAndUpEvent(ch, key.id, key.keyCode, |
1081 this.getSpatialData_(key, e.x, e.y)); | 1078 this.getSpatialData_(key, e.x, e.y)); |
1082 this.clearUnstickyState_(); | 1079 this.clearUnstickyState_(); |
1083 key.flickerredCharacter = ''; | 1080 key.flickerredCharacter = ''; |
1084 } | 1081 } |
1085 break; | 1082 break; |
1086 | 1083 |
1087 case ElementType.MODIFIER_KEY: | 1084 case ElementType.MODIFIER_KEY: |
1088 key = /** @type {!content.ModifierKey} */ (softKey); | 1085 key = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 1086 ModifierKey} */(softKey); |
1089 var isStateEnabled = this.model_.stateManager.hasState(key.toState); | 1087 var isStateEnabled = this.model_.stateManager.hasState(key.toState); |
1090 var isChording = this.model_.stateManager.isChording(key.toState); | 1088 var isChording = this.model_.stateManager.isChording(key.toState); |
1091 if (e.type == EventType.POINTER_DOWN) { | 1089 if (e.type == EventType.POINTER_DOWN) { |
1092 this.changeState_(key.toState, !isStateEnabled, true, false); | 1090 this.changeState_(key.toState, !isStateEnabled, true, false); |
1093 this.model_.stateManager.setKeyDown(key.toState, true); | 1091 this.model_.stateManager.setKeyDown(key.toState, true); |
1094 } else if (e.type == EventType.POINTER_UP || e.type == EventType. | 1092 } else if (e.type == EventType.POINTER_UP || e.type == EventType. |
1095 POINTER_OUT) { | 1093 POINTER_OUT) { |
1096 if (isChording) { | 1094 if (isChording) { |
1097 this.changeState_(key.toState, false, false); | 1095 this.changeState_(key.toState, false, false); |
1098 } else if (key.toState == StateType.CAPSLOCK) { | 1096 } else if (key.toState == StateType.CAPSLOCK) { |
1099 this.changeState_(key.toState, isStateEnabled, true, true); | 1097 this.changeState_(key.toState, isStateEnabled, true, true); |
1100 } else if (this.model_.stateManager.isKeyDown(key.toState)) { | 1098 } else if (this.model_.stateManager.isKeyDown(key.toState)) { |
1101 this.changeState_(key.toState, isStateEnabled, false); | 1099 this.changeState_(key.toState, isStateEnabled, false); |
1102 } | 1100 } |
1103 this.model_.stateManager.setKeyDown(key.toState, false); | 1101 this.model_.stateManager.setKeyDown(key.toState, false); |
1104 } else if (e.type == EventType.DOUBLE_CLICK) { | 1102 } else if (e.type == EventType.DOUBLE_CLICK) { |
1105 this.changeState_(key.toState, isStateEnabled, true, true); | 1103 this.changeState_(key.toState, isStateEnabled, true, true); |
1106 } else if (e.type == EventType.LONG_PRESS) { | 1104 } else if (e.type == EventType.LONG_PRESS) { |
1107 if (!isChording) { | 1105 if (!isChording) { |
1108 this.changeState_(key.toState, true, true, true); | 1106 this.changeState_(key.toState, true, true, true); |
1109 this.model_.stateManager.setKeyDown(key.toState, false); | 1107 this.model_.stateManager.setKeyDown(key.toState, false); |
1110 } | 1108 } |
1111 } | 1109 } |
1112 break; | 1110 break; |
1113 | 1111 |
1114 case ElementType.BACKSPACE_KEY: | 1112 case ElementType.BACKSPACE_KEY: |
1115 key = /** @type {!content.FunctionalKey} */ (softKey); | 1113 key = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 1114 FunctionalKey} */(softKey); |
1116 if (e.type == EventType.POINTER_DOWN) { | 1115 if (e.type == EventType.POINTER_DOWN) { |
1117 this.backspaceTick_(); | 1116 this.backspaceTick_(); |
1118 } else if (e.type == EventType.POINTER_UP || e.type == EventType. | 1117 } else if (e.type == EventType.POINTER_UP || e.type == EventType. |
1119 POINTER_OUT) { | 1118 POINTER_OUT) { |
1120 if (!this.container_.swipeView.isVisible()) { | 1119 if (!this.container_.swipeView.isVisible()) { |
1121 this.stopBackspaceAutoRepeat_(); | 1120 this.stopBackspaceAutoRepeat_(); |
1122 } | 1121 } |
1123 } | 1122 } |
1124 break; | 1123 break; |
1125 | 1124 |
1126 case ElementType.TAB_KEY: | 1125 case ElementType.TAB_KEY: |
1127 key = /** @type {!content.FunctionalKey} */ (softKey); | 1126 key = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 1127 FunctionalKey} */ (softKey); |
1128 if (e.type == EventType.POINTER_DOWN) { | 1128 if (e.type == EventType.POINTER_DOWN) { |
1129 this.adapter_.sendKeyDownEvent('\u0009', KeyCodes.TAB); | 1129 this.adapter_.sendKeyDownEvent('\u0009', KeyCodes.TAB); |
1130 } else if (e.type == EventType.POINTER_UP) { | 1130 } else if (e.type == EventType.POINTER_UP) { |
1131 this.adapter_.sendKeyUpEvent('\u0009', KeyCodes.TAB); | 1131 this.adapter_.sendKeyUpEvent('\u0009', KeyCodes.TAB); |
1132 } | 1132 } |
1133 break; | 1133 break; |
1134 | 1134 |
1135 case ElementType.ENTER_KEY: | 1135 case ElementType.ENTER_KEY: |
1136 key = /** @type {!content.FunctionalKey} */ (softKey); | 1136 key = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 1137 FunctionalKey} */ (softKey); |
1137 if (e.type == EventType.POINTER_UP) { | 1138 if (e.type == EventType.POINTER_UP) { |
1138 this.adapter_.sendKeyDownAndUpEvent('\u000D', KeyCodes.ENTER); | 1139 this.adapter_.sendKeyDownAndUpEvent('\u000D', KeyCodes.ENTER); |
1139 } | 1140 } |
1140 break; | 1141 break; |
1141 | 1142 |
1142 case ElementType.ARROW_UP: | 1143 case ElementType.ARROW_UP: |
1143 if (e.type == EventType.POINTER_DOWN) { | 1144 if (e.type == EventType.POINTER_DOWN) { |
1144 this.adapter_.sendKeyDownEvent('', KeyCodes.ARROW_UP); | 1145 this.adapter_.sendKeyDownEvent('', KeyCodes.ARROW_UP); |
1145 } else if (e.type == EventType.POINTER_UP) { | 1146 } else if (e.type == EventType.POINTER_UP) { |
1146 this.adapter_.sendKeyUpEvent('', KeyCodes.ARROW_UP); | 1147 this.adapter_.sendKeyUpEvent('', KeyCodes.ARROW_UP); |
(...skipping 18 matching lines...) Expand all Loading... |
1165 | 1166 |
1166 case ElementType.ARROW_RIGHT: | 1167 case ElementType.ARROW_RIGHT: |
1167 if (e.type == EventType.POINTER_DOWN) { | 1168 if (e.type == EventType.POINTER_DOWN) { |
1168 this.adapter_.sendKeyDownEvent('', KeyCodes.ARROW_RIGHT); | 1169 this.adapter_.sendKeyDownEvent('', KeyCodes.ARROW_RIGHT); |
1169 } else if (e.type == EventType.POINTER_UP) { | 1170 } else if (e.type == EventType.POINTER_UP) { |
1170 this.adapter_.sendKeyUpEvent('', KeyCodes.ARROW_RIGHT); | 1171 this.adapter_.sendKeyUpEvent('', KeyCodes.ARROW_RIGHT); |
1171 } | 1172 } |
1172 break; | 1173 break; |
1173 case ElementType.EN_SWITCHER: | 1174 case ElementType.EN_SWITCHER: |
1174 if (e.type == EventType.POINTER_UP) { | 1175 if (e.type == EventType.POINTER_UP) { |
1175 key = /** @type {!content.EnSwitcherKey} */ (softKey); | 1176 key = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 1177 EnSwitcherKey} */ (softKey); |
1176 this.adapter_.toggleLanguageState(this.model_.stateManager.isEnMode); | 1178 this.adapter_.toggleLanguageState(this.model_.stateManager.isEnMode); |
1177 this.model_.stateManager.isEnMode = !this.model_.stateManager.isEnMode; | 1179 this.model_.stateManager.isEnMode = !this.model_.stateManager.isEnMode; |
1178 key.update(); | 1180 key.update(); |
1179 } | 1181 } |
1180 break; | 1182 break; |
1181 case ElementType.SPACE_KEY: | 1183 case ElementType.SPACE_KEY: |
1182 key = /** @type {!content.SpaceKey} */ (softKey); | 1184 key = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 1185 SpaceKey} */ (softKey); |
1183 var doubleSpacePeriod = this.model_.settings.doubleSpacePeriod && | 1186 var doubleSpacePeriod = this.model_.settings.doubleSpacePeriod && |
1184 this.currentKeyset_ != Controller.HANDWRITING_VIEW_CODE_ && | 1187 this.currentKeyset_ != Controller.HANDWRITING_VIEW_CODE_ && |
1185 this.currentKeyset_ != Controller.EMOJI_VIEW_CODE_; | 1188 this.currentKeyset_ != Controller.EMOJI_VIEW_CODE_; |
1186 if (e.type == EventType.POINTER_UP || (!doubleSpacePeriod && e.type == | 1189 if (e.type == EventType.POINTER_UP || (!doubleSpacePeriod && e.type == |
1187 EventType.DOUBLE_CLICK_END)) { | 1190 EventType.DOUBLE_CLICK_END)) { |
1188 this.adapter_.sendKeyDownAndUpEvent(key.getCharacter(), | 1191 this.adapter_.sendKeyDownAndUpEvent(key.getCharacter(), |
1189 KeyCodes.SPACE); | 1192 KeyCodes.SPACE); |
1190 this.clearUnstickyState_(); | 1193 this.clearUnstickyState_(); |
1191 } else if (e.type == EventType.DOUBLE_CLICK && doubleSpacePeriod) { | 1194 } else if (e.type == EventType.DOUBLE_CLICK && doubleSpacePeriod) { |
1192 this.adapter_.doubleClickOnSpaceKey(); | 1195 this.adapter_.doubleClickOnSpaceKey(); |
1193 } | 1196 } |
1194 break; | 1197 break; |
1195 | 1198 |
1196 case ElementType.SWITCHER_KEY: | 1199 case ElementType.SWITCHER_KEY: |
1197 key = /** @type {!content.SwitcherKey} */ (softKey); | 1200 key = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 1201 SwitcherKey} */ (softKey); |
1198 if (e.type == EventType.POINTER_UP) { | 1202 if (e.type == EventType.POINTER_UP) { |
1199 this.recordStatsForClosing_( | 1203 this.recordStatsForClosing_( |
1200 'InputMethod.VirtualKeyboard.LayoutSwitch', 1, 25, 25); | 1204 'InputMethod.VirtualKeyboard.LayoutSwitch', 1, 25, 25); |
1201 if (this.isSubKeyset_(key.toKeyset, this.currentKeyset_)) { | 1205 if (this.isSubKeyset_(key.toKeyset, this.currentKeyset_)) { |
1202 this.model_.stateManager.reset(); | 1206 this.model_.stateManager.reset(); |
1203 this.container_.update(); | 1207 this.container_.update(); |
1204 this.updateContextModifierState_(); | 1208 this.updateContextModifierState_(); |
1205 this.container_.menuView.hide(); | 1209 this.container_.menuView.hide(); |
1206 } else { | 1210 } else { |
1207 this.resetAll_(); | 1211 this.resetAll_(); |
1208 } | 1212 } |
1209 // Switch to the specific keyboard. | 1213 // Switch to the specific keyboard. |
1210 this.switchToKeyset(key.toKeyset); | 1214 this.switchToKeyset(key.toKeyset); |
1211 if (key.record) { | 1215 if (key.record) { |
1212 this.model_.settings.savePreference( | 1216 this.model_.settings.savePreference( |
1213 util.getConfigName(key.toKeyset), | 1217 util.getConfigName(key.toKeyset), |
1214 key.toKeyset); | 1218 key.toKeyset); |
1215 } | 1219 } |
1216 } | 1220 } |
1217 break; | 1221 break; |
1218 | 1222 |
1219 case ElementType.COMPACT_KEY: | 1223 case ElementType.COMPACT_KEY: |
1220 key = /** @type {!content.CompactKey} */ (softKey); | 1224 key = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 1225 CompactKey} */(softKey); |
1221 if (e.type == EventType.LONG_PRESS) { | 1226 if (e.type == EventType.LONG_PRESS) { |
1222 this.container_.altDataView.show( | 1227 this.container_.altDataView.show( |
1223 key, goog.i18n.bidi.isRtlLanguage(this.languageCode_)); | 1228 key, goog.i18n.bidi.isRtlLanguage(this.languageCode_)); |
1224 } else if (e.type == EventType.POINTER_UP) { | 1229 } else if (e.type == EventType.POINTER_UP) { |
1225 this.model_.stateManager.triggerChording(); | 1230 this.model_.stateManager.triggerChording(); |
1226 var ch = key.getActiveCharacter(); | 1231 var ch = key.getActiveCharacter(); |
1227 if (ch.length == 1) { | 1232 if (ch.length == 1) { |
1228 this.adapter_.sendKeyDownAndUpEvent(key.getActiveCharacter(), '', 0, | 1233 this.adapter_.sendKeyDownAndUpEvent(key.getActiveCharacter(), '', 0, |
1229 this.getSpatialData_(key, e.x, e.y)); | 1234 this.getSpatialData_(key, e.x, e.y)); |
1230 } else if (ch.length > 1) { | 1235 } else if (ch.length > 1) { |
(...skipping 11 matching lines...) Expand all Loading... |
1242 var defaultKeyset = this.getActiveKeyset_(); | 1247 var defaultKeyset = this.getActiveKeyset_(); |
1243 if (e.type == EventType.POINTER_UP) { | 1248 if (e.type == EventType.POINTER_UP) { |
1244 this.adapter_.hideKeyboard(); | 1249 this.adapter_.hideKeyboard(); |
1245 if (this.currentKeyset_ != defaultKeyset) { | 1250 if (this.currentKeyset_ != defaultKeyset) { |
1246 this.switchToKeyset(defaultKeyset); | 1251 this.switchToKeyset(defaultKeyset); |
1247 } | 1252 } |
1248 } | 1253 } |
1249 break; | 1254 break; |
1250 | 1255 |
1251 case ElementType.MENU_KEY: | 1256 case ElementType.MENU_KEY: |
1252 key = /** @type {!content.MenuKey} */ (softKey); | 1257 key = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 1258 MenuKey} */ (softKey); |
1253 if (e.type == EventType.POINTER_DOWN) { | 1259 if (e.type == EventType.POINTER_DOWN) { |
1254 var isCompact = this.currentKeyset_.indexOf('compact') != -1; | 1260 var isCompact = this.currentKeyset_.indexOf('compact') != -1; |
1255 // Gets the default full keyboard instead of default keyset because | 1261 // Gets the default full keyboard instead of default keyset because |
1256 // the default keyset can be a compact keyset which would cause problem | 1262 // the default keyset can be a compact keyset which would cause problem |
1257 // in MenuView.show(). | 1263 // in MenuView.show(). |
1258 var defaultFullKeyset = this.initialKeyset_.split(/\./)[0]; | 1264 var defaultFullKeyset = this.initialKeyset_.split(/\./)[0]; |
1259 var enableCompact = !this.adapter_.isA11yMode && goog.array.contains( | 1265 var enableCompact = !this.adapter_.isA11yMode && goog.array.contains( |
1260 util.KEYSETS_HAVE_COMPACT, defaultFullKeyset); | 1266 util.KEYSETS_HAVE_COMPACT, defaultFullKeyset); |
1261 if (defaultFullKeyset == 'zhuyin' && | 1267 if (defaultFullKeyset == 'zhuyin' && |
1262 !this.adapter_.features.isEnabled(FeatureName.EXPERIMENTAL) || | 1268 !this.adapter_.features.isEnabled(FeatureName.EXPERIMENTAL) || |
1263 this.languageCode_ == 'ko') { | 1269 this.languageCode_ == 'ko') { |
1264 // Hides 'switch to compact' for zhuyin when not in experimental env. | 1270 // Hides 'switch to compact' for zhuyin when not in experimental env. |
1265 enableCompact = false; | 1271 enableCompact = false; |
1266 } | 1272 } |
1267 var self = this; | |
1268 var hasHwt = !this.adapter_.isPasswordBox() && | 1273 var hasHwt = !this.adapter_.isPasswordBox() && |
1269 !Controller.DISABLE_HWT && goog.object.contains( | 1274 !Controller.DISABLE_HWT && goog.object.contains( |
1270 InputToolCode, this.getHwtInputToolCode_()); | 1275 InputToolCode, this.getHwtInputToolCode_()); |
1271 var hasEmoji = !this.adapter_.isPasswordBox(); | 1276 var hasEmoji = !this.adapter_.isPasswordBox(); |
1272 var enableSettings = this.shouldEnableSettings() && | 1277 var enableSettings = this.shouldEnableSettings() && |
1273 !!window.inputview && !!inputview.openSettings; | 1278 !!window.inputview && !!inputview.openSettings; |
1274 this.adapter_.getInputMethods(function(inputMethods) { | 1279 this.adapter_.getInputMethods(function(inputMethods) { |
1275 this.container_.menuView.show(key, defaultFullKeyset, isCompact, | 1280 this.container_.menuView.show(key, defaultFullKeyset, isCompact, |
1276 enableCompact, this.currentInputMethod_, inputMethods, hasHwt, | 1281 enableCompact, this.currentInputMethod_, inputMethods, hasHwt, |
1277 enableSettings, hasEmoji); | 1282 enableSettings, hasEmoji); |
1278 }.bind(this)); | 1283 }.bind(this)); |
1279 } | 1284 } |
1280 break; | 1285 break; |
1281 | 1286 |
1282 case ElementType.GLOBE_KEY: | 1287 case ElementType.GLOBE_KEY: |
1283 if (e.type == EventType.POINTER_UP) { | 1288 if (e.type == EventType.POINTER_UP) { |
1284 this.adapter_.clearModifierStates(); | 1289 this.adapter_.clearModifierStates(); |
1285 this.adapter_.setModifierState( | 1290 this.adapter_.setModifierState( |
1286 i18n.input.chrome.inputview.StateType.CTRL, true); | 1291 i18n.input.chrome.inputview.StateType.CTRL, true); |
1287 this.adapter_.sendKeyDownAndUpEvent(' ', KeyCodes.SPACE, 0x20); | 1292 this.adapter_.sendKeyDownAndUpEvent(' ', KeyCodes.SPACE, 0x20); |
1288 this.adapter_.setModifierState( | 1293 this.adapter_.setModifierState( |
1289 i18n.input.chrome.inputview.StateType.CTRL, false); | 1294 i18n.input.chrome.inputview.StateType.CTRL, false); |
1290 } | 1295 } |
1291 break; | 1296 break; |
1292 case ElementType.IME_SWITCH: | 1297 case ElementType.IME_SWITCH: |
1293 key = /** @type {!content.FunctionalKey} */ (softKey); | 1298 key = /** @type {!i18n.input.chrome.inputview.elements.content. |
| 1299 FunctionalKey} */ (softKey); |
1294 this.adapter_.sendKeyDownAndUpEvent('', key.id); | 1300 this.adapter_.sendKeyDownAndUpEvent('', key.id); |
1295 break; | 1301 break; |
1296 } | 1302 } |
1297 // Play key sound on pointer up or double click. | 1303 // Play key sound on pointer up or double click. |
1298 if (e.type == EventType.POINTER_UP || e.type == EventType.DOUBLE_CLICK) | 1304 if (e.type == EventType.POINTER_UP || e.type == EventType.DOUBLE_CLICK) |
1299 this.soundController_.onKeyUp(softKey.type); | 1305 this.soundController_.onKeyUp(softKey.type); |
1300 }; | 1306 }; |
1301 | 1307 |
1302 | 1308 |
1303 /** | 1309 /** |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1383 * reset modifier state, etc. | 1389 * reset modifier state, etc. |
1384 * | 1390 * |
1385 * @private | 1391 * @private |
1386 */ | 1392 */ |
1387 Controller.prototype.resetAll_ = function() { | 1393 Controller.prototype.resetAll_ = function() { |
1388 this.clearCandidates_(); | 1394 this.clearCandidates_(); |
1389 this.container_.cleanStroke(); | 1395 this.container_.cleanStroke(); |
1390 this.model_.stateManager.reset(); | 1396 this.model_.stateManager.reset(); |
1391 this.container_.update(); | 1397 this.container_.update(); |
1392 this.updateContextModifierState_(); | 1398 this.updateContextModifierState_(); |
1393 this.deadKey_ = ''; | |
1394 this.resize(); | 1399 this.resize(); |
1395 this.container_.expandedCandidateView.close(); | 1400 this.container_.expandedCandidateView.close(); |
1396 this.container_.menuView.hide(); | 1401 this.container_.menuView.hide(); |
1397 this.container_.swipeView.reset(); | 1402 this.container_.swipeView.reset(); |
1398 this.container_.altDataView.hide(); | 1403 this.container_.altDataView.hide(); |
1399 }; | 1404 }; |
1400 | 1405 |
1401 | 1406 |
1402 /** | 1407 /** |
1403 * Returns whether the toolbar should be shown. | 1408 * Returns whether the toolbar should be shown. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 }; | 1452 }; |
1448 | 1453 |
1449 | 1454 |
1450 /** | 1455 /** |
1451 * Callback for Context blurs. | 1456 * Callback for Context blurs. |
1452 * | 1457 * |
1453 * @private | 1458 * @private |
1454 */ | 1459 */ |
1455 Controller.prototype.onContextBlur_ = function() { | 1460 Controller.prototype.onContextBlur_ = function() { |
1456 this.container_.cleanStroke(); | 1461 this.container_.cleanStroke(); |
1457 this.deadKey_ = ''; | |
1458 this.container_.menuView.hide(); | 1462 this.container_.menuView.hide(); |
1459 }; | 1463 }; |
1460 | 1464 |
1461 | 1465 |
1462 /** | 1466 /** |
1463 * Backspace key is down. | 1467 * Backspace key is down. |
1464 * | 1468 * |
1465 * @private | 1469 * @private |
1466 */ | 1470 */ |
1467 Controller.prototype.backspaceDown_ = function() { | 1471 Controller.prototype.backspaceDown_ = function() { |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1725 * Switch to a specific keyboard. | 1729 * Switch to a specific keyboard. |
1726 * | 1730 * |
1727 * @param {string} keyset The keyset name. | 1731 * @param {string} keyset The keyset name. |
1728 */ | 1732 */ |
1729 Controller.prototype.switchToKeyset = function(keyset) { | 1733 Controller.prototype.switchToKeyset = function(keyset) { |
1730 if (!this.isSettingReady || this.adapter_.isSwitching()) { | 1734 if (!this.isSettingReady || this.adapter_.isSwitching()) { |
1731 return; | 1735 return; |
1732 } | 1736 } |
1733 | 1737 |
1734 var contextType = this.adapter_.contextType; | 1738 var contextType = this.adapter_.contextType; |
1735 var lastKeysetView = this.container_.currentKeysetView; | |
1736 var ret = this.container_.switchToKeyset(this.getRemappedKeyset_(keyset), | 1739 var ret = this.container_.switchToKeyset(this.getRemappedKeyset_(keyset), |
1737 this.title_, this.adapter_.isPasswordBox(), this.adapter_.isA11yMode, | 1740 this.title_, this.adapter_.isPasswordBox(), this.adapter_.isA11yMode, |
1738 keyset, this.contextTypeToLastKeysetMap_[contextType] || | 1741 keyset, this.contextTypeToLastKeysetMap_[contextType] || |
1739 this.getActiveKeyset_(), this.languageCode_); | 1742 this.getActiveKeyset_(), this.languageCode_); |
1740 | 1743 |
1741 if (ret) { | 1744 if (ret) { |
1742 if (!this.isSubKeyset_(this.currentKeyset_, keyset) && | 1745 if (!this.isSubKeyset_(this.currentKeyset_, keyset) && |
1743 keyset != Controller.EMOJI_VIEW_CODE_) { | 1746 keyset != Controller.EMOJI_VIEW_CODE_) { |
1744 // If it is the sub keyset switching, or emoji, don't record it. | 1747 // If it is the sub keyset switching, or emoji, don't record it. |
1745 // Update the keyset of current context type. | 1748 // Update the keyset of current context type. |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2113 toKeyset = this.currentKeyset_.replace('compact', 'en.compact'); | 2116 toKeyset = this.currentKeyset_.replace('compact', 'en.compact'); |
2114 } | 2117 } |
2115 } | 2118 } |
2116 if (toKeyset) { | 2119 if (toKeyset) { |
2117 this.resetAll_(); | 2120 this.resetAll_(); |
2118 this.switchToKeyset(toKeyset); | 2121 this.switchToKeyset(toKeyset); |
2119 } | 2122 } |
2120 } | 2123 } |
2121 }; | 2124 }; |
2122 }); // goog.scope | 2125 }); // goog.scope |
OLD | NEW |