Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / third_party / google_input_tools / src / chrome / os / inputview / layouts / compactspacerow.js
1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved.
2 // limitations under the License.
3 // See the License for the specific language governing permissions and
4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5 // distributed under the License is distributed on an "AS-IS" BASIS,
6 // Unless required by applicable law or agreed to in writing, software
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // You may obtain a copy of the License at
11 // you may not use this file except in compliance with the License.
12 // Licensed under the Apache License, Version 2.0 (the "License");
13 //
14 goog.provide('i18n.input.chrome.inputview.layouts.CompactSpaceRow');
15
16 goog.require('i18n.input.chrome.inputview.ConditionName');
17 goog.require('i18n.input.chrome.inputview.layouts.util');
18
19
20 /**
21  * Creates the compact keyboard spaceKey row.
22  * @param {boolean} isNordic True if the space key row is generated for compact
23  *     nordic layout.
24  * @return {!Object} The compact spaceKey row.
25  */
26 i18n.input.chrome.inputview.layouts.CompactSpaceRow.create = function(
27     isNordic) {
28   var digitSwitcher = i18n.input.chrome.inputview.layouts.util.createKey({
29     'widthInWeight': 1.1
30   });
31   var globeOrSymbolKey = i18n.input.chrome.inputview.layouts.util.createKey({
32     'condition': i18n.input.chrome.inputview.ConditionName.SHOW_GLOBE_OR_SYMBOL,
33     'widthInWeight': 1
34   });
35   var menuKey = i18n.input.chrome.inputview.layouts.util.createKey({
36     'condition': i18n.input.chrome.inputview.ConditionName.SHOW_MENU,
37     'widthInWeight': 1
38   });
39   var slashKey = i18n.input.chrome.inputview.layouts.util.createKey({
40     'widthInWeight': 1
41   });
42   var space;
43   if (isNordic) {
44     space = i18n.input.chrome.inputview.layouts.util.createKey({
45       'widthInWeight': 5
46     });
47   } else {
48     space = i18n.input.chrome.inputview.layouts.util.createKey({
49       'widthInWeight': 4
50     });
51   }
52   var comma = i18n.input.chrome.inputview.layouts.util.createKey({
53     'widthInWeight': 1
54   });
55   var period = i18n.input.chrome.inputview.layouts.util.createKey({
56     'widthInWeight': 1
57   });
58   var hide = i18n.input.chrome.inputview.layouts.util.createKey({
59     'widthInWeight': 1.1
60   });
61
62   menuKey['spec']['giveWeightTo'] = space['spec']['id'];
63   globeOrSymbolKey['spec']['giveWeightTo'] = space['spec']['id'];
64
65   var spaceKeyRow = i18n.input.chrome.inputview.layouts.util.
66       createLinearLayout({
67         'id': 'spaceKeyrow',
68         'children': [digitSwitcher, globeOrSymbolKey, menuKey, slashKey, space,
69             comma, period, hide]
70       });
71   return spaceKeyRow;
72 };