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

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

Issue 1450133003: [DevTools] Promote Device Mode v2 to default experiments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweaks Created 5 years, 1 month 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/DeviceModeView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js
index a3874a64d8f48edb547139f4f8a363611381f415..0de0a287c5f13a7fff6a5716aa7775bf33a64b91 100644
--- a/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js
+++ b/third_party/WebKit/Source/devtools/front_end/emulation/DeviceModeView.js
@@ -165,7 +165,7 @@ WebInspector.DeviceModeView.prototype = {
this._loadScreenImage(this._model.screenImage());
if (resizePagePlaceholder)
this._inspectedPagePlaceholder.onResize();
- this._mediaInspector.setAxisTransform(-cssScreenRect.left, this._model.fitScale());
+ this._mediaInspector.setAxisTransform(-cssScreenRect.left / this._model.fitScale(), this._model.fitScale());
},
/**
@@ -404,12 +404,20 @@ WebInspector.DeviceModeView.Toolbar.prototype = {
{
select.removeChildren();
- addOption.call(this, select, WebInspector.DeviceModeModel.Type.Mobile, null, WebInspector.UIString("Responsive"));
+ var defaultGroup = select.createChild("optgroup");
+ defaultGroup.label = WebInspector.UIString("Default");
+ addOption.call(this, defaultGroup, WebInspector.DeviceModeModel.Type.Mobile, null, WebInspector.UIString("Responsive"));
- var group = select.createChild("optgroup");
- group.label = WebInspector.UIString("Devices");
- addGroup.call(this, group, WebInspector.emulatedDevicesList.custom());
- addGroup.call(this, group, WebInspector.emulatedDevicesList.standard());
+ var devicesGroup = select.createChild("optgroup");
+ devicesGroup.label = WebInspector.UIString("Devices");
+ addGroup.call(this, devicesGroup, WebInspector.emulatedDevicesList.standard());
+
+ var customGroup = select.createChild("optgroup");
+ customGroup.label = WebInspector.UIString("Custom");
+ addGroup.call(this, customGroup, WebInspector.emulatedDevicesList.custom());
+ var editCustomOption = new Option(WebInspector.UIString("Edit\u2026"), WebInspector.UIString("Edit\u2026"));
+ editCustomOption.edit = true;
+ customGroup.appendChild(editCustomOption);
}
/**
@@ -448,7 +456,21 @@ WebInspector.DeviceModeView.Toolbar.prototype = {
*/
function optionSelected()
{
- this._emulateDeviceSelectOption(select.options[select.selectedIndex]);
+ var option = select.options[select.selectedIndex];
+ if (option.edit) {
+ WebInspector.emulatedDevicesList.revealCustomSetting();
+ this._updateDeviceSelectedIndex();
+ } else {
+ this._emulateDeviceSelectOption(option);
+ }
+ }
+ },
+
+ _updateDeviceSelectedIndex: function()
+ {
+ for (var i = 0; i < this._deviceSelect.options.length; ++i) {
+ if (this._deviceSelect.options[i].device === this._model.device())
+ this._deviceSelect.selectedIndex = i;
}
},
@@ -596,11 +618,7 @@ WebInspector.DeviceModeView.Toolbar.prototype = {
var modeCount = device ? device.modes.length : 0;
this._modeToolbar.element.classList.toggle("hidden", modeCount < 2);
-
- for (var i = 0; i < this._deviceSelect.options.length; ++i) {
- if (this._deviceSelect.options[i].device === this._model.device())
- this._deviceSelect.selectedIndex = i;
- }
+ this._updateDeviceSelectedIndex();
this._cachedModelDevice = device;
}

Powered by Google App Engine
This is Rietveld 408576698