Switch TestFrameNavigationObserver to DidCommitProvisionalLoadForFrame.
[chromium-blink-merge.git] / third_party / google_input_tools / src / chrome / os / inputview / covariance.js
blobfacf5c11fe4989e39b27a176e2cba7e83e46ec40
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");
14 goog.provide('i18n.input.chrome.inputview.Covariance');
16 goog.require('i18n.input.chrome.inputview.elements.ElementType');
19 goog.scope(function() {
20 var ElementType = i18n.input.chrome.inputview.elements.ElementType;
24 /**
25 * The covariance used for gaussian model.
27 * @constructor
29 i18n.input.chrome.inputview.Covariance = function() {
30 /** @private {number} */
31 this.breakDown_ = 0;
33 var Covariance = i18n.input.chrome.inputview.Covariance;
36 /**
37 * The break-down for covariance.
39 * @enum {number}
41 Covariance.BreakDown = {
42 A11Y: 1,
43 HORIZONTAL: 2,
44 WIDE_SCREEN: 4
48 /**
49 * The key type.
51 * @type {!Object.<ElementType, number>}
53 Covariance.ElementTypeMap = goog.object.create(
54 ElementType.CHARACTER_KEY, 0,
55 ElementType.COMPACT_KEY, 1
59 /**
60 * The value.
61 * Key: the break down value.
62 * Value: A list - first is the covariance for full keyboard, second is for
63 * compact.
65 * @private {!Object.<!Array.<number>>}
67 Covariance.VALUE_ = {
68 0: [120, 160],
69 1: [130, 0],
70 2: [235, 342],
71 3: [162, 0],
72 4: [160, 213],
73 5: [142, 0],
74 6: [230, 332],
75 7: [162, 0]
79 /**
80 * Updates the covariance.
82 * @param {boolean} isWideScreen .
83 * @param {boolean} isHorizontal .
84 * @param {boolean} isA11y .
86 Covariance.prototype.update = function(isWideScreen, isHorizontal, isA11y) {
87 this.breakDown_ = 0;
88 if (isWideScreen) {
89 this.breakDown_ |= Covariance.BreakDown.WIDE_SCREEN;
91 if (isHorizontal) {
92 this.breakDown_ |= Covariance.BreakDown.HORIZONTAL;
94 if (isA11y) {
95 this.breakDown_ |= Covariance.BreakDown.A11Y;
101 * Gets the covariance value.
103 * @param {ElementType} type .
105 Covariance.prototype.getValue = function(type) {
106 var index = Covariance.ElementTypeMap[type];
107 return Covariance.VALUE_[this.breakDown_][index];
110 }); // goog.scope