Commit 46cbfd62 authored by vitalyp's avatar vitalyp Committed by Commit bot

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}
parent d610be6f
# 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'],
}
],
}
......@@ -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];
......
......@@ -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)
......
......@@ -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.
......
......@@ -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.
......
......@@ -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
* @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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment