OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 /** | 257 /** |
258 * @param {string} value | 258 * @param {string} value |
259 */ | 259 */ |
260 WebInspector.OverridesSupport.inputValidator = function(value) | 260 WebInspector.OverridesSupport.inputValidator = function(value) |
261 { | 261 { |
262 if (value >= 0 && value <= 10000) | 262 if (value >= 0 && value <= 10000) |
263 return ""; | 263 return ""; |
264 return WebInspector.UIString("Value must be non-negative integer"); | 264 return WebInspector.UIString("Value must be non-negative integer"); |
265 } | 265 } |
266 | 266 |
| 267 // Third element lists device metrics separated by 'x': |
| 268 // - screen width, |
| 269 // - screen height, |
| 270 // - device scale factor, |
| 271 WebInspector.OverridesSupport._phones = [ |
| 272 ["Apple iPhone 3GS", |
| 273 "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWeb
Kit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5", |
| 274 "320x480x1"], |
| 275 ["Apple iPhone 4", |
| 276 "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWeb
Kit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5", |
| 277 "320x480x2"], |
| 278 ["Apple iPhone 5", |
| 279 "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X; en-us) AppleWebKit/5
37.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53", |
| 280 "320x568x2"], |
| 281 ["BlackBerry Z10", |
| 282 "Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/
10.0.9.2372 Mobile Safari/537.10+", |
| 283 "384x640x2"], |
| 284 ["BlackBerry Z30", |
| 285 "Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/
10.0.9.2372 Mobile Safari/537.10+", |
| 286 "360x640x2"], |
| 287 ["Google Nexus 4", |
| 288 "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 4 Build/JOP40D) AppleWebKi
t/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19", |
| 289 "384x640x2"], |
| 290 ["Google Nexus 5", |
| 291 "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKi
t/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19", |
| 292 "360x640x3"], |
| 293 ["Google Nexus S", |
| 294 "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Nexus S Build/GRJ22) AppleWeb
Kit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1", |
| 295 "320x533x1.5"], |
| 296 ["HTC Evo, Touch HD, Desire HD, Desire", |
| 297 "Mozilla/5.0 (Linux; U; Android 2.2; en-us; Sprint APA9292KT Build/FRF91) A
ppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1", |
| 298 "320x533x1.5"], |
| 299 ["HTC One X, EVO LTE", |
| 300 "Mozilla/5.0 (Linux; Android 4.0.3; HTC One X Build/IML74K) AppleWebKit/535
.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19", |
| 301 "360x640x2"], |
| 302 ["HTC Sensation, Evo 3D", |
| 303 "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; HTC Sensation Build/IML74K) A
ppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", |
| 304 "360x640x1.5"], |
| 305 ["LG Optimus 2X, Optimus 3D, Optimus Black", |
| 306 "Mozilla/5.0 (Linux; U; Android 2.2; en-us; LG-P990/V08c Build/FRG83) Apple
WebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 MMS/LG-Android-
MMS-V1.0/1.2", |
| 307 "320x533x1.5"], |
| 308 ["LG Optimus G", |
| 309 "Mozilla/5.0 (Linux; Android 4.0; LG-E975 Build/IMM76L) AppleWebKit/535.19
(KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19", |
| 310 "384x640x2"], |
| 311 ["LG Optimus LTE, Optimus 4X HD", |
| 312 "Mozilla/5.0 (Linux; U; Android 2.3; en-us; LG-P930 Build/GRJ90) AppleWebKi
t/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1", |
| 313 "424x753x1.7"], |
| 314 ["LG Optimus One", |
| 315 "Mozilla/5.0 (Linux; U; Android 2.2.1; en-us; LG-MS690 Build/FRG83) AppleWe
bKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1", |
| 316 "213x320x1.5"], |
| 317 ["Motorola Defy, Droid, Droid X, Milestone", |
| 318 "Mozilla/5.0 (Linux; U; Android 2.0; en-us; Milestone Build/ SHOLS_U2_01.03
.1) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17", |
| 319 "320x569x1.5"], |
| 320 ["Motorola Droid 3, Droid 4, Droid Razr, Atrix 4G, Atrix 2", |
| 321 "Mozilla/5.0 (Linux; U; Android 2.2; en-us; Droid Build/FRG22D) AppleWebKit
/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1", |
| 322 "540x960x1"], |
| 323 ["Motorola Droid Razr HD", |
| 324 "Mozilla/5.0 (Linux; U; Android 2.3; en-us; DROID RAZR 4G Build/6.5.1-73_DH
D-11_M1-29) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.
1", |
| 325 "720x1280x1"], |
| 326 ["Nokia C5, C6, C7, N97, N8, X7", |
| 327 "NokiaN97/21.1.107 (SymbianOS/9.4; Series60/5.0 Mozilla/5.0; Profile/MIDP-2
.1 Configuration/CLDC-1.1) AppleWebkit/525 (KHTML, like Gecko) BrowserNG/7.1.4", |
| 328 "360x640x1"], |
| 329 ["Nokia Lumia 7X0, Lumia 8XX, Lumia 900, N800, N810, N900", |
| 330 "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobi
le/10.0; ARM; Touch; NOKIA; Lumia 820)", |
| 331 "320x533x1.5"], |
| 332 ["Samsung Galaxy Note 3", |
| 333 "Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWeb
Kit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", |
| 334 "540x960x2"], |
| 335 ["Samsung Galaxy Note II", |
| 336 "Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWeb
Kit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", |
| 337 "360x640x2"], |
| 338 ["Samsung Galaxy Note", |
| 339 "Mozilla/5.0 (Linux; U; Android 2.3; en-us; SAMSUNG-SGH-I717 Build/GINGERBR
EAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1", |
| 340 "400x640x2"], |
| 341 ["Samsung Galaxy S III, Galaxy Nexus", |
| 342 "Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWeb
Kit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", |
| 343 "360x640x2"], |
| 344 ["Samsung Galaxy S, S II, W", |
| 345 "Mozilla/5.0 (Linux; U; Android 2.1; en-us; GT-I9000 Build/ECLAIR) AppleWeb
Kit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2", |
| 346 "320x533x1.5"], |
| 347 ["Samsung Galaxy S4", |
| 348 "Mozilla/5.0 (Linux; Android 4.2.2; GT-I9505 Build/JDQ39) AppleWebKit/537.3
6 (KHTML, like Gecko) Chrome/31.0.1650.59 Mobile Safari/537.36", |
| 349 "360x640x3"], |
| 350 ["Sony Xperia S, Ion", |
| 351 "Mozilla/5.0 (Linux; U; Android 4.0; en-us; LT28at Build/6.1.C.1.111) Apple
WebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", |
| 352 "360x640x2"], |
| 353 ["Sony Xperia Sola, U", |
| 354 "Mozilla/5.0 (Linux; U; Android 2.3; en-us; SonyEricssonST25i Build/6.0.B.1
.564) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1", |
| 355 "480x854x1"], |
| 356 ["Sony Xperia Z, Z1", |
| 357 "Mozilla/5.0 (Linux; U; Android 4.2; en-us; SonyC6903 Build/14.1.G.1.518) A
ppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30", |
| 358 "360x640x3"], |
| 359 ]; |
| 360 |
| 361 WebInspector.OverridesSupport._tablets = [ |
| 362 ["Amazon Kindle Fire HDX 7\u2033", |
| 363 "Mozilla/5.0 (Linux; U; en-us; KFTHWI Build/JDQ39) AppleWebKit/535.19 (KHTM
L, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true", |
| 364 "1920x1200x2"], |
| 365 ["Amazon Kindle Fire HDX 8.9\u2033", |
| 366 "Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTM
L, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true", |
| 367 "2560x1600x2"], |
| 368 ["Amazon Kindle Fire (First Generation)", |
| 369 "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.141.16-G
en4_11004310) AppleWebkit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 S
ilk-Accelerated=true", |
| 370 "1024x600x1"], |
| 371 ["Apple iPad 1 / 2 / iPad Mini", |
| 372 "Mozilla/5.0 (iPad; CPU OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9
(KHTML, like Gecko) Version/5.0.2 Mobile/8L1 Safari/6533.18.5", |
| 373 "1024x768x1"], |
| 374 ["Apple iPad 3 / 4", |
| 375 "Mozilla/5.0 (iPad; CPU OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML,
like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53", |
| 376 "1024x768x2"], |
| 377 ["BlackBerry PlayBook", |
| 378 "Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (
KHTML like Gecko) Version/7.2.1.0 Safari/536.2+", |
| 379 "1024x600x1"], |
| 380 ["Google Nexus 10", |
| 381 "Mozilla/5.0 (Linux; Android 4.3; Nexus 10 Build/JSS15Q) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/29.0.1547.72 Safari/537.36", |
| 382 "1280x800x2"], |
| 383 ["Google Nexus 7 2", |
| 384 "Mozilla/5.0 (Linux; Android 4.3; Nexus 7 Build/JSS15Q) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/29.0.1547.72 Safari/537.36", |
| 385 "960x600x2"], |
| 386 ["Google Nexus 7", |
| 387 "Mozilla/5.0 (Linux; Android 4.3; Nexus 7 Build/JSS15Q) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/29.0.1547.72 Safari/537.36", |
| 388 "966x604x1.325"], |
| 389 ["Motorola Xoom, Xyboard", |
| 390 "Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/5
25.10 (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2", |
| 391 "1280x800x1"], |
| 392 ["Samsung Galaxy Tab 7.7, 8.9, 10.1", |
| 393 "Mozilla/5.0 (Linux; U; Android 2.2; en-us; SCH-I800 Build/FROYO) AppleWebK
it/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1", |
| 394 "1280x800x1"], |
| 395 ["Samsung Galaxy Tab", |
| 396 "Mozilla/5.0 (Linux; U; Android 2.2; en-us; SCH-I800 Build/FROYO) AppleWebK
it/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1", |
| 397 "1024x600x1"], |
| 398 ]; |
267 | 399 |
268 WebInspector.OverridesSupport.prototype = { | 400 WebInspector.OverridesSupport.prototype = { |
269 /** | 401 /** |
270 * @param {?WebInspector.OverridesSupport.PageResizer} pageResizer | 402 * @param {?WebInspector.OverridesSupport.PageResizer} pageResizer |
271 */ | 403 */ |
272 setPageResizer: function(pageResizer) | 404 setPageResizer: function(pageResizer) |
273 { | 405 { |
274 if (pageResizer === this._pageResizer) | 406 if (pageResizer === this._pageResizer) |
275 return; | 407 return; |
276 | 408 |
(...skipping 26 matching lines...) Expand all Loading... |
303 this.settings.deviceTextAutosizing.set(metrics.textAutosizing); | 435 this.settings.deviceTextAutosizing.set(metrics.textAutosizing); |
304 this.settings.overrideUserAgent.set(true); | 436 this.settings.overrideUserAgent.set(true); |
305 this.settings.emulateTouchEvents.set(true); | 437 this.settings.emulateTouchEvents.set(true); |
306 this.settings.emulateViewport.set(true); | 438 this.settings.emulateViewport.set(true); |
307 delete this._deviceMetricsChangedListenerMuted; | 439 delete this._deviceMetricsChangedListenerMuted; |
308 delete this._userAgentChangedListenerMuted; | 440 delete this._userAgentChangedListenerMuted; |
309 this._deviceMetricsChanged(); | 441 this._deviceMetricsChanged(); |
310 this._userAgentChanged(); | 442 this._userAgentChanged(); |
311 }, | 443 }, |
312 | 444 |
313 reset: function() | 445 resetEmulatedDevice: function() |
314 { | 446 { |
315 this._deviceMetricsChangedListenerMuted = true; | 447 this._deviceMetricsChangedListenerMuted = true; |
316 this._userAgentChangedListenerMuted = true; | 448 this._userAgentChangedListenerMuted = true; |
317 this.settings.overrideDeviceResolution.set(false); | 449 this.settings.overrideDeviceResolution.set(false); |
318 this.settings.overrideUserAgent.set(false); | 450 this.settings.overrideUserAgent.set(false); |
319 this.settings.emulateTouchEvents.set(false); | 451 this.settings.emulateTouchEvents.set(false); |
320 this.settings.overrideDeviceOrientation.set(false); | |
321 this.settings.overrideGeolocation.set(false); | |
322 this.settings.overrideCSSMedia.set(false); | |
323 this.settings.emulateViewport.set(false); | 452 this.settings.emulateViewport.set(false); |
324 delete this._deviceMetricsChangedListenerMuted; | 453 delete this._deviceMetricsChangedListenerMuted; |
325 delete this._userAgentChangedListenerMuted; | 454 delete this._userAgentChangedListenerMuted; |
326 this._deviceMetricsChanged(); | 455 this._deviceMetricsChanged(); |
327 this._userAgentChanged(); | 456 this._userAgentChanged(); |
328 }, | 457 }, |
329 | 458 |
| 459 reset: function() |
| 460 { |
| 461 this.settings.overrideDeviceOrientation.set(false); |
| 462 this.settings.overrideGeolocation.set(false); |
| 463 this.settings.overrideCSSMedia.set(false); |
| 464 this.resetEmulatedDevice(); |
| 465 }, |
| 466 |
330 applyInitialOverrides: function() | 467 applyInitialOverrides: function() |
331 { | 468 { |
332 if (!this._target) { | 469 if (!this._target) { |
333 this._applyInitialOverridesOnTargetAdded = true; | 470 this._applyInitialOverridesOnTargetAdded = true; |
334 return; | 471 return; |
335 } | 472 } |
336 | 473 |
337 if (this.settings.overrideDeviceOrientation.get()) | 474 if (this.settings.overrideDeviceOrientation.get()) |
338 this._deviceOrientationChanged(); | 475 this._deviceOrientationChanged(); |
339 | 476 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 | 756 |
620 this.settings.deviceFitWindow = WebInspector.settings.createSetting("dev
iceFitWindow", true); | 757 this.settings.deviceFitWindow = WebInspector.settings.createSetting("dev
iceFitWindow", true); |
621 this.settings.emulateViewport = WebInspector.settings.createSetting("emu
lateViewport", false); | 758 this.settings.emulateViewport = WebInspector.settings.createSetting("emu
lateViewport", false); |
622 this.settings.emulateTouchEvents = WebInspector.settings.createSetting("
emulateTouchEvents", false); | 759 this.settings.emulateTouchEvents = WebInspector.settings.createSetting("
emulateTouchEvents", false); |
623 this.settings.overrideGeolocation = WebInspector.settings.createSetting(
"overrideGeolocation", false); | 760 this.settings.overrideGeolocation = WebInspector.settings.createSetting(
"overrideGeolocation", false); |
624 this.settings.geolocationOverride = WebInspector.settings.createSetting(
"geolocationOverride", ""); | 761 this.settings.geolocationOverride = WebInspector.settings.createSetting(
"geolocationOverride", ""); |
625 this.settings.overrideDeviceOrientation = WebInspector.settings.createSe
tting("overrideDeviceOrientation", false); | 762 this.settings.overrideDeviceOrientation = WebInspector.settings.createSe
tting("overrideDeviceOrientation", false); |
626 this.settings.deviceOrientationOverride = WebInspector.settings.createSe
tting("deviceOrientationOverride", ""); | 763 this.settings.deviceOrientationOverride = WebInspector.settings.createSe
tting("deviceOrientationOverride", ""); |
627 this.settings.overrideCSSMedia = WebInspector.settings.createSetting("ov
errideCSSMedia", false); | 764 this.settings.overrideCSSMedia = WebInspector.settings.createSetting("ov
errideCSSMedia", false); |
628 this.settings.emulatedCSSMedia = WebInspector.settings.createSetting("em
ulatedCSSMedia", "print"); | 765 this.settings.emulatedCSSMedia = WebInspector.settings.createSetting("em
ulatedCSSMedia", "print"); |
| 766 this.settings.emulatedDevice = WebInspector.settings.createSetting("emul
atedDevice", "Google Nexus 5"); |
629 | 767 |
630 this.maybeHasActiveOverridesChanged(); | 768 this.maybeHasActiveOverridesChanged(); |
631 | 769 |
632 this.settings.overrideUserAgent.addChangeListener(this._userAgentChanged
, this); | 770 this.settings.overrideUserAgent.addChangeListener(this._userAgentChanged
, this); |
633 this.settings.userAgent.addChangeListener(this._userAgentChanged, this); | 771 this.settings.userAgent.addChangeListener(this._userAgentChanged, this); |
634 | 772 |
635 this.settings.overrideDeviceResolution.addChangeListener(this._deviceMet
ricsChanged, this); | 773 this.settings.overrideDeviceResolution.addChangeListener(this._deviceMet
ricsChanged, this); |
636 this.settings.deviceWidth.addChangeListener(this._deviceMetricsChanged,
this); | 774 this.settings.deviceWidth.addChangeListener(this._deviceMetricsChanged,
this); |
637 this.settings.deviceHeight.addChangeListener(this._deviceMetricsChanged,
this); | 775 this.settings.deviceHeight.addChangeListener(this._deviceMetricsChanged,
this); |
638 this.settings.deviceScaleFactor.addChangeListener(this._deviceMetricsCha
nged, this); | 776 this.settings.deviceScaleFactor.addChangeListener(this._deviceMetricsCha
nged, this); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 if (minWidth <= kWidthForMinFSM) | 861 if (minWidth <= kWidthForMinFSM) |
724 return kMinFSM; | 862 return kMinFSM; |
725 if (minWidth >= kWidthForMaxFSM) | 863 if (minWidth >= kWidthForMaxFSM) |
726 return kMaxFSM; | 864 return kMaxFSM; |
727 | 865 |
728 // The font scale multiplier varies linearly between kMinFSM and kMaxFSM
. | 866 // The font scale multiplier varies linearly between kMinFSM and kMaxFSM
. |
729 var ratio = (minWidth - kWidthForMinFSM) / (kWidthForMaxFSM - kWidthForM
inFSM); | 867 var ratio = (minWidth - kWidthForMinFSM) / (kWidthForMaxFSM - kWidthForM
inFSM); |
730 return ratio * (kMaxFSM - kMinFSM) + kMinFSM; | 868 return ratio * (kMaxFSM - kMinFSM) + kMinFSM; |
731 }, | 869 }, |
732 | 870 |
| 871 /** |
| 872 * @param {!Document} document |
| 873 * @return {!Element} |
| 874 */ |
| 875 createDeviceSelect: function(document) |
| 876 { |
| 877 var deviceSelectElement = document.createElement("select"); |
| 878 deviceSelectElement.disabled = WebInspector.overridesSupport.isInspectin
gDevice(); |
| 879 |
| 880 var devices = WebInspector.OverridesSupport._phones.concat(WebInspector.
OverridesSupport._tablets); |
| 881 devices.sort(); |
| 882 for (var i = 0; i < devices.length; ++i) { |
| 883 var device = devices[i]; |
| 884 var option = new Option(device[0], device[0]); |
| 885 option.userAgent = device[1]; |
| 886 option.metrics = device[2]; |
| 887 deviceSelectElement.add(option); |
| 888 } |
| 889 |
| 890 settingChanged(); |
| 891 WebInspector.overridesSupport.settings.emulatedDevice.addChangeListener(
settingChanged); |
| 892 deviceSelectElement.addEventListener("change", deviceSelected, false); |
| 893 |
| 894 function deviceSelected() |
| 895 { |
| 896 var option = deviceSelectElement.options[deviceSelectElement.selecte
dIndex]; |
| 897 WebInspector.overridesSupport.settings.emulatedDevice.removeChangeLi
stener(settingChanged); |
| 898 WebInspector.overridesSupport.settings.emulatedDevice.set(option.val
ue); |
| 899 WebInspector.overridesSupport.settings.emulatedDevice.addChangeListe
ner(settingChanged); |
| 900 } |
| 901 |
| 902 function settingChanged() |
| 903 { |
| 904 var selectionRestored = false; |
| 905 for (var i = 0; i < devices.length; ++i) { |
| 906 var device = devices[i]; |
| 907 if (WebInspector.overridesSupport.settings.emulatedDevice.get()
=== device[0]) { |
| 908 deviceSelectElement.selectedIndex = i; |
| 909 selectionRestored = true; |
| 910 break; |
| 911 } |
| 912 } |
| 913 |
| 914 if (!selectionRestored) |
| 915 deviceSelectElement.selectedIndex = devices.length - 1; |
| 916 } |
| 917 |
| 918 return deviceSelectElement; |
| 919 }, |
| 920 |
733 __proto__: WebInspector.Object.prototype | 921 __proto__: WebInspector.Object.prototype |
734 } | 922 } |
735 | 923 |
736 | 924 |
737 /** | 925 /** |
738 * @type {!WebInspector.OverridesSupport} | 926 * @type {!WebInspector.OverridesSupport} |
739 */ | 927 */ |
740 WebInspector.overridesSupport; | 928 WebInspector.overridesSupport; |
OLD | NEW |