Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1348)

Unified Diff: third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js

Issue 2431823002: DevTools: device mode devices remember last used zoom (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698