| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @param {function()} updateCallback | 7 * @param {function()} updateCallback |
| 8 * @implements {WebInspector.TargetManager.Observer} | 8 * @implements {WebInspector.TargetManager.Observer} |
| 9 */ | 9 */ |
| 10 WebInspector.DeviceModeModel = function(updateCallback) | 10 WebInspector.DeviceModeModel = function(updateCallback) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 this._heightSetting.set(WebInspector.DeviceModeModel.MinDeviceSize); | 38 this._heightSetting.set(WebInspector.DeviceModeModel.MinDeviceSize); |
| 39 if (this._heightSetting.get() > WebInspector.DeviceModeModel.MaxDeviceSize) | 39 if (this._heightSetting.get() > WebInspector.DeviceModeModel.MaxDeviceSize) |
| 40 this._heightSetting.set(WebInspector.DeviceModeModel.MaxDeviceSize); | 40 this._heightSetting.set(WebInspector.DeviceModeModel.MaxDeviceSize); |
| 41 this._heightSetting.addChangeListener(this._heightSettingChanged, this); | 41 this._heightSetting.addChangeListener(this._heightSettingChanged, this); |
| 42 | 42 |
| 43 this._uaSetting = WebInspector.settings.createSetting("emulation.deviceUA",
WebInspector.DeviceModeModel.UA.Mobile); | 43 this._uaSetting = WebInspector.settings.createSetting("emulation.deviceUA",
WebInspector.DeviceModeModel.UA.Mobile); |
| 44 this._uaSetting.addChangeListener(this._uaSettingChanged, this); | 44 this._uaSetting.addChangeListener(this._uaSettingChanged, this); |
| 45 this._deviceScaleFactorSetting = WebInspector.settings.createSetting("emulat
ion.deviceScaleFactor", 0); | 45 this._deviceScaleFactorSetting = WebInspector.settings.createSetting("emulat
ion.deviceScaleFactor", 0); |
| 46 this._deviceScaleFactorSetting.addChangeListener(this._deviceScaleFactorSett
ingChanged, this); | 46 this._deviceScaleFactorSetting.addChangeListener(this._deviceScaleFactorSett
ingChanged, this); |
| 47 | 47 |
| 48 this._deviceOutlineSetting = WebInspector.settings.createSetting("emulation.
deviceOutline", false); | 48 this._deviceOutlineSetting = WebInspector.settings.moduleSetting("emulation.
showDeviceOutline"); |
| 49 this._deviceOutlineSetting.addChangeListener(this._deviceOutlineSettingChang
ed, this); | 49 this._deviceOutlineSetting.addChangeListener(this._deviceOutlineSettingChang
ed, this); |
| 50 | 50 |
| 51 /** @type {!WebInspector.DeviceModeModel.Type} */ | 51 /** @type {!WebInspector.DeviceModeModel.Type} */ |
| 52 this._type = WebInspector.DeviceModeModel.Type.None; | 52 this._type = WebInspector.DeviceModeModel.Type.None; |
| 53 /** @type {?WebInspector.EmulatedDevice} */ | 53 /** @type {?WebInspector.EmulatedDevice} */ |
| 54 this._device = null; | 54 this._device = null; |
| 55 /** @type {?WebInspector.EmulatedDevice.Mode} */ | 55 /** @type {?WebInspector.EmulatedDevice.Mode} */ |
| 56 this._mode = null; | 56 this._mode = null; |
| 57 /** @type {number} */ | 57 /** @type {number} */ |
| 58 this._fitScale = 1; | 58 this._fitScale = 1; |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 var screenOrientationAngle = screenOrientation === "landscapePrimary" ?
90 : 0; | 537 var screenOrientationAngle = screenOrientation === "landscapePrimary" ?
90 : 0; |
| 538 | 538 |
| 539 this._appliedDeviceSize = screenSize; | 539 this._appliedDeviceSize = screenSize; |
| 540 this._appliedDeviceScaleFactor = deviceScaleFactor || window.devicePixel
Ratio; | 540 this._appliedDeviceScaleFactor = deviceScaleFactor || window.devicePixel
Ratio; |
| 541 this._screenRect = new WebInspector.Rect( | 541 this._screenRect = new WebInspector.Rect( |
| 542 Math.max(0, (this._availableSize.width - screenSize.width * scale) /
2), | 542 Math.max(0, (this._availableSize.width - screenSize.width * scale) /
2), |
| 543 outline.top * scale, | 543 outline.top * scale, |
| 544 screenSize.width * scale, | 544 screenSize.width * scale, |
| 545 screenSize.height * scale); | 545 screenSize.height * scale); |
| 546 this._outlineRect = new WebInspector.Rect( | 546 this._outlineRect = new WebInspector.Rect( |
| 547 Math.max(0, this._screenRect.left - outline.left * scale), | 547 this._screenRect.left - outline.left * scale, |
| 548 0, | 548 0, |
| 549 (outline.left + screenSize.width + outline.right) * scale, | 549 (outline.left + screenSize.width + outline.right) * scale, |
| 550 (outline.top + screenSize.height + outline.bottom) * scale); | 550 (outline.top + screenSize.height + outline.bottom) * scale); |
| 551 this._visiblePageRect = new WebInspector.Rect( | 551 this._visiblePageRect = new WebInspector.Rect( |
| 552 positionX * scale, | 552 positionX * scale, |
| 553 positionY * scale, | 553 positionY * scale, |
| 554 Math.min(pageWidth * scale, this._availableSize.width - this._screen
Rect.left - positionX * scale), | 554 Math.min(pageWidth * scale, this._availableSize.width - this._screen
Rect.left - positionX * scale), |
| 555 Math.min(pageHeight * scale, this._availableSize.height - this._scre
enRect.top - positionY * scale)); | 555 Math.min(pageHeight * scale, this._availableSize.height - this._scre
enRect.top - positionY * scale)); |
| 556 this._scale = scale; | 556 this._scale = scale; |
| 557 | 557 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 | 602 |
| 603 /** | 603 /** |
| 604 * @param {boolean} touchEnabled | 604 * @param {boolean} touchEnabled |
| 605 * @param {boolean} mobile | 605 * @param {boolean} mobile |
| 606 */ | 606 */ |
| 607 _applyTouch: function(touchEnabled, mobile) | 607 _applyTouch: function(touchEnabled, mobile) |
| 608 { | 608 { |
| 609 WebInspector.MultitargetTouchModel.instance().setTouchEnabled(touchEnabl
ed, mobile); | 609 WebInspector.MultitargetTouchModel.instance().setTouchEnabled(touchEnabl
ed, mobile); |
| 610 } | 610 } |
| 611 } | 611 } |
| OLD | NEW |