OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 22 matching lines...) Expand all Loading... |
33 /** | 33 /** |
34 * @param {string} name | 34 * @param {string} name |
35 * @param {!WebInspector.Setting} setting | 35 * @param {!WebInspector.Setting} setting |
36 * @param {boolean=} omitParagraphElement | 36 * @param {boolean=} omitParagraphElement |
37 * @param {!Element=} inputElement | 37 * @param {!Element=} inputElement |
38 * @param {string=} tooltip | 38 * @param {string=} tooltip |
39 * @return {!Element} | 39 * @return {!Element} |
40 */ | 40 */ |
41 WebInspector.SettingsUI.createSettingCheckbox = function(name, setting, omitPara
graphElement, inputElement, tooltip) | 41 WebInspector.SettingsUI.createSettingCheckbox = function(name, setting, omitPara
graphElement, inputElement, tooltip) |
42 { | 42 { |
43 var input = inputElement || document.createElement("input"); | 43 var input = inputElement || createElement("input"); |
44 input.type = "checkbox"; | 44 input.type = "checkbox"; |
45 input.name = name; | 45 input.name = name; |
46 WebInspector.SettingsUI.bindCheckbox(input, setting); | 46 WebInspector.SettingsUI.bindCheckbox(input, setting); |
47 | 47 |
48 var label = document.createElement("label"); | 48 var label = createElement("label"); |
49 label.appendChild(input); | 49 label.appendChild(input); |
50 label.createTextChild(name); | 50 label.createTextChild(name); |
51 if (tooltip) | 51 if (tooltip) |
52 label.title = tooltip; | 52 label.title = tooltip; |
53 | 53 |
54 if (omitParagraphElement) | 54 if (omitParagraphElement) |
55 return label; | 55 return label; |
56 | 56 |
57 var p = document.createElement("p"); | 57 var p = createElement("p"); |
58 p.appendChild(label); | 58 p.appendChild(label); |
59 return p; | 59 return p; |
60 } | 60 } |
61 | 61 |
62 /** | 62 /** |
63 * @param {!Element} input | 63 * @param {!Element} input |
64 * @param {!WebInspector.Setting} setting | 64 * @param {!WebInspector.Setting} setting |
65 */ | 65 */ |
66 WebInspector.SettingsUI.bindCheckbox = function(input, setting) | 66 WebInspector.SettingsUI.bindCheckbox = function(input, setting) |
67 { | 67 { |
(...skipping 20 matching lines...) Expand all Loading... |
88 * @param {number=} maxLength | 88 * @param {number=} maxLength |
89 * @param {string=} width | 89 * @param {string=} width |
90 * @param {function(string):?string=} validatorCallback | 90 * @param {function(string):?string=} validatorCallback |
91 * @param {boolean=} instant | 91 * @param {boolean=} instant |
92 * @param {boolean=} clearForZero | 92 * @param {boolean=} clearForZero |
93 * @param {string=} placeholder | 93 * @param {string=} placeholder |
94 * @return {!Element} | 94 * @return {!Element} |
95 */ | 95 */ |
96 WebInspector.SettingsUI.createSettingInputField = function(label, setting, numer
ic, maxLength, width, validatorCallback, instant, clearForZero, placeholder) | 96 WebInspector.SettingsUI.createSettingInputField = function(label, setting, numer
ic, maxLength, width, validatorCallback, instant, clearForZero, placeholder) |
97 { | 97 { |
98 var p = document.createElement("p"); | 98 var p = createElement("p"); |
99 var labelElement = p.createChild("label"); | 99 var labelElement = p.createChild("label"); |
100 labelElement.textContent = label; | 100 labelElement.textContent = label; |
101 var inputElement = p.createChild("input"); | 101 var inputElement = p.createChild("input"); |
102 inputElement.type = "text"; | 102 inputElement.type = "text"; |
103 if (numeric) | 103 if (numeric) |
104 inputElement.className = "numeric"; | 104 inputElement.className = "numeric"; |
105 if (maxLength) | 105 if (maxLength) |
106 inputElement.maxLength = maxLength; | 106 inputElement.maxLength = maxLength; |
107 if (width) | 107 if (width) |
108 inputElement.style.width = width; | 108 inputElement.style.width = width; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 return p; | 200 return p; |
201 } | 201 } |
202 | 202 |
203 /** | 203 /** |
204 * @param {string} name | 204 * @param {string} name |
205 * @param {!Element} element | 205 * @param {!Element} element |
206 * @return {!Element} | 206 * @return {!Element} |
207 */ | 207 */ |
208 WebInspector.SettingsUI.createCustomSetting = function(name, element) | 208 WebInspector.SettingsUI.createCustomSetting = function(name, element) |
209 { | 209 { |
210 var p = document.createElement("p"); | 210 var p = createElement("p"); |
211 var fieldsetElement = p.createChild("fieldset"); | 211 var fieldsetElement = p.createChild("fieldset"); |
212 fieldsetElement.createChild("label").textContent = name; | 212 fieldsetElement.createChild("label").textContent = name; |
213 fieldsetElement.appendChild(element); | 213 fieldsetElement.appendChild(element); |
214 return p; | 214 return p; |
215 } | 215 } |
216 | 216 |
217 /** | 217 /** |
218 * @param {!WebInspector.Setting} setting | 218 * @param {!WebInspector.Setting} setting |
219 * @return {!Element} | 219 * @return {!Element} |
220 */ | 220 */ |
221 WebInspector.SettingsUI.createSettingFieldset = function(setting) | 221 WebInspector.SettingsUI.createSettingFieldset = function(setting) |
222 { | 222 { |
223 var fieldset = document.createElement("fieldset"); | 223 var fieldset = createElement("fieldset"); |
224 fieldset.disabled = !setting.get(); | 224 fieldset.disabled = !setting.get(); |
225 setting.addChangeListener(settingChanged); | 225 setting.addChangeListener(settingChanged); |
226 return fieldset; | 226 return fieldset; |
227 | 227 |
228 function settingChanged() | 228 function settingChanged() |
229 { | 229 { |
230 fieldset.disabled = !setting.get(); | 230 fieldset.disabled = !setting.get(); |
231 } | 231 } |
232 } | 232 } |
233 | 233 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 285 |
286 WebInspector.UISettingDelegate.prototype = { | 286 WebInspector.UISettingDelegate.prototype = { |
287 /** | 287 /** |
288 * @return {?Element} | 288 * @return {?Element} |
289 */ | 289 */ |
290 settingElement: function() | 290 settingElement: function() |
291 { | 291 { |
292 return null; | 292 return null; |
293 } | 293 } |
294 } | 294 } |
OLD | NEW |