Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1981)

Unified Diff: third_party/google_input_tools/src/chrome/os/inputview/elements/content/material/spacekey.js

Issue 828063007: Uprev Google Input Tools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update extensions schema. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/google_input_tools/src/chrome/os/inputview/elements/content/material/spacekey.js
diff --git a/third_party/google_input_tools/src/chrome/os/inputview/elements/content/spacekey.js b/third_party/google_input_tools/src/chrome/os/inputview/elements/content/material/spacekey.js
similarity index 61%
copy from third_party/google_input_tools/src/chrome/os/inputview/elements/content/spacekey.js
copy to third_party/google_input_tools/src/chrome/os/inputview/elements/content/material/spacekey.js
index 04de039b0932908d575e2d84a3f378930e23c283..82363f58c213a0172b3e679dadfb1b03a7020c41 100644
--- a/third_party/google_input_tools/src/chrome/os/inputview/elements/content/spacekey.js
+++ b/third_party/google_input_tools/src/chrome/os/inputview/elements/content/material/spacekey.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,18 +11,22 @@
// 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.elements.content.SpaceKey');
+goog.provide('i18n.input.chrome.inputview.elements.content.material.SpaceKey');
goog.require('goog.dom');
+goog.require('goog.dom.TagName');
goog.require('goog.dom.classlist');
+goog.require('goog.style');
goog.require('i18n.input.chrome.inputview.Css');
goog.require('i18n.input.chrome.inputview.StateType');
goog.require('i18n.input.chrome.inputview.elements.ElementType');
-goog.require('i18n.input.chrome.inputview.elements.content.FunctionalKey');
+goog.require('i18n.input.chrome.inputview.elements.content.SoftKey');
goog.scope(function() {
+var material = i18n.input.chrome.inputview.elements.content.material;
+var Css = i18n.input.chrome.inputview.Css;
@@ -37,12 +41,12 @@ goog.scope(function() {
* @param {goog.events.EventTarget=} opt_eventTarget The event target.
* @param {string=} opt_iconCss The icon CSS class
* @constructor
- * @extends {i18n.input.chrome.inputview.elements.content.FunctionalKey}
+ * @extends {i18n.input.chrome.inputview.elements.content.SoftKey}
*/
-i18n.input.chrome.inputview.elements.content.SpaceKey = function(id,
- stateManager, title, opt_characters, opt_eventTarget, opt_iconCss) {
+material.SpaceKey = function(id, stateManager, title, opt_characters,
+ opt_eventTarget, opt_iconCss) {
goog.base(this, id, i18n.input.chrome.inputview.elements.ElementType.
- SPACE_KEY, opt_iconCss ? '' : title, opt_iconCss || '', opt_eventTarget);
+ SPACE_KEY, opt_eventTarget);
/**
* The characters.
@@ -53,6 +57,13 @@ i18n.input.chrome.inputview.elements.content.SpaceKey = function(id,
this.characters_ = opt_characters || [];
/**
+ * The title on the space key.
+ *
+ * @private {string}
+ */
+ this.title_ = title;
+
+ /**
* The state manager.
*
* @type {!i18n.input.chrome.inputview.StateManager}
@@ -65,19 +76,35 @@ i18n.input.chrome.inputview.elements.content.SpaceKey = function(id,
this.pointerConfig.dblClick = true;
this.pointerConfig.dblClickDelay = 1000;
};
-goog.inherits(i18n.input.chrome.inputview.elements.content.SpaceKey,
- i18n.input.chrome.inputview.elements.content.FunctionalKey);
-var SpaceKey = i18n.input.chrome.inputview.elements.content.SpaceKey;
+goog.inherits(material.SpaceKey, i18n.input.chrome.inputview.elements.
+ content.SoftKey);
+var SpaceKey = material.SpaceKey;
+
+
+/**
+ * The height of the space key.
+ *
+ * @type {number}
+ */
+SpaceKey.HEIGHT = 43;
+
+
+/**
+ * The wrapper inside the space key.
+ *
+ * @private {!Element}
+ */
+SpaceKey.prototype.wrapper_;
/** @override */
SpaceKey.prototype.createDom = function() {
goog.base(this, 'createDom');
- goog.dom.classlist.remove(this.bgElem,
- i18n.input.chrome.inputview.Css.SPECIAL_KEY_BG);
-
- this.setAriaLabel(this.getChromeVoxMessage());
+ var dom = this.getDomHelper();
+ this.wrapper_ = dom.createDom(goog.dom.TagName.DIV, Css.SPACE_WRAPPER);
+ dom.appendChild(this.getElement(), this.wrapper_);
+ goog.dom.setTextContent(this.wrapper_, this.title_);
};
@@ -121,8 +148,34 @@ SpaceKey.prototype.updateTitle = function(title, visible) {
/** @override */
+SpaceKey.prototype.setHighlighted = function(highlight) {
+ if (highlight) {
+ goog.dom.classlist.add(this.wrapper_, i18n.input.chrome.inputview.Css.
+ ELEMENT_HIGHLIGHT);
+ } else {
+ goog.dom.classlist.remove(this.wrapper_, i18n.input.chrome.inputview.Css.
+ ELEMENT_HIGHLIGHT);
+ }
+};
+
+
+/**
+ * Gets the message for chromevox.
+ *
+ * @return {string} .
+ */
SpaceKey.prototype.getChromeVoxMessage = function() {
return chrome.i18n.getMessage('SPACE');
};
+
+/** @override */
+SpaceKey.prototype.resize = function(width, height) {
+ goog.base(this, 'resize', width, height);
+
+ goog.style.setSize(this.wrapper_, width, SpaceKey.HEIGHT);
+ // Positions the wrapper in the middle.
+ this.wrapper_.style.top = (height - SpaceKey.HEIGHT) / 2 + 'px';
+};
+
}); // goog.scope

Powered by Google App Engine
This is Rietveld 408576698