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

Unified 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, 2 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
« no previous file with comments | « ui/keyboard/resources/elements/kb-modifier-key.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/keyboard/resources/elements/kb-shift-key.html
diff --git a/ui/keyboard/resources/elements/kb-shift-key.html b/ui/keyboard/resources/elements/kb-shift-key.html
index b2dac6b1ed537dcf48ae9c0f257936c3c17a3c83..12f568cd0e86309d645d04c47848c05799712a15 100644
--- a/ui/keyboard/resources/elements/kb-shift-key.html
+++ b/ui/keyboard/resources/elements/kb-shift-key.html
@@ -144,6 +144,11 @@
}, null, LONGPRESS_DELAY_MSEC);
},
+ // @return Whether the shift modifier is currently active.
+ isActive: function() {
+ return state != KEY_STATES.UNLOCKED;
+ },
+
/**
* Callback function for when a double click is triggered.
*/
@@ -156,19 +161,25 @@
* A control key is defined as one of shift, control or alt.
*/
onNonControlKeyDown: function() {
- switch (state) {
- case (KEY_STATES.TAPPED):
- state = KEY_STATES.UNLOCKED;
- break;
- case (KEY_STATES.PRESSED):
- state = KEY_STATES.CHORDING;
- // Disable longpress timer.
- clearTimeout(shiftLongPressTimer);
- break;
- default:
- break;
- }
- },
+ switch (state) {
+ case (KEY_STATES.PRESSED):
+ state = KEY_STATES.CHORDING;
+ // Disable longpress timer.
+ clearTimeout(shiftLongPressTimer);
+ break;
+ default:
+ break;
+ }
+ },
+
+ /**
+ * Notifies key that a non-control keyed was typed.
+ * A control key is defined as one of shift, control or alt.
+ */
+ onNonControlKeyTyped: function() {
+ if (state == KEY_STATES.TAPPED)
+ state = KEY_STATES.UNLOCKED;
+ },
/**
* Callback function for when a space is pressed after punctuation.
« 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