Skip to content

Commit

Permalink
squash 'resources/unpacked/devtools' changes from bd8029e..d8952e0
Browse files Browse the repository at this point in the history
d8952e0 DevTools: [SASS] introduce workspace/cssModel adapter for SASS processor.
80679d4 DevTools: [regression] Folder is not being visually removed from sources section.
261b078 Regression:[Devtools]Unable to close 'This script is blackboxed..' warning message without closing 'pretty print' infobar.
cbb2d3a [DevTools] Remove old responsive design v1 code.
6d92da9 Devtools: Fix enter to accept autocomplete in styles pane
22a3d04 DevTools: migrate injectedscript from ScriptValue to v8::Global.
043b2f5 DevTools: Fix sorting method in network panel
d18230d [DevTools] Do not use OverridesSupport anywhere.
ed28363 Timeline: simplify handling of event category colors
cbb569a [DevTools] Initialize DeviceModeView lazily.
01dfd0f [DevTools] Do not reset scroll when emulating device.
7861c97 Add "Request app banner" context menu in DevTools

git-subtree-dir: resources/unpacked/devtools
git-subtree-split: d8952e0
  • Loading branch information
darwin committed Jan 30, 2016
1 parent 8d19e44 commit 1d89f4b
Show file tree
Hide file tree
Showing 44 changed files with 928 additions and 3,131 deletions.
12 changes: 3 additions & 9 deletions devtools.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
],
'devtools_sass_js_files': [
'front_end/sass/SASSLiveSourceMap.js',
'front_end/sass/SASSWorkspaceAdapter.js',
'front_end/sass/SASSSupport.js',
],
'devtools_screencast_js_files': [
Expand Down Expand Up @@ -199,20 +200,15 @@
'front_end/emulation/deviceModeToolbar.css',
'front_end/emulation/deviceModeView.css',
'front_end/emulation/mediaQueryInspector.css',
'front_end/emulation/overrides.css',
'front_end/emulation/sensors.css',
'front_end/emulation/responsiveDesignView.css',
'front_end/emulation/DeviceModeButton.js',
'front_end/emulation/DeviceModeModel.js',
'front_end/emulation/DeviceModeView.js',
'front_end/emulation/DeviceOrientation.js',
'front_end/emulation/DevicesSettingsTab.js',
'front_end/emulation/EmulatedDevices.js',
'front_end/emulation/Geolocation.js',
'front_end/emulation/InspectedPagePlaceholder.js',
'front_end/emulation/MediaQueryInspector.js',
'front_end/emulation/OverridesSupport.js',
'front_end/emulation/OverridesView.js',
'front_end/emulation/OverridesUI.js',
'front_end/emulation/ResponsiveDesignView.js',
'front_end/emulation/SensorsView.js',
],
'devtools_ui_js_files': [
Expand Down Expand Up @@ -822,8 +818,6 @@
'front_end/Images/resourcePlainIcon.png',
'front_end/Images/resourcePlainIconSmall.png',
'front_end/Images/resourcesTimeGraphIcon.png',
'front_end/Images/responsiveDesign.png',
'front_end/Images/responsiveDesign_2x.png',
'front_end/Images/searchNext.png',
'front_end/Images/searchPrev.png',
'front_end/Images/securityPropertyInfo.svg',
Expand Down
Binary file removed front_end/Images/responsiveDesign.png
Binary file not shown.
Binary file removed front_end/Images/responsiveDesign_2x.png
Binary file not shown.
3 changes: 1 addition & 2 deletions front_end/Images/src/optimize_png.hashes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
"errorWave.svg": "e183fa242a22ed4784a92f6becbc2c45",
"settingsListRemove.svg": "ce9e7c5c5cdaef28e6ee51d9478d5485",
"toolbarButtonGlyphs.svg": "9cb447c4c5e8e65ae5c9a32983a6e515",
"breakpoint.svg": "69cd92d807259c022791112809b97799",
"responsiveDesign.svg": "1d6e963f88e5e448a7cff85f75a0e6b0"
"breakpoint.svg": "69cd92d807259c022791112809b97799"
}
14 changes: 0 additions & 14 deletions front_end/Images/src/responsiveDesign.svg

This file was deleted.

3 changes: 1 addition & 2 deletions front_end/Images/src/svg2png.hashes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
"errorWave.svg": "e183fa242a22ed4784a92f6becbc2c45",
"settingsListRemove.svg": "ce9e7c5c5cdaef28e6ee51d9478d5485",
"toolbarButtonGlyphs.svg": "9cb447c4c5e8e65ae5c9a32983a6e515",
"breakpoint.svg": "69cd92d807259c022791112809b97799",
"responsiveDesign.svg": "1d6e963f88e5e448a7cff85f75a0e6b0"
"breakpoint.svg": "69cd92d807259c022791112809b97799"
}
3 changes: 2 additions & 1 deletion front_end/elements/StylesSidebarPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -2729,7 +2729,8 @@ WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype = {
}
break;
case "Enter":
if (this.autoCompleteElement && !this.autoCompleteElement.textContent.length) {
// Accept any available autocompletions and advance to the next field.
if (this.autoCompleteElement && this.autoCompleteElement.textContent.length) {
this.tabKeyPressed();
return;
}
Expand Down
65 changes: 0 additions & 65 deletions front_end/emulation/DeviceModeButton.js

This file was deleted.

40 changes: 28 additions & 12 deletions front_end/emulation/DeviceModeModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ WebInspector.DeviceModeModel.deviceSizeValidator = function(value)
return WebInspector.UIString("Value must be positive integer");
}

/**
* @param {string} value
* @return {string}
*/
WebInspector.DeviceModeModel.deviceScaleFactorValidator = function(value)
{
if (!value || (/^[\d]+(\.\d+)?|\.\d+$/.test(value) && value >= 0 && value <= 10))
return "";
return WebInspector.UIString("Value must be non-negative float");
}

WebInspector.DeviceModeModel._touchEventsScriptIdSymbol = Symbol("DeviceModeModel.touchEventsScriptIdSymbol");
WebInspector.DeviceModeModel._defaultMobileUserAgent = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36";
WebInspector.DeviceModeModel._defaultMobileScaleFactor = 2;
Expand All @@ -119,7 +130,7 @@ WebInspector.DeviceModeModel.prototype = {
*/
emulate: function(type, device, mode)
{
var resetScrollAndPageScale = this._type !== type || this._device !== device || this._mode !== mode;
var resetPageScaleFactor = this._type !== type || this._device !== device || this._mode !== mode;
this._type = type;

if (type === WebInspector.DeviceModeModel.Type.Device) {
Expand All @@ -137,7 +148,7 @@ WebInspector.DeviceModeModel.prototype = {

if (type !== WebInspector.DeviceModeModel.Type.None)
WebInspector.userMetrics.actionTaken(WebInspector.UserMetrics.Action.DeviceModeEnabled);
this._calculateAndEmulate(resetScrollAndPageScale);
this._calculateAndEmulate(resetPageScaleFactor);
},

/**
Expand Down Expand Up @@ -373,6 +384,11 @@ WebInspector.DeviceModeModel.prototype = {
this._target = null;
},

requestAppBanner: function()
{
this._target.pageAgent().requestAppBanner();
},

_scaleSettingChanged: function()
{
this._calculateAndEmulate(true);
Expand Down Expand Up @@ -415,23 +431,23 @@ WebInspector.DeviceModeModel.prototype = {
},

/**
* @param {boolean} resetScrollAndPageScale
* @param {boolean} resetPageScaleFactor
*/
_calculateAndEmulate: function(resetScrollAndPageScale)
_calculateAndEmulate: function(resetPageScaleFactor)
{
if (!this._target)
this._onTargetAvailable = this._calculateAndEmulate.bind(this, resetScrollAndPageScale);
this._onTargetAvailable = this._calculateAndEmulate.bind(this, resetPageScaleFactor);

if (this._type === WebInspector.DeviceModeModel.Type.Device) {
var orientation = this._device.orientationByName(this._mode.orientation);
this._fitScale = this._calculateFitScale(orientation.width, orientation.height);
this._applyDeviceMetrics(new Size(orientation.width, orientation.height), this._mode.insets, this._scaleSetting.get(), this._device.deviceScaleFactor, this._device.mobile(), resetScrollAndPageScale);
this._applyDeviceMetrics(new Size(orientation.width, orientation.height), this._mode.insets, this._scaleSetting.get(), this._device.deviceScaleFactor, this._device.mobile(), resetPageScaleFactor);
this._applyUserAgent(this._device.userAgent);
this._applyTouch(this._device.touch(), this._device.mobile());
this._applyScreenOrientation(this._mode.orientation == WebInspector.EmulatedDevice.Horizontal ? "landscapePrimary" : "portraitPrimary");
} else if (this._type === WebInspector.DeviceModeModel.Type.None) {
this._fitScale = this._calculateFitScale(this._availableSize.width, this._availableSize.height);
this._applyDeviceMetrics(this._availableSize, new Insets(0, 0, 0, 0), 1, 0, false, resetScrollAndPageScale);
this._applyDeviceMetrics(this._availableSize, new Insets(0, 0, 0, 0), 1, 0, false, resetPageScaleFactor);
this._applyUserAgent("");
this._applyTouch(false, false);
this._applyScreenOrientation("");
Expand All @@ -445,7 +461,7 @@ WebInspector.DeviceModeModel.prototype = {
var mobile = this._uaSetting.get() === WebInspector.DeviceModeModel.UA.Mobile;
var defaultDeviceScaleFactor = mobile ? WebInspector.DeviceModeModel._defaultMobileScaleFactor : 0;
this._fitScale = this._calculateFitScale(this._widthSetting.get(), this._heightSetting.get());
this._applyDeviceMetrics(new Size(screenWidth, screenHeight), new Insets(0, 0, 0, 0), this._scaleSetting.get(), this._deviceScaleFactorSetting.get() || defaultDeviceScaleFactor, mobile, resetScrollAndPageScale);
this._applyDeviceMetrics(new Size(screenWidth, screenHeight), new Insets(0, 0, 0, 0), this._scaleSetting.get(), this._deviceScaleFactorSetting.get() || defaultDeviceScaleFactor, mobile, resetPageScaleFactor);
this._applyUserAgent(mobile ? WebInspector.DeviceModeModel._defaultMobileUserAgent : "");
this._applyTouch(this._uaSetting.get() !== WebInspector.DeviceModeModel.UA.Desktop, mobile);
this._applyScreenOrientation(screenHeight >= screenWidth ? "portraitPrimary" : "landscapePrimary");
Expand Down Expand Up @@ -488,9 +504,9 @@ WebInspector.DeviceModeModel.prototype = {
* @param {number} scale
* @param {number} deviceScaleFactor
* @param {boolean} mobile
* @param {boolean} resetScrollAndPageScale
* @param {boolean} resetPageScaleFactor
*/
_applyDeviceMetrics: function(screenSize, insets, scale, deviceScaleFactor, mobile, resetScrollAndPageScale)
_applyDeviceMetrics: function(screenSize, insets, scale, deviceScaleFactor, mobile, resetPageScaleFactor)
{
screenSize.width = Math.max(1, Math.floor(screenSize.width));
screenSize.height = Math.max(1, Math.floor(screenSize.height));
Expand Down Expand Up @@ -541,8 +557,8 @@ WebInspector.DeviceModeModel.prototype = {
this._target.emulationAgent().clearDeviceMetricsOverride(this._deviceMetricsOverrideAppliedForTest.bind(this)) :
this._target.emulationAgent().setDeviceMetricsOverride(pageWidth, pageHeight, deviceScaleFactor, mobile, false, scale, 0, 0, screenSize.width, screenSize.height, positionX, positionY, this._deviceMetricsOverrideAppliedForTest.bind(this));
var allPromises = [ setDevicePromise ];
if (resetScrollAndPageScale)
allPromises.push(this._target.emulationAgent().resetScrollAndPageScaleFactor());
if (resetPageScaleFactor)
allPromises.push(this._target.emulationAgent().resetPageScaleFactor());
return Promise.all(allPromises);
}
},
Expand Down
33 changes: 26 additions & 7 deletions front_end/emulation/DeviceModeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ WebInspector.DeviceModeView.Toolbar.prototype = {
contextMenu.appendCheckboxItem(WebInspector.UIString("Show media queries"), this._toggleMediaInspector.bind(this), this._showMediaInspectorSetting.get(), this._model.type() === WebInspector.DeviceModeModel.Type.None);
contextMenu.appendCheckboxItem(WebInspector.UIString("Show rulers"), this._toggleRulers.bind(this), this._showRulersSetting.get(), this._model.type() === WebInspector.DeviceModeModel.Type.None);
contextMenu.appendItem(WebInspector.UIString("Configure network\u2026"), this._openNetworkConfig.bind(this), false);
contextMenu.appendItemsAtLocation("deviceModeMenu");
},

_toggleMediaInspector: function()
Expand Down Expand Up @@ -1030,9 +1031,15 @@ WebInspector.DeviceModeView.ActionDelegate.prototype = {
*/
handleAction: function(context, actionId)
{
if (actionId === "emulation.toggle-device-mode" && WebInspector.DeviceModeView._wrapperInstance) {
WebInspector.DeviceModeView._wrapperInstance._toggleDeviceMode();
return true;
if (WebInspector.DeviceModeView._wrapperInstance) {
if (actionId === "emulation.toggle-device-mode") {
WebInspector.DeviceModeView._wrapperInstance._toggleDeviceMode();
return true;
}
if (actionId === "emulation.request-app-banner") {
WebInspector.DeviceModeView._wrapperInstance._requestAppBanner();
return true;
}
}
return false;
}
Expand All @@ -1049,7 +1056,8 @@ WebInspector.DeviceModeView.Wrapper = function(inspectedPagePlaceholder)
WebInspector.VBox.call(this);
WebInspector.DeviceModeView._wrapperInstance = this;
this._inspectedPagePlaceholder = inspectedPagePlaceholder;
this._deviceModeView = new WebInspector.DeviceModeView();
/** @type {?WebInspector.DeviceModeView} */
this._deviceModeView = null;
this._toggleDeviceModeAction = WebInspector.actionRegistry.action("emulation.toggle-device-mode");
this._showDeviceModeSetting = WebInspector.settings.createSetting("emulation.showDeviceMode", false);
this._showDeviceModeSetting.addChangeListener(this._update.bind(this, false));
Expand All @@ -1071,19 +1079,30 @@ WebInspector.DeviceModeView.Wrapper.prototype = {
_update: function(force)
{
this._toggleDeviceModeAction.setToggled(this._showDeviceModeSetting.get());
if (!force && this._showDeviceModeSetting.get() === this._deviceModeView.isShowing())
return;
if (!force) {
var showing = this._deviceModeView && this._deviceModeView.isShowing();
if (this._showDeviceModeSetting.get() === showing)
return;
}

if (this._showDeviceModeSetting.get()) {
if (!this._deviceModeView)
this._deviceModeView = new WebInspector.DeviceModeView();
this._deviceModeView.show(this.element);
this._inspectedPagePlaceholder.clearMinimumSizeAndMargins();
this._inspectedPagePlaceholder.show(this._deviceModeView.element);
} else {
this._deviceModeView.detach();
if (this._deviceModeView)
this._deviceModeView.detach();
this._inspectedPagePlaceholder.restoreMinimumSizeAndMargins();
this._inspectedPagePlaceholder.show(this.element);
}
},

_requestAppBanner: function()
{
this._deviceModeView._model.requestAppBanner();
},

__proto__: WebInspector.VBox.prototype
}
Loading

0 comments on commit 1d89f4b

Please sign in to comment.