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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 }, | 454 }, |
455 | 455 |
456 _deviceMetricsChanged: function() | 456 _deviceMetricsChanged: function() |
457 { | 457 { |
458 if (this._deviceMetricsChangedListenerMuted) | 458 if (this._deviceMetricsChangedListenerMuted) |
459 return; | 459 return; |
460 var metrics = WebInspector.OverridesSupport.DeviceMetrics.parseSetting(W
ebInspector.settings.overrideDeviceMetrics.get() ? WebInspector.settings.deviceM
etrics.get() : ""); | 460 var metrics = WebInspector.OverridesSupport.DeviceMetrics.parseSetting(W
ebInspector.settings.overrideDeviceMetrics.get() ? WebInspector.settings.deviceM
etrics.get() : ""); |
461 if (!metrics.isValid()) | 461 if (!metrics.isValid()) |
462 return; | 462 return; |
463 | 463 |
464 var dipWidth = Math.round(metrics.width / metrics.deviceScaleFactor); | 464 var dipWidth = Math.round(metrics.width); |
465 var dipHeight = Math.round(metrics.height / metrics.deviceScaleFactor); | 465 var dipHeight = Math.round(metrics.height); |
466 var metricsOverrideEnabled = !!(dipWidth && dipHeight); | 466 var metricsOverrideEnabled = !!(dipWidth && dipHeight); |
467 | 467 |
468 // Disable override without checks. | 468 // Disable override without checks. |
469 if (metricsOverrideEnabled && WebInspector.OverridesSupport.isInspecting
Device()) { | 469 if (metricsOverrideEnabled && WebInspector.OverridesSupport.isInspecting
Device()) { |
470 this._updateDeviceMetricsWarningMessage(WebInspector.UIString("Scree
n emulation on the device is not available.")); | 470 this._updateDeviceMetricsWarningMessage(WebInspector.UIString("Scree
n emulation on the device is not available.")); |
471 return; | 471 return; |
472 } | 472 } |
473 | 473 |
474 PageAgent.setDeviceMetricsOverride(dipWidth, dipHeight, metricsOverrideE
nabled ? metrics.deviceScaleFactor : 0, WebInspector.settings.emulateViewport.ge
t(), WebInspector.settings.deviceFitWindow.get(), metrics.textAutosizing, metric
s.fontScaleFactor(), apiCallback.bind(this)); | 474 PageAgent.setDeviceMetricsOverride(dipWidth, dipHeight, metricsOverrideE
nabled ? metrics.deviceScaleFactor : 0, WebInspector.settings.emulateViewport.ge
t(), WebInspector.settings.deviceFitWindow.get(), metrics.textAutosizing, metric
s.fontScaleFactor(), apiCallback.bind(this)); |
475 this.maybeHasActiveOverridesChanged(); | 475 this.maybeHasActiveOverridesChanged(); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 }, | 593 }, |
594 | 594 |
595 __proto__: WebInspector.Object.prototype | 595 __proto__: WebInspector.Object.prototype |
596 } | 596 } |
597 | 597 |
598 | 598 |
599 /** | 599 /** |
600 * @type {!WebInspector.OverridesSupport} | 600 * @type {!WebInspector.OverridesSupport} |
601 */ | 601 */ |
602 WebInspector.overridesSupport; | 602 WebInspector.overridesSupport; |
OLD | NEW |