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

Unified 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: Fixed nits. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/keyboard/resources/elements/kb-keyboard.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/keyboard/resources/elements/kb-key.html
diff --git a/ui/keyboard/resources/elements/kb-key.html b/ui/keyboard/resources/elements/kb-key.html
index 75033967571603a62532c080254afcb564380718..aafb53b9ff3ba5d01be504f255190456641a0bec 100644
--- a/ui/keyboard/resources/elements/kb-key.html
+++ b/ui/keyboard/resources/elements/kb-key.html
@@ -60,27 +60,50 @@
<polymer-element name="kb-shift-key" attributes="unlockedCase lockedCase"
class="shift dark" char="Shift" extends="kb-key">
<script>
- Polymer('kb-shift-key', {
- /**
- * Defines how capslock effects keyset transition. We always transition
- * from the unlockedCase to the lockedCase if capslock is on.
- * @type {string}
- */
- unlockedCase: 'lower',
- lockedCase: 'upper',
- down: function(event) {
- this.super();
- var detail = {};
- if (this.keysetRules && this.keysetRules.dbl != undefined) {
- detail.char = this.char || this.textContent;
- detail.toKeyset = this.keysetRules.dbl[TO_KEYSET - OFFSET];
- detail.nextKeyset = this.keysetRules.dbl[NEXT_KEYSET - OFFSET];
- }
- this.fire('enable-dbl', detail);
- this.fire('enable-sel');
- },
- });
+ (function () {
+ /**
+ * Uses a closure to define one long press timer among all shift keys
+ * regardless of the layout they are in.
+ * @type {function}
+ */
+ var shiftLongPressTimer = undefined;
+
+ Polymer('kb-shift-key', {
+ /**
+ * Defines how capslock effects keyset transition. We always transition
+ * from the unlockedCase to the lockedCase if capslock is on.
+ * @type {string}
+ */
+ unlockedCase: 'lower',
+ lockedCase: 'upper',
+ control: true,
+
+ down: function(event) {
+ this.super();
+ var detail = {};
+ if (this.keysetRules && this.keysetRules.dbl != undefined) {
+ detail.char = this.char || this.textContent;
+ detail.toKeyset = this.keysetRules.dbl[TO_KEYSET - OFFSET];
+ detail.nextKeyset = this.keysetRules.dbl[NEXT_KEYSET - OFFSET];
+ }
+ this.fire('enable-dbl', detail);
+ this.fire('enable-sel');
+ },
+
+ /**
+ * Overrides longPressTimer for the shift key.
+ */
+ get longPressTimer() {
+ return shiftLongPressTimer;
+ },
+
+ set longPressTimer(timer) {
+ shiftLongPressTimer = timer;
+ },
+ });
+ })();
+
</script>
</polymer-element>
« no previous file with comments | « no previous file | ui/keyboard/resources/elements/kb-keyboard.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698