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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js

Issue 2681183003: [DevTools] Hide clear button for empty fields (Closed)
Patch Set: [DevTools] Hide clear button for empty fields Created 3 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/ui/toolbar.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
index e94ecae18a56ead408fa37321ba8917e6885521c..e984f35dbe641ed86e36ac3ec2ebc9bb42a72a0f 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
@@ -547,9 +547,6 @@ UI.ToolbarButton.Events = {
MouseUp: Symbol('MouseUp')
};
-/**
- * @unrestricted
- */
UI.ToolbarInput = class extends UI.ToolbarItem {
/**
* @param {string} placeholder
@@ -574,6 +571,8 @@ UI.ToolbarInput = class extends UI.ToolbarItem {
if (isSearchField)
this._setupSearchControls();
+
+ this._updateEmptyStyles();
}
_setupSearchControls() {
@@ -598,6 +597,7 @@ UI.ToolbarInput = class extends UI.ToolbarItem {
this.input.value = value;
if (notify)
this._onChangeCallback();
+ this._updateEmptyStyles();
}
/**
@@ -611,15 +611,20 @@ UI.ToolbarInput = class extends UI.ToolbarItem {
* @param {!Event} event
*/
_onKeydownCallback(event) {
- if (this.isSearchField || !isEscKey(event) || !this.input.value)
+ if (!this._isSearchField || !isEscKey(event) || !this.input.value)
return;
this._internalSetValue('', true);
event.consume(true);
}
_onChangeCallback() {
+ this._updateEmptyStyles();
this.dispatchEventToListeners(UI.ToolbarInput.Event.TextChanged, this.input.value);
}
+
+ _updateEmptyStyles() {
+ this.element.classList.toggle('toolbar-input-empty', !this.input.value);
+ }
};
UI.ToolbarInput.Event = {
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/ui/toolbar.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698