Index: third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js |
index 8a4ada9a71243febea059befc1c80fbd93e107d3..3d078652bfea99c8f4ea1821f4edd12a47f43e09 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js |
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js |
@@ -129,16 +129,17 @@ WebInspector.DeviceModeModel.prototype = { |
emulate: function(type, device, mode) |
{ |
var resetPageScaleFactor = this._type !== type || this._device !== device || this._mode !== mode; |
+ var lastOrientation = this._mode ? this._mode.orientation : null; |
this._type = type; |
if (type === WebInspector.DeviceModeModel.Type.Device) { |
console.assert(device && mode, "Must pass device and mode for device emulation"); |
- this._device = device; |
- this._mode = mode; |
- if (this._initialized) { |
- var orientation = device.orientationByName(mode.orientation); |
- this._scaleSetting.set(this._calculateFitScale(orientation.width, orientation.height, this._currentOutline(), this._currentInsets())); |
dgozman
2016/10/19 00:42:45
I don't think that preserving zoom is a good idea.
luoe
2016/10/20 00:17:08
Zoom preservation removed from this CL. (This cod
|
+ if (this._device !== device && lastOrientation && lastOrientation !== mode.orientation) { |
dgozman
2016/10/19 00:42:45
This should be done in UI which calls emulate() me
luoe
2016/10/20 00:17:08
Done.
|
+ var matchingModes = device.modes.filter((mode) => mode.orientation === lastOrientation); |
+ mode = matchingModes[0] || mode; |
} |
+ this._mode = mode; |
+ this._device = device; |
} else { |
this._device = null; |
this._mode = null; |