summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvitalyp <vitalyp@chromium.org>2014-09-23 16:18:10 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-23 23:18:36 +0000
commit46cbfd62f398472650985747d459bb7869578918 (patch)
tree9d343af15f2a2b186a765f6fa6bcf60c7c7ef0bc
parentd610be6f1c292e500100f6a3579673add6b5905f (diff)
downloadchromium_src-46cbfd62f398472650985747d459bb7869578918.zip
chromium_src-46cbfd62f398472650985747d459bb7869578918.tar.gz
chromium_src-46cbfd62f398472650985747d459bb7869578918.tar.bz2
Compile ui/keyboard/ JS, part 1: remove all warnings
R=bshe@chromium.org BUG=393873 TEST=GYP_GENERATORS=ninja gyp --depth . ui/keyboard/resources/compiled_resources.gyp && ninja -C out/Default | grep WARNING Review URL: https://codereview.chromium.org/594603002 Cr-Commit-Position: refs/heads/master@{#296296}
-rw-r--r--ui/keyboard/resources/compiled_resources.gyp11
-rw-r--r--ui/keyboard/resources/elements/kb-altkey-data.js2
-rw-r--r--ui/keyboard/resources/elements/kb-key-base.js2
-rw-r--r--ui/keyboard/resources/elements/kb-keyboard.js2
-rw-r--r--ui/keyboard/resources/main.js6
-rw-r--r--ui/keyboard/resources/touch_fuzzing.js52
6 files changed, 45 insertions, 30 deletions
diff --git a/ui/keyboard/resources/compiled_resources.gyp b/ui/keyboard/resources/compiled_resources.gyp
new file mode 100644
index 0000000..4830be1
--- /dev/null
+++ b/ui/keyboard/resources/compiled_resources.gyp
@@ -0,0 +1,11 @@
+# Copyright 2014 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.
+{
+ 'targets': [
+ {
+ 'target_name': 'keyboard',
+ 'includes': ['../../../third_party/closure_compiler/compile_js.gypi'],
+ }
+ ],
+}
diff --git a/ui/keyboard/resources/elements/kb-altkey-data.js b/ui/keyboard/resources/elements/kb-altkey-data.js
index e45cb31..c8cdb97 100644
--- a/ui/keyboard/resources/elements/kb-altkey-data.js
+++ b/ui/keyboard/resources/elements/kb-altkey-data.js
@@ -31,7 +31,7 @@
* @param {boolean=} opt_force If true, force the creation of a list
* even if empty. Used when constructing a set of alternates for keys
* with hintTexts.
- * @return {?Object.{id: string, list: string}}
+ * @return {?{id: string, list: string}}
*/
getAltkeys: function(char, opt_force) {
var id = idMap[char];
diff --git a/ui/keyboard/resources/elements/kb-key-base.js b/ui/keyboard/resources/elements/kb-key-base.js
index ed6b527..ca08a94 100644
--- a/ui/keyboard/resources/elements/kb-key-base.js
+++ b/ui/keyboard/resources/elements/kb-key-base.js
@@ -172,7 +172,7 @@ Polymer('kb-key-base', {
/**
* Handles a swipe flick that originated from this key.
- * @param {detail} The details of the swipe.
+ * @param {detail} detail The details of the swipe.
*/
onFlick: function(detail) {
if (!(detail.direction & SwipeDirection.UP) || !this.hintTextValue)
diff --git a/ui/keyboard/resources/elements/kb-keyboard.js b/ui/keyboard/resources/elements/kb-keyboard.js
index 5933271..bf8e33c 100644
--- a/ui/keyboard/resources/elements/kb-keyboard.js
+++ b/ui/keyboard/resources/elements/kb-keyboard.js
@@ -746,7 +746,7 @@ Polymer('kb-keyboard', {
this.onNonControlKeyTyped();
},
- /*
+ /**
* Handles key-longpress event that is sent by kb-key-base.
* @param {CustomEvent} event The key-longpress event dispatched by
* kb-key-base.
diff --git a/ui/keyboard/resources/main.js b/ui/keyboard/resources/main.js
index 76306b0..b90f1b8 100644
--- a/ui/keyboard/resources/main.js
+++ b/ui/keyboard/resources/main.js
@@ -421,7 +421,7 @@
* Realigns a given row based on the parameters provided.
* @param {!kb-row} row The row to realign.
* @param {!AlignmentOptions} params The parameters used to align the keyset.
- * @param {number} The height of the keys.
+ * @param {number} keyHeight The height of the keys.
* @param {number} heightOffset The offset caused by rows above it.
*/
function realignRow(row, params, keyHeight, heightOffset) {
@@ -536,7 +536,7 @@
exports.recordKeysets();
}
- /*
+ /**
* Realigns a given keyset.
* @param {Object} keyset The keyset to realign.
* @param {!AlignmentOptions} params The parameters used to align the keyset.
@@ -545,7 +545,7 @@
var rows = keyset.querySelectorAll('kb-row').array();
keyset.style.fontSize = (params.availableHeight /
FONT_SIZE_RATIO / rows.length) + 'px';
- var heightOffset = 0;
+ var heightOffset = 0;
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
var rowHeight =
diff --git a/ui/keyboard/resources/touch_fuzzing.js b/ui/keyboard/resources/touch_fuzzing.js
index 7a6a2ce..2e1cd76 100644
--- a/ui/keyboard/resources/touch_fuzzing.js
+++ b/ui/keyboard/resources/touch_fuzzing.js
@@ -71,7 +71,7 @@
if (!key)
return;
// Ignore touches that aren't close.
- return key.distanceTo(x,y) <= MAX_TOUCH_FUZZ_DISTANCE ?
+ return key.distanceTo(x, y) <= MAX_TOUCH_FUZZ_DISTANCE ?
key.key : null;
},
@@ -88,11 +88,13 @@
/**
* Container for caching a key's data.
- * @param {Object} key The key to cache.
- * @param {number} left The x-coordinate of the left edge of the key.
- * @param {number} top The y-coordinate of the top edge of the key.
- * @param {number} width The width of the key in px.
- * @param {number} height The height of the key in px.
+ * @param {{style: {left: number, top: number, width: number,
+ * height: number}}} key The key to cache.
+ * left: The x-coordinate of the left edge of the key.
+ * top: The y-coordinate of the top edge of the key.
+ * width: The width of the key in px.
+ * height: The height of the key in px.
+ * @constructor
*/
var Key = function(key) {
this.key = key;
@@ -109,9 +111,9 @@
* Manhattan distance from the the provided point to the key.
* @param {number} x The x-coordinate of the point.
* @param {number} y The y-coordinate of the point.
- * @return {number}.
+ * @return {number}
*/
- distanceTo: function (x, y) {
+ distanceTo: function(x, y) {
return Math.abs(this.intersect(new Line(x))) +
Math.abs(this.intersect(new Line(y, true)));
},
@@ -144,9 +146,10 @@
/**
* Object representing the line y = c or x = c.
- * @param {number} The x or y coordinate of the intersection line depending on
- * on orientation.
+ * @param {number} c The x or y coordinate of the intersection line depending
+ * on orientation.
* @param {Orientation} orientation The orientation of the line.
+ * @constructor
*/
var Line = function(c, orientation) {
this.c = c;
@@ -161,12 +164,12 @@
* @return {number} Zero if they intersect, negative if the point is before
* the line, positive if it's after.
*/
- testPoint: function (x, y) {
+ testPoint: function(x, y) {
var c = this.rotated ? y : x;
return this.c == c ? 0 : c - this.c;
},
- test: function (key) {
+ test: function(key) {
// Key already provides an intersect method. If the key is to the right of
// the line, then the line is to the left of the key.
return -1 * key.intersect(this);
@@ -175,7 +178,8 @@
/**
* A node used to split 2D space.
- * @param {Line} The line to split the space with.
+ * @param {Line} line The line to split the space with.
+ * @constructor
*/
var DecisionNode = function(line) {
this.decision = line;
@@ -207,8 +211,8 @@
* @return {DecisionNode | LeafNode}
*/
findClosestNode: function(x, y) {
- return this.search(function(node){
- return node.decision.testPoint(x,y) >= 0;
+ return this.search(function(node) {
+ return node.decision.testPoint(x, y) >= 0;
});
},
@@ -221,7 +225,7 @@
return;
var pass = [];
var fail = [];
- for (var i = 0; i< data.length; i++) {
+ for (var i = 0; i < data.length; i++) {
var result = this.decision.test(data[i]);
// Add to both branches if result == 0.
if (result >= 0)
@@ -239,7 +243,7 @@
if (array.length == 1) {
return new LeafNode(array[0]);
} else {
- var splits = findSplits(array, !currentRotation)
+ var splits = findSplits(array, !currentRotation);
var tree = createBinaryTree(0, splits.length - 1, splits);
tree.populate(array);
return tree;
@@ -265,7 +269,7 @@
* Searches for the first leaf that matches the search function.
* @param {Function<DecisionNode>: Boolean} searchFn The function used to
* determine whether to search in the left or right subtree.
- * @param {DecisionNode | LeafNode} The node that most closely matches the
+ * @return {DecisionNode | LeafNode} The node that most closely matches the
* search parameters.
*/
search: function(searchFn) {
@@ -281,7 +285,7 @@
* @return {boolean} Whether it belongs in the right branch.
*/
test: function(key) {
- return this.decision.testKey(key)
+ return this.decision.testKey(key);
},
};
@@ -318,14 +322,14 @@
/**
* Calculates the optimum split points on the specified axis.
- * @param {Array<Keys>} allKeys All keys in the keyset.
- * @param {Partition=} axis Whether to split on the y-axis instead.
- * @return {Array<Line>} The optimum split points.
+ * @param {Array.<Keys>} allKeys All keys in the keyset.
+ * @param {Orientation} orientation Whether to split on the y-axis instead.
+ * @return {Array.<Line>} The optimum split points.
*/
var findSplits = function(allKeys, orientation) {
/**
* Returns the minimum edge on the key.
- * @param {Key} The key.
+ * @param {Key} key The key.
* @return {number}
*/
var getMin = function(key) {
@@ -334,7 +338,7 @@
/**
* Returns the maximum edge on the key.
- * @param {Key} The key.
+ * @param {Key} key The key.
*/
var getMax = function(key) {
return orientation == Orientation.HORIZONTAL ? key.bottom : key.right;