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

Side by Side Diff: Source/devtools/front_end/ui/SettingsUI.js

Issue 330223004: [DevTools] Responsive design UI rework. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/sdk/OverridesSupport.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 setting.addChangeListener(onSettingChange); 156 setting.addChangeListener(onSettingChange);
157 157
158 function onSettingChange() 158 function onSettingChange()
159 { 159 {
160 inputElement.value = setting.get(); 160 inputElement.value = setting.get();
161 } 161 }
162 162
163 return p; 163 return p;
164 } 164 }
165 165
166 /**
167 * @param {string} label
168 * @param {!WebInspector.Setting} setting
169 * @param {number=} maxLength
170 * @param {string=} width
171 * @param {!WebInspector.Setting=} toggleSetting
172 * @param {string=} defaultText
173 */
174 WebInspector.SettingsUI.createSettingLabel = function(label, setting, maxLength, width, toggleSetting, defaultText)
175 {
176 var p = document.createElement("p");
177 var labelElement = p.createChild("span");
178 labelElement.textContent = label;
179 if (label)
180 labelElement.style.marginRight = "5px";
181 var spanElement = p.createChild("span");
182 spanElement.textContent = setting.get();
183 if (width)
184 p.style.width = width;
185
186 if (toggleSetting)
187 toggleSetting.addChangeListener(onSettingChange);
188 setting.addChangeListener(onSettingChange);
189 onSettingChange();
190
191 function onSettingChange()
192 {
193 var text = toggleSetting && !toggleSetting.get() ? (defaultText || "") : setting.get();
194 spanElement.title = text;
195 if (maxLength && text.length > maxLength)
196 text = text.substring(0, maxLength - 2) + "...";
197 spanElement.textContent = text;
198 }
199
200 return p;
201 }
202
166 WebInspector.SettingsUI.createCustomSetting = function(name, element) 203 WebInspector.SettingsUI.createCustomSetting = function(name, element)
167 { 204 {
168 var p = document.createElement("p"); 205 var p = document.createElement("p");
169 var fieldsetElement = document.createElement("fieldset"); 206 var fieldsetElement = document.createElement("fieldset");
170 fieldsetElement.createChild("label").textContent = name; 207 fieldsetElement.createChild("label").textContent = name;
171 fieldsetElement.appendChild(element); 208 fieldsetElement.appendChild(element);
172 p.appendChild(fieldsetElement); 209 p.appendChild(fieldsetElement);
173 return p; 210 return p;
174 } 211 }
175 212
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 281
245 WebInspector.UISettingDelegate.prototype = { 282 WebInspector.UISettingDelegate.prototype = {
246 /** 283 /**
247 * @return {?Element} 284 * @return {?Element}
248 */ 285 */
249 settingElement: function() 286 settingElement: function()
250 { 287 {
251 return null; 288 return null;
252 } 289 }
253 } 290 }
OLDNEW
« 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