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

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

Issue 2681183003: [DevTools] Hide clear button for empty fields (Closed)
Patch Set: 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..4f27a8bf6e0bb6694ee2d944aed4ffad0ba95e44 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
@@ -574,6 +574,8 @@ UI.ToolbarInput = class extends UI.ToolbarItem {
if (isSearchField)
this._setupSearchControls();
+
+ this._updateIfEmpty();
}
_setupSearchControls() {
@@ -598,6 +600,7 @@ UI.ToolbarInput = class extends UI.ToolbarItem {
this.input.value = value;
if (notify)
this._onChangeCallback();
+ this._updateIfEmpty();
}
/**
@@ -618,8 +621,13 @@ UI.ToolbarInput = class extends UI.ToolbarItem {
}
_onChangeCallback() {
+ this._updateIfEmpty();
this.dispatchEventToListeners(UI.ToolbarInput.Event.TextChanged, this.input.value);
}
+
+ _updateIfEmpty() {
phulce 2017/02/09 18:43:10 not a huge fan of the name, can we specify what we
pfeldman 2017/02/09 18:45:15 +1 _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