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

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

Issue 46043004: Fixes modifier handling for repeat keys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « ui/keyboard/resources/elements/kb-modifier-key.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-shift-key" 7 <polymer-element name="kb-shift-key"
8 attributes="lowerCaseKeysetId upperCaseKeysetId" 8 attributes="lowerCaseKeysetId upperCaseKeysetId"
9 class="shift dark" char="Shift" on-pointerout="out" extends="kb-key"> 9 class="shift dark" char="Shift" on-pointerout="out" extends="kb-key">
10 <script> 10 <script>
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 return; 137 return;
138 } else { 138 } else {
139 state = KEY_STATES.LOCKED; 139 state = KEY_STATES.LOCKED;
140 detail.toKeyset = this.upperCaseKeysetId; 140 detail.toKeyset = this.upperCaseKeysetId;
141 detail.nextKeyset = undefined; 141 detail.nextKeyset = undefined;
142 } 142 }
143 this.fire('key-longpress', detail); 143 this.fire('key-longpress', detail);
144 }, null, LONGPRESS_DELAY_MSEC); 144 }, null, LONGPRESS_DELAY_MSEC);
145 }, 145 },
146 146
147 // @return Whether the shift modifier is currently active.
148 isActive: function() {
149 return state != KEY_STATES.UNLOCKED;
150 },
151
147 /** 152 /**
148 * Callback function for when a double click is triggered. 153 * Callback function for when a double click is triggered.
149 */ 154 */
150 onDoubleClick: function() { 155 onDoubleClick: function() {
151 state = KEY_STATES.LOCKED; 156 state = KEY_STATES.LOCKED;
152 }, 157 },
153 158
154 /** 159 /**
155 * Notifies shift key that a non-control key was pressed down. 160 * Notifies shift key that a non-control key was pressed down.
156 * A control key is defined as one of shift, control or alt. 161 * A control key is defined as one of shift, control or alt.
157 */ 162 */
158 onNonControlKeyDown: function() { 163 onNonControlKeyDown: function() {
159 switch (state) { 164 switch (state) {
160 case (KEY_STATES.TAPPED): 165 case (KEY_STATES.PRESSED):
161 state = KEY_STATES.UNLOCKED; 166 state = KEY_STATES.CHORDING;
162 break; 167 // Disable longpress timer.
163 case (KEY_STATES.PRESSED): 168 clearTimeout(shiftLongPressTimer);
164 state = KEY_STATES.CHORDING; 169 break;
165 // Disable longpress timer. 170 default:
166 clearTimeout(shiftLongPressTimer); 171 break;
167 break; 172 }
168 default: 173 },
169 break; 174
170 } 175 /**
171 }, 176 * Notifies key that a non-control keyed was typed.
177 * A control key is defined as one of shift, control or alt.
178 */
179 onNonControlKeyTyped: function() {
180 if (state == KEY_STATES.TAPPED)
181 state = KEY_STATES.UNLOCKED;
182 },
172 183
173 /** 184 /**
174 * Callback function for when a space is pressed after punctuation. 185 * Callback function for when a space is pressed after punctuation.
175 * @return {Object} The keyset transitions the keyboard should make. 186 * @return {Object} The keyset transitions the keyboard should make.
176 */ 187 */
177 onSpaceAfterPunctuation: function() { 188 onSpaceAfterPunctuation: function() {
178 var detail = {}; 189 var detail = {};
179 detail.toKeyset = this.upperCaseKeysetId; 190 detail.toKeyset = this.upperCaseKeysetId;
180 detail.nextKeyset = this.lowerCaseKeysetId; 191 detail.nextKeyset = this.lowerCaseKeysetId;
181 state = KEY_STATES.TAPPED; 192 state = KEY_STATES.TAPPED;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 case KEY_STATES.UNLOCKED: 245 case KEY_STATES.UNLOCKED:
235 return this.lowerCaseKeysetId; 246 return this.lowerCaseKeysetId;
236 default: 247 default:
237 return this.upperCaseKeysetId; 248 return this.upperCaseKeysetId;
238 } 249 }
239 }, 250 },
240 }); 251 });
241 })(); 252 })();
242 </script> 253 </script>
243 </polymer-element> 254 </polymer-element>
OLDNEW
« no previous file with comments | « ui/keyboard/resources/elements/kb-modifier-key.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698