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

Unified Diff: ui/keyboard/resources/elements/kb-keyboard.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: Fixed nit. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/keyboard/resources/elements/kb-key.html ('k') | ui/keyboard/resources/elements/kb-keyset.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/keyboard/resources/elements/kb-keyboard.html
diff --git a/ui/keyboard/resources/elements/kb-keyboard.html b/ui/keyboard/resources/elements/kb-keyboard.html
index d47ca6d9ebe97e7388686a85e0ac549e215e6f8b..ca3cbdd927f7cd3417f488135ad36b7cb1bd96ca 100644
--- a/ui/keyboard/resources/elements/kb-keyboard.html
+++ b/ui/keyboard/resources/elements/kb-keyboard.html
@@ -26,7 +26,7 @@
-- allowing the shift and spacebar keys to be common across multiple
-- keyboard layouts.
-->
- <content id="content" select="#{{layout}}-{{keyset}}"></content>
+ <content id="content"></content>
<kb-keyboard-overlay id="overlay" hidden></kb-keyboard-overlay>
<kb-key-codes id="keyCodeMetadata"></kb-key-codes>
</template>
@@ -337,40 +337,23 @@
return false;
},
+ keysetChanged: function() {
+ var keyset = this.activeKeyset;
+ // Show the keyset if it has been initialized.
+ if (keyset)
+ keyset.show();
+ },
+
ready: function() {
this.voiceInput_ = new VoiceInput(this);
this.swipeHandler = this.move.bind(this);
},
/**
- * Registers a callback for state change events. Lazy initializes a
- * mutation observer used to detect when the keyset selection is changed.
+ * Registers a callback for state change events.
* @param{!Function} callback Callback function to register.
*/
addKeysetChangedObserver: function(callback) {
- if (!this.keysetChangedObserver) {
- var target = this.$.content;
- var self = this;
- var observer = new MutationObserver(function(mutations) {
- mutations.forEach(function(m) {
- if (m.type == 'attributes' && m.attributeName == 'select') {
- var value = m.target.getAttribute('select');
- self.fire('stateChange', {
- state: 'keysetChanged',
- value: value
- });
- }
- });
- });
-
- observer.observe(target, {
- attributes: true,
- childList: true,
- subtree: true
- });
- this.keysetChangedObserver = observer;
-
- }
this.addEventListener('stateChange', callback);
},
@@ -833,6 +816,9 @@
});
}
}
+ // New keyset has already been loaded, can show immediately.
+ } else {
+ this.activeKeyset.show();
}
},
@@ -897,8 +883,12 @@
var keyset = this.activeKeyset;
if (!keyset)
return false;
- var content = this.$.content.getDistributedNodes()[0];
- return content == keyset;
+ var nodes = this.$.content.getDistributedNodes();
+ for (var i = 0; i < nodes.length; i++) {
+ if (nodes[i].id && nodes[i].id == keyset.id)
+ return true;
+ }
+ return false;
},
/**
« no previous file with comments | « ui/keyboard/resources/elements/kb-key.html ('k') | ui/keyboard/resources/elements/kb-keyset.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698