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

Unified Diff: ui/keyboard/resources/elements/kb-keyboard.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-key-codes.html ('k') | ui/keyboard/resources/elements/kb-keyset.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/keyboard/resources/elements/kb-keyboard.html
diff --git a/ui/keyboard/resources/elements/kb-keyboard.html b/ui/keyboard/resources/elements/kb-keyboard.html
index adc05b39c9320c197f202b6283e73f560b74f091..b04713872b18cdbe3ec2379227fd8b239b6db872 100644
--- a/ui/keyboard/resources/elements/kb-keyboard.html
+++ b/ui/keyboard/resources/elements/kb-keyboard.html
@@ -369,6 +369,7 @@
return;
if (detail.repeat) {
this.keyTyped(detail);
+ this.onNonControlKeyTyped();
repeatKey.key = this.lastPressedKey;
var self = this;
repeatKey.timer = setTimeout(function() {
@@ -546,12 +547,7 @@
}
if(!this.keyTyped(detail))
insertText(char);
- if (this.ctrl)
- this.ctrl.onNonControlKeyUp();
- if (this.alt)
- this.alt.onNonControlKeyUp();
- this.classList.remove('ctrl-active');
- this.classList.remove('alt-active');
+ this.onNonControlKeyTyped();
},
/*
@@ -612,6 +608,22 @@
},
/**
+ * Notifies the modifier keys that a non-control key was typed. This
+ * lets them reset sticky behaviour. A non-control key is defined as
+ * any key that is not Control, Alt, or Shift.
+ */
+ onNonControlKeyTyped: function() {
+ if (this.shift)
+ this.shift.onNonControlKeyTyped();
+ if (this.ctrl)
+ this.ctrl.onNonControlKeyTyped();
+ if (this.alt)
+ this.alt.onNonControlKeyTyped();
+ this.classList.remove('ctrl-active');
+ this.classList.remove('alt-active');
+ },
+
+ /**
* Indicate if the keyboard is ready for user input.
* @type {boolean}
*/
@@ -663,6 +675,8 @@
*/
keyTyped: function(detail) {
var builder = this.$.keyCodeMetadata;
+ if (this.shift)
+ detail.shiftModifier = this.shift.isActive();
if (this.ctrl)
detail.controlModifier = this.ctrl.isActive();
if (this.alt)
« no previous file with comments | « ui/keyboard/resources/elements/kb-key-codes.html ('k') | ui/keyboard/resources/elements/kb-keyset.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698