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

Side by Side Diff: ui/keyboard/resources/elements/kb-keyset.html

Issue 140123002: Work around for content select not supporting touch events on it's children. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 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 unified diff | Download patch
OLDNEW
1 <!-- 1 <!--
2 -- Copyright 2013 The Chromium Authors. All rights reserved. 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 3 -- Use of this source code is governed by a BSD-style license that can be
4 -- found in the LICENSE file. 4 -- found in the LICENSE file.
5 --> 5 -->
6 6
7 <polymer-element name="kb-keyset" attributes="nextKeyset isDefault" 7 <polymer-element name="kb-keyset" attributes="nextKeyset isDefault"
8 on-key-up="{{keyUp}}" on-key-longpress="{{keyLongpress}}"> 8 on-key-up="{{keyUp}}" on-key-longpress="{{keyLongpress}}">
9 <template> 9 <template>
10 <style> 10 <style>
11 :host { 11 :host {
12 -webkit-box-flex: 1; 12 -webkit-box-flex: 1;
13 -webkit-box-orient: vertical; 13 -webkit-box-orient: vertical;
14 display: -webkit-box; 14 display: -webkit-box;
15 } 15 }
16 :host:not(.activeKeyset) {
17 display: none;
18 }
16 </style> 19 </style>
17 <content select="kb-row"></content> 20 <content select="kb-row"></content>
18 <content select="kb-altkey-container" id="altkeyContainer" 21 <content select="kb-altkey-container" id="altkeyContainer"
19 touch-action="none"></content> 22 touch-action="none"></content>
20 <kb-altkey-data id="altkeyMetadata"></kb-altkey-data> 23 <kb-altkey-data id="altkeyMetadata"></kb-altkey-data>
21 </template> 24 </template>
22 <script> 25 <script>
23 Polymer('kb-keyset', { 26 Polymer('kb-keyset', {
24 isDefault: false, 27 isDefault: false,
25 nextKeyset: undefined, 28 nextKeyset: undefined,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 activeAltKeySet.style.width = event.target.clientWidth * 73 activeAltKeySet.style.width = event.target.clientWidth *
71 activeAltKeySet.childElementCount + 'px'; 74 activeAltKeySet.childElementCount + 'px';
72 activeAltKeySet.style.height = event.target.clientHeight + 'px'; 75 activeAltKeySet.style.height = event.target.clientHeight + 'px';
73 activeAltKeySet.style.top = event.target.offsetTop + 'px'; 76 activeAltKeySet.style.top = event.target.offsetTop + 'px';
74 var leftOffset = activeAltKeySet.offset * event.target.clientWidth; 77 var leftOffset = activeAltKeySet.offset * event.target.clientWidth;
75 activeAltKeySet.style.left = event.target.offsetLeft - leftOffset + 78 activeAltKeySet.style.left = event.target.offsetLeft - leftOffset +
76 'px'; 79 'px';
77 var nodes = activeAltKeySet.childNodes; 80 var nodes = activeAltKeySet.childNodes;
78 nodes[activeAltKeySet.offset].classList.add('active'); 81 nodes[activeAltKeySet.offset].classList.add('active');
79 altkeyContainer.hidden = false; 82 altkeyContainer.hidden = false;
80 } 83 },
84
85 show: function() {
86 this.classList.add('activeKeyset');
kevers 2014/01/15 23:33:07 Worth checking if you're already active. This met
rsadam 2014/01/17 15:43:53 Done.
87 this.fire('stateChange', {
88 state: 'keysetChanged',
89 value: this.id
90 });
91 },
92
93 hide: function() {
94 this.classList.remove('activeKeyset');
95 },
96
97 enteredView: function() {
98 // TODO(rsadam): Fix the stutter when a keyset is first loaded. Should
99 // be fixable after pixel perfect lands.
100 if (this.isDefault)
kevers 2014/01/15 23:33:07 The stutter can be addressed by doing the equivale
rsadam 2014/01/17 15:43:53 Didn't have luck with veil/unveil. endOrMicroTask
101 this.show();
102 },
81 }); 103 });
82 </script> 104 </script>
83 </polymer-element> 105 </polymer-element>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698