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 |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6d4df01352aea50ca3c8b5ffa6dcdcdbd72c5620 |
--- /dev/null |
+++ b/ui/keyboard/resources/elements/kb-key.html |
@@ -0,0 +1,56 @@ |
+<!-- |
+ -- Copyright (c) 2013 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. |
+ --> |
+ |
+<element name="kb-key" attributes="to char repeat" on-pointerdown="down" |
+ on-pointerup="up"> |
+ <template> |
+ <style> |
+ @host { |
+ * { |
+ -webkit-box-flex: 1; |
+ display: -webkit-box; |
+ position: relative; |
+ background-position: center center; |
+ background-repeat: no-repeat; |
+ background-size: contain; |
+ } |
+ } |
+ .key { |
+ bottom: 0; |
+ left: 0; |
+ height: 1.2em; |
+ margin: auto; |
+ position: absolute; |
+ right: 0; |
+ top: 0; |
+ text-align: center; |
+ } |
+ </style> |
+ <div id="key" class="key"> |
+ <content></content> |
+ </div> |
+ </template> |
+ <script> |
+ Polymer.register(this, { |
+ repeat: false, |
+ down: function(event) { |
+ var detail = { |
+ char: this.char || this.textContent, |
+ to: this.to, |
+ repeat: this.repeat |
+ }; |
+ this.send('key-down', detail); |
+ }, |
+ up: function(event) { |
+ var detail = { |
+ char: this.char || this.textContent, |
+ to: this.to |
+ }; |
+ this.send('key-up', detail); |
+ } |
+ }); |
+ </script> |
+</element> |