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

Side by Side Diff: ui/keyboard/resources/elements/kb-key.html

Issue 23621045: Layout transitions triggered on key-down instead of key-up. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor style fixes. Created 7 years, 3 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 unified diff | Download patch
OLDNEW
1 <!-- 1 <!--
2 -- Copyright 2013 The Chromium Authors. All rights reserved. 2 -- Copyright 2013 The Chromium Authors. All rights reserved.
3 -- Use of this source code is governed by a BSD-style license that can be 3 -- Use of this source code is governed by a BSD-style license that can be
4 -- found in the LICENSE file. 4 -- found in the LICENSE file.
5 --> 5 -->
6 6
7 <polymer-element name="kb-key" extends="kb-key-base" 7 <polymer-element name="kb-key" extends="kb-key-base"
8 attributes="keyCode shiftModifier weight"> 8 attributes="keyCode shiftModifier weight">
9 <template> 9 <template>
10 <style> 10 <style>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 }, 53 },
54 }); 54 });
55 </script> 55 </script>
56 </polymer-element> 56 </polymer-element>
57 57
58 <!-- Special keys --> 58 <!-- Special keys -->
59 59
60 <polymer-element name="kb-shift-key" attributes="unlockedCase lockedCase" 60 <polymer-element name="kb-shift-key" attributes="unlockedCase lockedCase"
61 class="shift dark" char="Shift" extends="kb-key"> 61 class="shift dark" char="Shift" extends="kb-key">
62 <script> 62 <script>
63 Polymer('kb-shift-key', {
64 /**
65 * Defines how capslock effects keyset transition. We always transition
66 * from the unlockedCase to the lockedCase if capslock is on.
67 * @type {string}
68 */
69 unlockedCase: 'lower',
70 lockedCase: 'upper',
71 63
72 down: function(event) { 64 (function () {
73 this.super(); 65 /**
74 var detail = {}; 66 * Uses a closure to define one long press timer among all shift keys
75 if (this.keysetRules && this.keysetRules.dbl != undefined) { 67 * regardless of the layout they are in.
76 detail.char = this.char || this.textContent; 68 */
77 detail.toKeyset = this.keysetRules.dbl[TO_KEYSET - OFFSET]; 69 shiftLongPressTimer = undefined;
bshe 2013/09/16 17:52:01 var shiftLongPressTimer = undefined and @type {fun
rsadam 2013/09/16 18:23:49 Done.
78 detail.nextKeyset = this.keysetRules.dbl[NEXT_KEYSET - OFFSET]; 70
79 } 71 Polymer('kb-shift-key', {
80 this.fire('enable-dbl', detail); 72 /**
81 this.fire('enable-sel'); 73 * Defines how capslock effects keyset transition. We always transition
82 }, 74 * from the unlockedCase to the lockedCase if capslock is on.
83 }); 75 * @type {string}
76 */
77 unlockedCase: 'lower',
78 lockedCase: 'upper',
79 control: true,
80
81 down: function(event) {
82 this.super();
83 var detail = {};
84 if (this.keysetRules && this.keysetRules.dbl != undefined) {
85 detail.char = this.char || this.textContent;
86 detail.toKeyset = this.keysetRules.dbl[TO_KEYSET - OFFSET];
87 detail.nextKeyset = this.keysetRules.dbl[NEXT_KEYSET - OFFSET];
88 }
89 this.fire('enable-dbl', detail);
90 this.fire('enable-sel');
91 },
92
93 /**
94 * Overrides longPressTimer for the shift key.
95 */
96 get longPressTimer() {
97 return shiftLongPressTimer;
98 },
99
100 set longPressTimer(timer) {
101 shiftLongPressTimer = timer;
102 },
103 });
104
bshe 2013/09/16 17:52:01 nit: remove the empty line and indent seems off ne
rsadam 2013/09/16 18:23:49 Done.
105 })();
106
84 </script> 107 </script>
85 </polymer-element> 108 </polymer-element>
86 109
87 <!-- 110 <!--
88 -- TODO(kevers): Display popup menu for selecting layout on keypress. Display 111 -- TODO(kevers): Display popup menu for selecting layout on keypress. Display
89 -- code for keyboard layout in place of image. 112 -- code for keyboard layout in place of image.
90 --> 113 -->
91 <polymer-element name="kb-layout-selector" class="layout-selector dark" char="In valid" 114 <polymer-element name="kb-layout-selector" class="layout-selector dark" char="In valid"
92 extends="kb-key"> 115 extends="kb-key">
93 <script> 116 <script>
94 Polymer('kb-layout-selector', { 117 Polymer('kb-layout-selector', {
95 toLayout: 'qwerty' 118 toLayout: 'qwerty'
96 }); 119 });
97 </script> 120 </script>
98 </polymer-element> 121 </polymer-element>
OLDNEW
« no previous file with comments | « no previous file | ui/keyboard/resources/elements/kb-keyboard.html » ('j') | ui/keyboard/resources/elements/kb-keyboard.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698