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

Unified Diff: Source/devtools/front_end/ui/SettingsUI.js

Issue 340723005: [DevTools] Remove unnecessary emulation checkboxes and simplify UX. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 6 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 | « Source/devtools/front_end/sdk/OverridesSupport.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ui/SettingsUI.js
diff --git a/Source/devtools/front_end/ui/SettingsUI.js b/Source/devtools/front_end/ui/SettingsUI.js
index 6264a2a243522542b36e59946770163aaacb6e01..5c5b3451acb1af1a78217d8bd771593ae07330d2 100644
--- a/Source/devtools/front_end/ui/SettingsUI.js
+++ b/Source/devtools/front_end/ui/SettingsUI.js
@@ -89,15 +89,16 @@ WebInspector.SettingsUI.bindCheckbox = function(input, setting)
* @param {string=} width
* @param {function(string):?string=} validatorCallback
* @param {boolean=} instant
+ * @param {boolean=} clearForZero
+ * @param {string=} placeholder
* @return {!Element}
*/
-WebInspector.SettingsUI.createSettingInputField = function(label, setting, numeric, maxLength, width, validatorCallback, instant)
+WebInspector.SettingsUI.createSettingInputField = function(label, setting, numeric, maxLength, width, validatorCallback, instant, clearForZero, placeholder)
{
var p = document.createElement("p");
var labelElement = p.createChild("label");
labelElement.textContent = label;
var inputElement = p.createChild("input");
- inputElement.value = setting.get();
inputElement.type = "text";
if (numeric)
inputElement.className = "numeric";
@@ -105,6 +106,7 @@ WebInspector.SettingsUI.createSettingInputField = function(label, setting, numer
inputElement.maxLength = maxLength;
if (width)
inputElement.style.width = width;
+ inputElement.placeholder = placeholder || "";
if (validatorCallback || instant) {
inputElement.addEventListener("change", onInput, false);
@@ -158,44 +160,13 @@ WebInspector.SettingsUI.createSettingInputField = function(label, setting, numer
function onSettingChange()
{
- inputElement.value = setting.get();
+ var value = setting.get();
+ if (clearForZero && !value)
+ value = "";
+ inputElement.value = value;
}
-
- return p;
-}
-
-/**
- * @param {string} label
- * @param {!WebInspector.Setting} setting
- * @param {number=} maxLength
- * @param {string=} width
- * @param {string=} defaultText
- * @return {!Element}
- */
-WebInspector.SettingsUI.createSettingLabel = function(label, setting, maxLength, width, defaultText)
-{
- var p = document.createElement("p");
- var labelElement = p.createChild("span");
- labelElement.textContent = label;
- if (label)
- labelElement.style.marginRight = "5px";
- var spanElement = p.createChild("span");
- spanElement.textContent = setting.get();
- if (width)
- p.style.width = width;
-
- setting.addChangeListener(onSettingChange);
onSettingChange();
- function onSettingChange()
- {
- var text = setting.get() || defaultText;
- spanElement.title = text;
- if (maxLength && text.length > maxLength)
- text = text.substring(0, maxLength - 2) + "...";
- spanElement.textContent = text;
- }
-
return p;
}
« no previous file with comments | « Source/devtools/front_end/sdk/OverridesSupport.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698