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

Unified Diff: ui/keyboard/resources/elements/kb-key.html

Issue 15176004: Web Component Virtual Keyboard (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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
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>

Powered by Google App Engine
This is Rietveld 408576698