| Index: third_party/google_input_tools/src/chrome/os/inputview/layouts/material/util.js
|
| diff --git a/third_party/google_input_tools/src/chrome/os/inputview/layouts/util.js b/third_party/google_input_tools/src/chrome/os/inputview/layouts/material/util.js
|
| similarity index 66%
|
| copy from third_party/google_input_tools/src/chrome/os/inputview/layouts/util.js
|
| copy to third_party/google_input_tools/src/chrome/os/inputview/layouts/material/util.js
|
| index 00ca9441ff9066fd1ef1ebc56327ff32e76cfd18..7932dcbe50d814910e7ef0f52682648f7c066cbd 100644
|
| --- a/third_party/google_input_tools/src/chrome/os/inputview/layouts/util.js
|
| +++ b/third_party/google_input_tools/src/chrome/os/inputview/layouts/material/util.js
|
| @@ -1,4 +1,4 @@
|
| -// Copyright 2014 The ChromeOS IME Authors. All Rights Reserved.
|
| +// Copyright 2015 The ChromeOS IME Authors. All Rights Reserved.
|
| // limitations under the License.
|
| // See the License for the specific language governing permissions and
|
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| @@ -11,7 +11,7 @@
|
| // you may not use this file except in compliance with the License.
|
| // Licensed under the Apache License, Version 2.0 (the "License");
|
| //
|
| -goog.provide('i18n.input.chrome.inputview.layouts.util');
|
| +goog.provide('i18n.input.chrome.inputview.layouts.material.util');
|
| goog.require('i18n.input.chrome.inputview.Css');
|
| goog.require('i18n.input.chrome.inputview.elements.ElementType');
|
|
|
| @@ -19,6 +19,7 @@ goog.require('i18n.input.chrome.inputview.elements.ElementType');
|
|
|
| goog.scope(function() {
|
| var ElementType = i18n.input.chrome.inputview.elements.ElementType;
|
| +var material = i18n.input.chrome.inputview.layouts.material;
|
|
|
|
|
| /**
|
| @@ -27,7 +28,7 @@ var ElementType = i18n.input.chrome.inputview.elements.ElementType;
|
| * @type {number}
|
| * @private
|
| */
|
| -i18n.input.chrome.inputview.layouts.util.keyId_ = 0;
|
| +material.util.keyId_ = 0;
|
|
|
|
|
| /**
|
| @@ -35,17 +36,19 @@ i18n.input.chrome.inputview.layouts.util.keyId_ = 0;
|
| *
|
| * @type {string}
|
| */
|
| -i18n.input.chrome.inputview.layouts.util.keyIdPrefix = '';
|
| +material.util.keyIdPrefix = '';
|
| +
|
|
|
| /**
|
| * Resets id counter for keys in preparation for processing a new layout.
|
| * @param {string} prefix The prefix for the key id.
|
| */
|
| -i18n.input.chrome.inputview.layouts.util.setPrefix = function(prefix) {
|
| - i18n.input.chrome.inputview.layouts.util.keyIdPrefix = prefix;
|
| - i18n.input.chrome.inputview.layouts.util.keyId_ = 0;
|
| +material.util.setPrefix = function(prefix) {
|
| + material.util.keyIdPrefix = prefix;
|
| + material.util.keyId_ = 0;
|
| };
|
|
|
| +
|
| /**
|
| * Creates a sequence of key with the same specification.
|
| *
|
| @@ -53,11 +56,11 @@ i18n.input.chrome.inputview.layouts.util.setPrefix = function(prefix) {
|
| * @param {number} num How many keys.
|
| * @return {!Array.<Object>} The keys.
|
| */
|
| -i18n.input.chrome.inputview.layouts.util.createKeySequence = function(spec,
|
| +material.util.createKeySequence = function(spec,
|
| num) {
|
| var sequence = [];
|
| for (var i = 0; i < num; i++) {
|
| - sequence.push(i18n.input.chrome.inputview.layouts.util.createKey(spec));
|
| + sequence.push(material.util.createKey(spec));
|
| }
|
| return sequence;
|
| };
|
| @@ -70,10 +73,10 @@ i18n.input.chrome.inputview.layouts.util.createKeySequence = function(spec,
|
| * @param {string=} opt_id The id.
|
| * @return {!Object} The soft key view.
|
| */
|
| -i18n.input.chrome.inputview.layouts.util.createKey = function(spec, opt_id) {
|
| - var id = i18n.input.chrome.inputview.layouts.util.keyIdPrefix +
|
| - i18n.input.chrome.inputview.layouts.util.keyId_++;
|
| - return i18n.input.chrome.inputview.layouts.util.createElem(
|
| +material.util.createKey = function(spec, opt_id) {
|
| + var id = material.util.keyIdPrefix +
|
| + material.util.keyId_++;
|
| + return material.util.createElem(
|
| ElementType.SOFT_KEY_VIEW, spec, id);
|
| };
|
|
|
| @@ -85,9 +88,9 @@ i18n.input.chrome.inputview.layouts.util.createKey = function(spec, opt_id) {
|
| * @param {string=} opt_id The id.
|
| * @return {!Object} The linear layout.
|
| */
|
| -i18n.input.chrome.inputview.layouts.util.createLinearLayout = function(spec,
|
| +material.util.createLinearLayout = function(spec,
|
| opt_id) {
|
| - return i18n.input.chrome.inputview.layouts.util.createElem(
|
| + return material.util.createElem(
|
| ElementType.LINEAR_LAYOUT, spec, opt_id, spec['iconCssClass']);
|
| };
|
|
|
| @@ -99,9 +102,9 @@ i18n.input.chrome.inputview.layouts.util.createLinearLayout = function(spec,
|
| * @param {string=} opt_id The id.
|
| * @return {!Object} The extended layout.
|
| */
|
| -i18n.input.chrome.inputview.layouts.util.createExtendedLayout = function(spec,
|
| +material.util.createExtendedLayout = function(spec,
|
| opt_id) {
|
| - return i18n.input.chrome.inputview.layouts.util.createElem(
|
| + return material.util.createElem(
|
| ElementType.EXTENDED_LAYOUT, spec, opt_id, spec['iconCssClass']);
|
| };
|
|
|
| @@ -113,9 +116,9 @@ i18n.input.chrome.inputview.layouts.util.createExtendedLayout = function(spec,
|
| * @param {string=} opt_id The id.
|
| * @return {!Object} The handwriting layout.
|
| */
|
| -i18n.input.chrome.inputview.layouts.util.createHandwritingLayout =
|
| +material.util.createHandwritingLayout =
|
| function(spec, opt_id) {
|
| - return i18n.input.chrome.inputview.layouts.util.createElem(
|
| + return material.util.createElem(
|
| ElementType.HANDWRITING_LAYOUT, spec, opt_id);
|
| };
|
|
|
| @@ -127,9 +130,9 @@ i18n.input.chrome.inputview.layouts.util.createHandwritingLayout =
|
| * @param {string=} opt_id The id.
|
| * @return {!Object} The vertical layout.
|
| */
|
| -i18n.input.chrome.inputview.layouts.util.createVerticalLayout = function(spec,
|
| +material.util.createVerticalLayout = function(spec,
|
| opt_id) {
|
| - return i18n.input.chrome.inputview.layouts.util.createElem(
|
| + return material.util.createElem(
|
| ElementType.VERTICAL_LAYOUT, spec, opt_id);
|
| };
|
|
|
| @@ -141,9 +144,9 @@ i18n.input.chrome.inputview.layouts.util.createVerticalLayout = function(spec,
|
| * @param {string=} opt_id The id.
|
| * @return {!Object} The view.
|
| */
|
| -i18n.input.chrome.inputview.layouts.util.createLayoutView = function(spec,
|
| +material.util.createLayoutView = function(spec,
|
| opt_id) {
|
| - return i18n.input.chrome.inputview.layouts.util.createElem(
|
| + return material.util.createElem(
|
| ElementType.LAYOUT_VIEW, spec, opt_id);
|
| };
|
|
|
| @@ -155,9 +158,9 @@ i18n.input.chrome.inputview.layouts.util.createLayoutView = function(spec,
|
| * @param {string=} opt_id The id.
|
| * @return {!Object} The view.
|
| */
|
| -i18n.input.chrome.inputview.layouts.util.createCandidateView = function(spec,
|
| +material.util.createCandidateView = function(spec,
|
| opt_id) {
|
| - return i18n.input.chrome.inputview.layouts.util.createElem(
|
| + return material.util.createElem(
|
| ElementType.CANDIDATE_VIEW, spec, opt_id);
|
| };
|
|
|
| @@ -169,9 +172,9 @@ i18n.input.chrome.inputview.layouts.util.createCandidateView = function(spec,
|
| * @param {string=} opt_id The id.
|
| * @return {!Object} The view.
|
| */
|
| -i18n.input.chrome.inputview.layouts.util.createCanvasView = function(spec,
|
| +material.util.createCanvasView = function(spec,
|
| opt_id) {
|
| - return i18n.input.chrome.inputview.layouts.util.createElem(
|
| + return material.util.createElem(
|
| ElementType.CANVAS_VIEW, spec, opt_id);
|
| };
|
|
|
| @@ -183,9 +186,9 @@ i18n.input.chrome.inputview.layouts.util.createCanvasView = function(spec,
|
| * @param {string=} opt_id The id.
|
| * @return {Object} The keyboard.
|
| */
|
| -i18n.input.chrome.inputview.layouts.util.createKeyboard = function(spec,
|
| +material.util.createKeyboard = function(spec,
|
| opt_id) {
|
| - return i18n.input.chrome.inputview.layouts.util.createElem(
|
| + return material.util.createElem(
|
| ElementType.KEYBOARD, spec, opt_id);
|
| };
|
|
|
| @@ -200,7 +203,7 @@ i18n.input.chrome.inputview.layouts.util.createKeyboard = function(spec,
|
| * @param {i18n.input.chrome.inputview.Css=} opt_iconCssClass The Css class.
|
| * @return {!Object} The element.
|
| */
|
| -i18n.input.chrome.inputview.layouts.util.createElem = function(type, spec,
|
| +material.util.createElem = function(type, spec,
|
| opt_id, opt_iconCssClass) {
|
| var newSpec = {};
|
| for (var key in spec) {
|
|
|