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

Side by Side Diff: ui/keyboard/resources/main.js

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: Uses children. 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
« no previous file with comments | « ui/keyboard/resources/elements/kb-keyset.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var onResize = function() { 5 var onResize = function() {
6 var x = window.innerWidth; 6 var x = window.innerWidth;
7 var y = window.innerHeight; 7 var y = window.innerHeight;
8 var height = (x > ASPECT_RATIO * y) ? y : Math.floor(x / ASPECT_RATIO); 8 var height = (x > ASPECT_RATIO * y) ? y : Math.floor(x / ASPECT_RATIO);
9 keyboard.style.height = height + 'px'; 9 keyboard.style.height = height + 'px';
10 keyboard.style.width = Math.floor(ASPECT_RATIO * height) + 'px'; 10 keyboard.style.width = Math.floor(ASPECT_RATIO * height) + 'px';
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 /** 46 /**
47 * Flatten the keysets which represents a keyboard layout. It has two steps: 47 * Flatten the keysets which represents a keyboard layout. It has two steps:
48 * 1) Replace all kb-key-import elements with imported document that associated 48 * 1) Replace all kb-key-import elements with imported document that associated
49 * with linkid. 49 * with linkid.
50 * 2) Replace all kb-key-sequence elements with generated DOM structures. 50 * 2) Replace all kb-key-sequence elements with generated DOM structures.
51 * @param {!Document} content Document to process. 51 * @param {!Document} content Document to process.
52 */ 52 */
53 function flattenKeysets(content) { 53 function flattenKeysets(content) {
54 var importedContent = importHTML(content); 54 var importedContent = importHTML(content);
55 expandHTML(importedContent); 55 expandHTML(importedContent);
56 var rows = importedContent.querySelectorAll('kb-row');
57 for (var i = 0 ; i < rows.length; i++) {
58 var allKeys = rows[i].children;
59 for (var j = 0; j< allKeys.length; j++) {
60 var weight = allKeys[j].getAttribute('weight');
61 if (weight) {
62 allKeys[j].style.webkitBoxFlex = weight;
63 }
kevers 2014/01/17 18:50:30 nit: Remove brackets.
rsadam 2014/01/17 19:12:33 Done.
64 }
65 }
56 return importedContent; 66 return importedContent;
57 } 67 }
58 68
59 addEventListener('resize', onResize); 69 addEventListener('resize', onResize);
60 70
61 addEventListener('load', onResize); 71 addEventListener('load', onResize);
62 72
63 // Prevents all default actions of touch. Keyboard should use its own gesture 73 // Prevents all default actions of touch. Keyboard should use its own gesture
64 // recognizer. 74 // recognizer.
65 addEventListener('touchstart', function(e) { e.preventDefault() }); 75 addEventListener('touchstart', function(e) { e.preventDefault() });
66 addEventListener('touchend', function(e) { e.preventDefault() }); 76 addEventListener('touchend', function(e) { e.preventDefault() });
67 addEventListener('touchmove', function(e) { e.preventDefault() }); 77 addEventListener('touchmove', function(e) { e.preventDefault() });
OLDNEW
« no previous file with comments | « ui/keyboard/resources/elements/kb-keyset.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698