1 <!-- 2 -- Copyright 2013 The Chromium Authors. All rights reserved. 3 -- Use of this source code is governed by a BSD-style license that can be 4 -- found in the LICENSE file. 5 --> 6 7 <polymer-element name="kb-altkey-container" attributes="keyset" 8 on-pointerup="{{up}}"> 9 <template> 10 <style> 11 :host { 12 -webkit-box-flex: 1; 13 background-color: rgba(0, 0, 0, 0.6); 14 bottom: 0; 15 left: 0; 16 position: absolute; 17 right: 0; 18 top: 0; 19 } 20 </style> 21 <content select="#{{keyset}}"></content> 22 </template> 23 <script> 24 Polymer('kb-altkey-container', { 25 resetActiveElement: function() { 26 var activeAccentKeySet = this.querySelector('#' + this.keyset); 27 var offset = activeAccentKeySet.offset; 28 var element = activeAccentKeySet.firstElementChild; 29 while (offset) { 30 element = element.nextElementSibling; 31 offset--; 32 } 33 element.classList.add('active'); 34 }, 35 up: function(detail) { 36 this.hidden = true; 37 this.resetActiveElement(); 38 this.keyset = null; 39 }, 40 41 hiddenChanged: function() { 42 this.fire('stateChange', { 43 state: 'candidatePopupVisibility', 44 value: !!this.hidden 45 }); 46 }, 47 }); 48 </script> 49 </polymer-element> 50