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

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

Issue 899673003: Uprev Google Input Tools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/toolbarbutton.js
diff --git a/third_party/google_input_tools/src/chrome/os/inputview/elements/content/candidatebutton.js b/third_party/google_input_tools/src/chrome/os/inputview/elements/content/toolbarbutton.js
similarity index 54%
copy from third_party/google_input_tools/src/chrome/os/inputview/elements/content/candidatebutton.js
copy to third_party/google_input_tools/src/chrome/os/inputview/elements/content/toolbarbutton.js
index 30897fa5868dee24967a5812f64896eaa6c5e204..dec8bb2bf1112fa7c16a437d9615a381652367a9 100644
--- a/third_party/google_input_tools/src/chrome/os/inputview/elements/content/candidatebutton.js
+++ b/third_party/google_input_tools/src/chrome/os/inputview/elements/content/toolbarbutton.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.elements.content.CandidateButton');
+goog.provide('i18n.input.chrome.inputview.elements.content.ToolbarButton');
goog.require('goog.dom.TagName');
goog.require('goog.dom.classlist');
@@ -28,19 +28,19 @@ var Css = i18n.input.chrome.inputview.Css;
/**
- * The icon button in the candidate view.
+ * The icon button in the Toolbar view.
*
* @param {string} id .
* @param {ElementType} type .
* @param {string} iconCss .
* @param {string} text .
* @param {!goog.events.EventTarget=} opt_eventTarget .
- * @param {boolean=} opt_noSeparator .
+ * @param {boolean=} opt_alignLeft .
* @constructor
* @extends {i18n.input.chrome.inputview.elements.Element}
*/
-i18n.input.chrome.inputview.elements.content.CandidateButton = function(
- id, type, iconCss, text, opt_eventTarget, opt_noSeparator) {
+i18n.input.chrome.inputview.elements.content.ToolbarButton = function(
+ id, type, iconCss, text, opt_eventTarget, opt_alignLeft) {
goog.base(this, id, type, opt_eventTarget);
/** @type {string} */
@@ -49,34 +49,29 @@ i18n.input.chrome.inputview.elements.content.CandidateButton = function(
/** @type {string} */
this.iconCss = iconCss;
- /** @private {boolean} */
- this.hasSeperator_ = !opt_noSeparator;
+ this.alignLeft = opt_alignLeft || false;
};
-var CandidateButton = i18n.input.chrome.inputview.elements.content.
- CandidateButton;
-goog.inherits(CandidateButton, i18n.input.chrome.inputview.elements.Element);
+var ToolbarButton = i18n.input.chrome.inputview.elements.content.
+ ToolbarButton;
+goog.inherits(ToolbarButton, i18n.input.chrome.inputview.elements.Element);
/** @type {!Element} */
-CandidateButton.prototype.iconCell;
-
-
-/** @type {!Element} */
-CandidateButton.prototype.separatorCell;
+ToolbarButton.prototype.iconCell;
/** @override */
-CandidateButton.prototype.createDom = function() {
+ToolbarButton.prototype.createDom = function() {
goog.base(this, 'createDom');
var dom = this.getDomHelper();
var elem = this.getElement();
- goog.dom.classlist.addAll(elem, [Css.CANDIDATE_INTER_CONTAINER,
- Css.CANDIDATE_BUTTON]);
-
- if (this.hasSeperator_) {
- this.separatorCell = this.createSeparator_();
+ var css = [Css.CANDIDATE_INTER_CONTAINER,
+ Css.TOOLBAR_BUTTON];
+ if (this.alignLeft) {
+ css.push(Css.FLOAT_LEFT);
}
+ goog.dom.classlist.addAll(elem, css);
this.iconCell = dom.createDom(goog.dom.TagName.DIV, Css.TABLE_CELL);
dom.appendChild(elem, this.iconCell);
@@ -91,31 +86,19 @@ CandidateButton.prototype.createDom = function() {
dom.appendChild(this.iconCell, iconElem);
};
-
-/**
- * Creates a separator.
- *
- * @private
- */
-CandidateButton.prototype.createSeparator_ = function() {
- var dom = this.getDomHelper();
- var tableCell = dom.createDom(goog.dom.TagName.DIV,
- i18n.input.chrome.inputview.Css.TABLE_CELL);
- var separator = dom.createDom(goog.dom.TagName.DIV,
- i18n.input.chrome.inputview.Css.CANDIDATE_SEPARATOR);
- separator.style.height = '32%';
- dom.appendChild(tableCell, separator);
- dom.appendChild(this.getElement(), tableCell);
- return tableCell;
+/** @override */
+ToolbarButton.prototype.setHighlighted = function(highlight) {
+ if (highlight) {
+ goog.dom.classlist.add(this.getElement(), Css.CANDIDATE_HIGHLIGHT);
+ } else {
+ goog.dom.classlist.remove(this.getElement(), Css.CANDIDATE_HIGHLIGHT);
+ }
};
/** @override */
-CandidateButton.prototype.resize = function(width, height) {
- if (this.hasSeperator_) {
- goog.style.setSize(this.separatorCell, 1, height);
- }
- goog.style.setSize(this.iconCell, width - 1, height);
+ToolbarButton.prototype.resize = function(width, height) {
+ goog.style.setSize(this.iconCell, width, height);
goog.base(this, 'resize', width, height);
};

Powered by Google App Engine
This is Rietveld 408576698