Skip to content

Commit

Permalink
[DevTools] Restore show rulers functionality.
Browse files Browse the repository at this point in the history
This was regressed by device mode cleanup.

BUG=588523

Review URL: https://codereview.chromium.org/1719173002

Cr-Commit-Position: refs/heads/master@{#376792}
  • Loading branch information
dgozman authored and Commit bot committed Feb 22, 2016
1 parent 97f87ca commit 9ae3c2c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 22 deletions.
9 changes: 0 additions & 9 deletions front_end/elements/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,6 @@
"settingType": "boolean",
"defaultValue": true
},
{
"type": "setting",
"category": "Elements",
"order": 3,
"title": "Show rulers",
"settingName": "showMetricsRulers",
"settingType": "boolean",
"defaultValue": false
},
{
"type": "setting",
"category": "Elements",
Expand Down
20 changes: 20 additions & 0 deletions front_end/main/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1115,4 +1115,24 @@ WebInspector.AutoAttachToCreatedPagesSync.prototype = {
}
}

/**
* @constructor
* @implements {WebInspector.SettingUI}
*/
WebInspector.ShowMetricsRulersSettingUI = function()
{
}

WebInspector.ShowMetricsRulersSettingUI.prototype = {
/**
* @override
* @return {?Element}
*/
settingElement: function()
{
return WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Show rulers"), WebInspector.moduleSetting("showMetricsRulers"));
}
}


new WebInspector.Main();
6 changes: 6 additions & 0 deletions front_end/main/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@
"category": "Extensions",
"className": "WebInspector.HandlerRegistry.OpenAnchorLocationSettingUI"
},
{
"type": "@WebInspector.SettingUI",
"category": "Elements",
"order": 3,
"className": "WebInspector.ShowMetricsRulersSettingUI"
},
{
"type": "context-menu-item",
"location": "mainMenu/navigate",
Expand Down
14 changes: 1 addition & 13 deletions front_end/sdk/DOMModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1084,8 +1084,6 @@ WebInspector.DOMModel = function(target) {
this._attributeLoadNodeIds = {};
target.registerDOMDispatcher(new WebInspector.DOMDispatcher(this));

this._showRulers = false;
this._showExtensionLines = false;
this._inspectModeEnabled = false;

this._defaultHighlighter = new WebInspector.DefaultDOMNodeHighlighter(this._agent);
Expand Down Expand Up @@ -1802,24 +1800,14 @@ WebInspector.DOMModel.prototype = {
return this._inspectModeEnabled;
},

/**
* @param {boolean} showRulers
* @param {boolean} showExtensionLines
*/
setHighlightSettings: function(showRulers, showExtensionLines)
{
this._showRulers = showRulers;
this._showExtensionLines = showExtensionLines;
},

/**
* @param {string=} mode
* @return {!DOMAgent.HighlightConfig}
*/
_buildHighlightConfig: function(mode)
{
mode = mode || "all";
var highlightConfig = { showInfo: mode === "all", showRulers: this._showRulers, showExtensionLines: this._showExtensionLines };
var highlightConfig = { showInfo: mode === "all", showRulers: WebInspector.moduleSetting("showMetricsRulers").get(), showExtensionLines: true };
if (mode === "all" || mode === "content")
highlightConfig.contentColor = WebInspector.Color.PageHighlight.Content.toProtocolRGBA();

Expand Down
6 changes: 6 additions & 0 deletions front_end/sdk/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
"settingName": "enableAsyncStackTraces",
"settingType": "boolean",
"defaultValue": false
},
{
"type": "setting",
"settingName": "showMetricsRulers",
"settingType": "boolean",
"defaultValue": false
}
],
"scripts": [
Expand Down

0 comments on commit 9ae3c2c

Please sign in to comment.