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

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

Issue 1604013002: [DevTools] Fix various bugs in Device Mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-main-menu
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 169602e3a1bca8fb0cae5d7d067c528a6888c3ea..cd7c40263fb6bfdf55e2992a35364ed3d4290e88 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeModel.js
@@ -21,14 +21,25 @@ WebInspector.DeviceModeModel = function(updateCallback)
this._appliedDeviceScaleFactor = 0;
this._scaleSetting = WebInspector.settings.createSetting("emulation.deviceScale", 1);
- this._scaleSetting.addChangeListener(this._scaleSettingChanged, this);
// We've used to allow zero before.
if (!this._scaleSetting.get())
this._scaleSetting.set(1);
+ this._scaleSetting.addChangeListener(this._scaleSettingChanged, this);
+
this._widthSetting = WebInspector.settings.createSetting("emulation.deviceWidth", 400);
+ if (this._widthSetting.get() < WebInspector.DeviceModeModel.MinDeviceSize)
+ this._widthSetting.set(WebInspector.DeviceModeModel.MinDeviceSize);
+ if (this._widthSetting.get() > WebInspector.DeviceModeModel.MaxDeviceSize)
+ this._widthSetting.set(WebInspector.DeviceModeModel.MaxDeviceSize);
this._widthSetting.addChangeListener(this._widthSettingChanged, this);
+
this._heightSetting = WebInspector.settings.createSetting("emulation.deviceHeight", 0);
+ if (this._heightSetting.get() && this._heightSetting.get() < WebInspector.DeviceModeModel.MinDeviceSize)
+ this._heightSetting.set(WebInspector.DeviceModeModel.MinDeviceSize);
+ if (this._heightSetting.get() > WebInspector.DeviceModeModel.MaxDeviceSize)
+ this._heightSetting.set(WebInspector.DeviceModeModel.MaxDeviceSize);
this._heightSetting.addChangeListener(this._heightSettingChanged, this);
+
this._uaSetting = WebInspector.settings.createSetting("emulation.deviceUA", WebInspector.DeviceModeModel.UA.Mobile);
this._uaSetting.addChangeListener(this._uaSettingChanged, this);
this._deviceScaleFactorSetting = WebInspector.settings.createSetting("emulation.deviceScaleFactor", 0);
@@ -70,6 +81,7 @@ WebInspector.DeviceModeModel.UA = {
DesktopTouch: "DesktopTouch"
}
+WebInspector.DeviceModeModel.MinDeviceSize = 50;
WebInspector.DeviceModeModel.MaxDeviceSize = 9999;
/**
@@ -78,7 +90,7 @@ WebInspector.DeviceModeModel.MaxDeviceSize = 9999;
*/
WebInspector.DeviceModeModel.deviceSizeValidator = function(value)
{
- if (/^[\d]+$/.test(value) && value > 0 && value <= WebInspector.DeviceModeModel.MaxDeviceSize)
+ if (/^[\d]+$/.test(value) && value >= WebInspector.DeviceModeModel.MinDeviceSize && value <= WebInspector.DeviceModeModel.MaxDeviceSize)
return "";
return WebInspector.UIString("Value must be positive integer");
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698