| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 278 |
| 279 /** | 279 /** |
| 280 * @param {boolean} enabled | 280 * @param {boolean} enabled |
| 281 */ | 281 */ |
| 282 setEmulationEnabled: function(enabled) | 282 setEmulationEnabled: function(enabled) |
| 283 { | 283 { |
| 284 if (this.canEmulate()) { | 284 if (this.canEmulate()) { |
| 285 this.settings._emulationEnabled.set(enabled); | 285 this.settings._emulationEnabled.set(enabled); |
| 286 this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.E
mulationStateChanged); | 286 this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.E
mulationStateChanged); |
| 287 if (enabled && this.settings.emulateResolution.get()) | 287 if (enabled && this.settings.emulateResolution.get()) |
| 288 this._target.emulationAgent().resetScrollAndPageScaleFactor(); | 288 this._target.emulationAgent().resetPageScaleFactor(); |
| 289 } | 289 } |
| 290 }, | 290 }, |
| 291 | 291 |
| 292 /** | 292 /** |
| 293 * @param {!WebInspector.Target} target | 293 * @param {!WebInspector.Target} target |
| 294 * @param {function()} callback | 294 * @param {function()} callback |
| 295 */ | 295 */ |
| 296 init: function(target, callback) | 296 init: function(target, callback) |
| 297 { | 297 { |
| 298 if (target.isPage()) | 298 if (target.isPage()) |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 /** | 517 /** |
| 518 * @param {!WebInspector.Event} event | 518 * @param {!WebInspector.Event} event |
| 519 */ | 519 */ |
| 520 _onPageResizerFixedScaleRequested: function(event) | 520 _onPageResizerFixedScaleRequested: function(event) |
| 521 { | 521 { |
| 522 this._fixedDeviceScale = /** @type {boolean} */ (event.data); | 522 this._fixedDeviceScale = /** @type {boolean} */ (event.data); |
| 523 this._deviceMetricsChanged(false); | 523 this._deviceMetricsChanged(false); |
| 524 }, | 524 }, |
| 525 | 525 |
| 526 /** | 526 /** |
| 527 * @param {boolean} resetScrollAndPageScale | 527 * @param {boolean} resetPageScaleFactor |
| 528 */ | 528 */ |
| 529 _deviceMetricsChanged: function(resetScrollAndPageScale) | 529 _deviceMetricsChanged: function(resetPageScaleFactor) |
| 530 { | 530 { |
| 531 if (!this._initialized) | 531 if (!this._initialized) |
| 532 return; | 532 return; |
| 533 | 533 |
| 534 this._showRulersChanged(); | 534 this._showRulersChanged(); |
| 535 | 535 |
| 536 if (this._deviceMetricsChangedListenerMuted) | 536 if (this._deviceMetricsChangedListenerMuted) |
| 537 return; | 537 return; |
| 538 | 538 |
| 539 if (!this.emulationEnabled()) { | 539 if (!this.emulationEnabled()) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 * @this {WebInspector.OverridesSupport} | 592 * @this {WebInspector.OverridesSupport} |
| 593 * @return {!Promise.<?>} | 593 * @return {!Promise.<?>} |
| 594 */ | 594 */ |
| 595 function setDeviceMetricsOverride() | 595 function setDeviceMetricsOverride() |
| 596 { | 596 { |
| 597 var setDevicePromise = this._target.emulationAgent().setDeviceMetric
sOverride( | 597 var setDevicePromise = this._target.emulationAgent().setDeviceMetric
sOverride( |
| 598 overrideWidth, overrideHeight, this.settings.emulateResolution.g
et() ? this.settings.deviceScaleFactor.get() : 0, | 598 overrideWidth, overrideHeight, this.settings.emulateResolution.g
et() ? this.settings.deviceScaleFactor.get() : 0, |
| 599 this.settings.emulateMobile.get(), this._pageResizer ? false : t
his.settings.deviceFitWindow.get(), scale, 0, 0, | 599 this.settings.emulateMobile.get(), this._pageResizer ? false : t
his.settings.deviceFitWindow.get(), scale, 0, 0, |
| 600 screenWidth, screenHeight, positionX, positionY, apiCallback.bin
d(this)) | 600 screenWidth, screenHeight, positionX, positionY, apiCallback.bin
d(this)) |
| 601 var allPromises = [ setDevicePromise ]; | 601 var allPromises = [ setDevicePromise ]; |
| 602 if (resetScrollAndPageScale) | 602 if (resetPageScaleFactor) |
| 603 allPromises.push(this._target.emulationAgent().resetScrollAndPag
eScaleFactor()); | 603 allPromises.push(this._target.emulationAgent().resetPageScaleFac
tor()); |
| 604 return Promise.all(allPromises); | 604 return Promise.all(allPromises); |
| 605 } | 605 } |
| 606 | 606 |
| 607 /** | 607 /** |
| 608 * @this {WebInspector.OverridesSupport} | 608 * @this {WebInspector.OverridesSupport} |
| 609 * @return {!Promise.<?>} | 609 * @return {!Promise.<?>} |
| 610 */ | 610 */ |
| 611 function clearDeviceMetricsOverride() | 611 function clearDeviceMetricsOverride() |
| 612 { | 612 { |
| 613 return this._target.emulationAgent().clearDeviceMetricsOverride(apiC
allback.bind(this)) | 613 return this._target.emulationAgent().clearDeviceMetricsOverride(apiC
allback.bind(this)) |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 }, | 811 }, |
| 812 | 812 |
| 813 __proto__: WebInspector.Object.prototype | 813 __proto__: WebInspector.Object.prototype |
| 814 } | 814 } |
| 815 | 815 |
| 816 | 816 |
| 817 /** | 817 /** |
| 818 * @type {!WebInspector.OverridesSupport} | 818 * @type {!WebInspector.OverridesSupport} |
| 819 */ | 819 */ |
| 820 WebInspector.overridesSupport; | 820 WebInspector.overridesSupport; |
| OLD | NEW |