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

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: 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
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 162
163 return p; 163 return p;
164 } 164 }
165 165
166 /** 166 /**
167 * @param {string} label 167 * @param {string} label
168 * @param {!WebInspector.Setting} setting 168 * @param {!WebInspector.Setting} setting
169 * @param {number=} maxLength 169 * @param {number=} maxLength
170 * @param {string=} width 170 * @param {string=} width
171 * @param {!WebInspector.Setting=} toggleSetting
172 * @param {string=} defaultText 171 * @param {string=} defaultText
173 */ 172 */
174 WebInspector.SettingsUI.createSettingLabel = function(label, setting, maxLength, width, toggleSetting, defaultText) 173 WebInspector.SettingsUI.createSettingLabel = function(label, setting, maxLength, width, defaultText)
175 { 174 {
176 var p = document.createElement("p"); 175 var p = document.createElement("p");
177 var labelElement = p.createChild("span"); 176 var labelElement = p.createChild("span");
178 labelElement.textContent = label; 177 labelElement.textContent = label;
179 if (label) 178 if (label)
180 labelElement.style.marginRight = "5px"; 179 labelElement.style.marginRight = "5px";
181 var spanElement = p.createChild("span"); 180 var spanElement = p.createChild("span");
182 spanElement.textContent = setting.get(); 181 spanElement.textContent = setting.get();
183 if (width) 182 if (width)
184 p.style.width = width; 183 p.style.width = width;
185 184
186 if (toggleSetting)
187 toggleSetting.addChangeListener(onSettingChange);
188 setting.addChangeListener(onSettingChange); 185 setting.addChangeListener(onSettingChange);
189 onSettingChange(); 186 onSettingChange();
190 187
191 function onSettingChange() 188 function onSettingChange()
192 { 189 {
193 var text = toggleSetting && !toggleSetting.get() ? (defaultText || "") : setting.get(); 190 var text = setting.get() || defaultText;
194 spanElement.title = text; 191 spanElement.title = text;
195 if (maxLength && text.length > maxLength) 192 if (maxLength && text.length > maxLength)
196 text = text.substring(0, maxLength - 2) + "..."; 193 text = text.substring(0, maxLength - 2) + "...";
197 spanElement.textContent = text; 194 spanElement.textContent = text;
198 } 195 }
199 196
200 return p; 197 return p;
201 } 198 }
202 199
203 WebInspector.SettingsUI.createCustomSetting = function(name, element) 200 WebInspector.SettingsUI.createCustomSetting = function(name, element)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 278
282 WebInspector.UISettingDelegate.prototype = { 279 WebInspector.UISettingDelegate.prototype = {
283 /** 280 /**
284 * @return {?Element} 281 * @return {?Element}
285 */ 282 */
286 settingElement: function() 283 settingElement: function()
287 { 284 {
288 return null; 285 return null;
289 } 286 }
290 } 287 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698