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

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

Issue 342443002: [DevTools] Ability to emulate touch or user agent, even when device emulation is turned off. (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 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 162 }
163 163
164 return p; 164 return p;
165 } 165 }
166 166
167 /** 167 /**
168 * @param {string} label 168 * @param {string} label
169 * @param {!WebInspector.Setting} setting 169 * @param {!WebInspector.Setting} setting
170 * @param {number=} maxLength 170 * @param {number=} maxLength
171 * @param {string=} width 171 * @param {string=} width
172 * @param {!WebInspector.Setting=} toggleSetting
173 * @param {string=} defaultText 172 * @param {string=} defaultText
174 * @return {!Element} 173 * @return {!Element}
175 */ 174 */
176 WebInspector.SettingsUI.createSettingLabel = function(label, setting, maxLength, width, toggleSetting, defaultText) 175 WebInspector.SettingsUI.createSettingLabel = function(label, setting, maxLength, width, defaultText)
177 { 176 {
178 var p = document.createElement("p"); 177 var p = document.createElement("p");
179 var labelElement = p.createChild("span"); 178 var labelElement = p.createChild("span");
180 labelElement.textContent = label; 179 labelElement.textContent = label;
181 if (label) 180 if (label)
182 labelElement.style.marginRight = "5px"; 181 labelElement.style.marginRight = "5px";
183 var spanElement = p.createChild("span"); 182 var spanElement = p.createChild("span");
184 spanElement.textContent = setting.get(); 183 spanElement.textContent = setting.get();
185 if (width) 184 if (width)
186 p.style.width = width; 185 p.style.width = width;
187 186
188 if (toggleSetting)
189 toggleSetting.addChangeListener(onSettingChange);
190 setting.addChangeListener(onSettingChange); 187 setting.addChangeListener(onSettingChange);
191 onSettingChange(); 188 onSettingChange();
192 189
193 function onSettingChange() 190 function onSettingChange()
194 { 191 {
195 var text = toggleSetting && !toggleSetting.get() ? (defaultText || "") : setting.get(); 192 var text = setting.get() || defaultText;
196 spanElement.title = text; 193 spanElement.title = text;
197 if (maxLength && text.length > maxLength) 194 if (maxLength && text.length > maxLength)
198 text = text.substring(0, maxLength - 2) + "..."; 195 text = text.substring(0, maxLength - 2) + "...";
199 spanElement.textContent = text; 196 spanElement.textContent = text;
200 } 197 }
201 198
202 return p; 199 return p;
203 } 200 }
204 201
205 /** 202 /**
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 285
289 WebInspector.UISettingDelegate.prototype = { 286 WebInspector.UISettingDelegate.prototype = {
290 /** 287 /**
291 * @return {?Element} 288 * @return {?Element}
292 */ 289 */
293 settingElement: function() 290 settingElement: function()
294 { 291 {
295 return null; 292 return null;
296 } 293 }
297 } 294 }
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