summaryrefslogtreecommitdiffstats
path: root/chromium/ui/keyboard/resources/elements/kb-altkey-container.js
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ui/keyboard/resources/elements/kb-altkey-container.js')
-rw-r--r--chromium/ui/keyboard/resources/elements/kb-altkey-container.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/chromium/ui/keyboard/resources/elements/kb-altkey-container.js b/chromium/ui/keyboard/resources/elements/kb-altkey-container.js
new file mode 100644
index 00000000000..a184348a4a0
--- /dev/null
+++ b/chromium/ui/keyboard/resources/elements/kb-altkey-container.js
@@ -0,0 +1,35 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+Polymer('kb-altkey-container', {
+ resetActiveElement: function() {
+ var activeAccentKeySet = this.querySelector('#' + this.keyset);
+ var offset = activeAccentKeySet.offset;
+ var element = activeAccentKeySet.firstElementChild;
+ while (offset) {
+ element = element.nextElementSibling;
+ offset--;
+ }
+ element.classList.add('active');
+ },
+ up: function(detail) {
+ this.hidden = true;
+ this.resetActiveElement();
+ this.keyset = null;
+ },
+ out: function(event) {
+ // Check if touch is outside container boundaries.
+ if(!(this.compareDocumentPosition(event.relatedTarget)
+ & Node.DOCUMENT_POSITION_CONTAINED_BY)) {
+ this.hidden = true;
+ }
+ },
+
+ hiddenChanged: function() {
+ this.fire('stateChange', {
+ state: 'candidatePopupVisibility',
+ value: !!this.hidden
+ });
+ },
+});