| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 if (validatorCallback || instant) { | 111 if (validatorCallback || instant) { |
| 112 inputElement.addEventListener("change", onInput, false); | 112 inputElement.addEventListener("change", onInput, false); |
| 113 inputElement.addEventListener("input", onInput, false); | 113 inputElement.addEventListener("input", onInput, false); |
| 114 } | 114 } |
| 115 inputElement.addEventListener("keydown", onKeyDown, false); | 115 inputElement.addEventListener("keydown", onKeyDown, false); |
| 116 | 116 |
| 117 var errorMessageLabel; | 117 var errorMessageLabel; |
| 118 if (validatorCallback) { | 118 if (validatorCallback) { |
| 119 errorMessageLabel = p.createChild("div"); | 119 errorMessageLabel = p.createChild("div"); |
| 120 errorMessageLabel.classList.add("field-error-message"); | 120 errorMessageLabel.classList.add("field-error-message"); |
| 121 validate(); | |
| 122 } | 121 } |
| 123 | 122 |
| 124 function onInput() | 123 function onInput() |
| 125 { | 124 { |
| 126 if (validatorCallback) | 125 if (validatorCallback) |
| 127 validate(); | 126 validate(); |
| 128 if (instant) | 127 if (instant) |
| 129 apply(); | 128 apply(); |
| 130 } | 129 } |
| 131 | 130 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 160 | 159 |
| 161 function onSettingChange() | 160 function onSettingChange() |
| 162 { | 161 { |
| 163 var value = setting.get(); | 162 var value = setting.get(); |
| 164 if (clearForZero && !value) | 163 if (clearForZero && !value) |
| 165 value = ""; | 164 value = ""; |
| 166 inputElement.value = value; | 165 inputElement.value = value; |
| 167 } | 166 } |
| 168 onSettingChange(); | 167 onSettingChange(); |
| 169 | 168 |
| 169 if (validatorCallback) |
| 170 validate(); |
| 171 |
| 170 return p; | 172 return p; |
| 171 } | 173 } |
| 172 | 174 |
| 173 /** | 175 /** |
| 174 * @param {string} name | 176 * @param {string} name |
| 175 * @param {!Element} element | 177 * @param {!Element} element |
| 176 * @return {!Element} | 178 * @return {!Element} |
| 177 */ | 179 */ |
| 178 WebInspector.SettingsUI.createCustomSetting = function(name, element) | 180 WebInspector.SettingsUI.createCustomSetting = function(name, element) |
| 179 { | 181 { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 258 |
| 257 WebInspector.UISettingDelegate.prototype = { | 259 WebInspector.UISettingDelegate.prototype = { |
| 258 /** | 260 /** |
| 259 * @return {?Element} | 261 * @return {?Element} |
| 260 */ | 262 */ |
| 261 settingElement: function() | 263 settingElement: function() |
| 262 { | 264 { |
| 263 return null; | 265 return null; |
| 264 } | 266 } |
| 265 } | 267 } |
| OLD | NEW |