c6c4fe662bfc06afb13518095e4aee82ed9b3d5a
[platform/framework/web/crosswalk.git] / src / ui / keyboard / resources / elements / kb-altkey-container.js
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 Polymer('kb-altkey-container', {
6   resetActiveElement: function() {
7     var activeAccentKeySet = this.querySelector('#' + this.keyset);
8     var offset = activeAccentKeySet.offset;
9     var element = activeAccentKeySet.firstElementChild;
10     while (offset) {
11       element = element.nextElementSibling;
12       offset--;
13     }
14     element.classList.add('active');
15   },
16   up: function(detail) {
17     this.hidden = true;
18     this.resetActiveElement();
19     this.keyset = null;
20   },
21
22   hiddenChanged: function() {
23     this.fire('stateChange', {
24       state: 'candidatePopupVisibility',
25       value: !!this.hidden
26     });
27   },
28 });