Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 877 { | 877 { |
| 878 var userAgentShadowRoot = node.ancestorUserAgentShadowRoot(); | 878 var userAgentShadowRoot = node.ancestorUserAgentShadowRoot(); |
| 879 return userAgentShadowRoot ? /** @type {!WebInspector.DOMNode} */ (userA gentShadowRoot.parentNode) : node; | 879 return userAgentShadowRoot ? /** @type {!WebInspector.DOMNode} */ (userA gentShadowRoot.parentNode) : node; |
| 880 }, | 880 }, |
| 881 | 881 |
| 882 /** | 882 /** |
| 883 * @param {!WebInspector.DOMNode} node | 883 * @param {!WebInspector.DOMNode} node |
| 884 */ | 884 */ |
| 885 revealAndSelectNode: function(node) | 885 revealAndSelectNode: function(node) |
| 886 { | 886 { |
| 887 if (WebInspector.inspectElementModeController && WebInspector.inspectEle mentModeController.enabled()) { | 887 if (WebInspector.inspectElementModeController && WebInspector.inspectEle mentModeController.started()) { |
| 888 InspectorFrontendHost.bringToFront(); | 888 InspectorFrontendHost.bringToFront(); |
| 889 WebInspector.inspectElementModeController.disable(); | 889 WebInspector.inspectElementModeController.stop(); |
| 890 } | 890 } |
| 891 | 891 |
| 892 this._omitDefaultSelection = true; | 892 this._omitDefaultSelection = true; |
| 893 WebInspector.inspectorView.setCurrentPanel(this); | 893 WebInspector.inspectorView.setCurrentPanel(this, true); |
|
pfeldman
2015/08/24 23:18:14
Reveal node clearly needs to bring panel to front
sergeyv
2015/08/25 17:58:02
Done.
| |
| 894 node = WebInspector.moduleSetting("showUAShadowDOM").get() ? node : this ._leaveUserAgentShadowDOM(node); | 894 node = WebInspector.moduleSetting("showUAShadowDOM").get() ? node : this ._leaveUserAgentShadowDOM(node); |
| 895 var domModel = WebInspector.DOMModel.fromTarget(node.target()); | |
| 895 if (this._showLayoutEditor) | 896 if (this._showLayoutEditor) |
| 896 node.highlight(); | 897 node.highlightWithConfig({mode: "all", showLayoutEditor: true}); |
| 897 else | 898 else |
| 898 node.highlightForTwoSeconds(); | 899 node.highlightForTwoSeconds(); |
| 899 | 900 |
| 900 this.selectDOMNode(node, true); | 901 this.selectDOMNode(node, true); |
| 901 delete this._omitDefaultSelection; | 902 delete this._omitDefaultSelection; |
| 902 | 903 |
| 903 if (!this._notFirstInspectElement) | 904 if (!this._notFirstInspectElement) |
| 904 InspectorFrontendHost.inspectElementCompleted(); | 905 InspectorFrontendHost.inspectElementCompleted(); |
| 905 this._notFirstInspectElement = true; | 906 this._notFirstInspectElement = true; |
| 906 }, | 907 }, |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1096 } else { | 1097 } else { |
| 1097 this._elementsPanelTreeOutilneSplit.hideSidebar(true); | 1098 this._elementsPanelTreeOutilneSplit.hideSidebar(true); |
| 1098 } | 1099 } |
| 1099 }, | 1100 }, |
| 1100 | 1101 |
| 1101 _toggleLayoutEditor: function() | 1102 _toggleLayoutEditor: function() |
| 1102 { | 1103 { |
| 1103 this._showLayoutEditor = !this._showLayoutEditor; | 1104 this._showLayoutEditor = !this._showLayoutEditor; |
| 1104 this._layoutEditorButton.setToggled(this._showLayoutEditor); | 1105 this._layoutEditorButton.setToggled(this._showLayoutEditor); |
| 1105 var targets = WebInspector.targetManager.targets(); | 1106 var targets = WebInspector.targetManager.targets(); |
| 1107 | |
| 1108 | |
| 1109 if (this._showLayoutEditor) | |
| 1110 WebInspector.inspectElementModeController.disable(); | |
| 1111 else { | |
|
pfeldman
2015/08/24 23:18:14
drop {}
sergeyv
2015/08/25 17:58:02
Done.
| |
| 1112 WebInspector.inspectElementModeController.enable(); | |
| 1113 } | |
| 1114 | |
| 1106 for (var target of targets) { | 1115 for (var target of targets) { |
| 1107 var domModel = WebInspector.DOMModel.fromTarget(target); | 1116 var domModel = WebInspector.DOMModel.fromTarget(target); |
| 1108 if (!domModel) | 1117 if (!domModel) |
| 1109 continue; | 1118 continue; |
| 1110 | 1119 |
| 1111 var treeOutline = /** @type {!WebInspector.ElementsTreeOutline} */(t his._modelToTreeOutline.get(domModel)); | 1120 var treeOutline = /** @type {!WebInspector.ElementsTreeOutline} */(t his._modelToTreeOutline.get(domModel)); |
| 1112 if (this._showLayoutEditor) | 1121 if (this._showLayoutEditor) |
| 1113 domModel.setHighlighter(new WebInspector.ElementsPanel.LayoutEdi torNodeHighlighter(target, treeOutline)); | 1122 domModel.setHighlighter(new WebInspector.ElementsPanel.LayoutEdi torNodeHighlighter(target, treeOutline)); |
| 1114 else | 1123 else |
| 1115 domModel.setHighlighter(null); | 1124 domModel.setHighlighter(null); |
| 1116 | 1125 |
| 1117 // We need to correct (turn on/off layout editor) the config which i s used by inspect element mode, so we re-enable it. | 1126 domModel.setInspectModeEnabled(this._showLayoutEditor, "showLayoutEd itor"); |
| 1118 if (WebInspector.inspectElementModeController && WebInspector.inspec tElementModeController.enabled()) | |
| 1119 domModel.setInspectModeEnabled(true, WebInspector.moduleSetting( "showUAShadowDOM").get()); | |
| 1120 } | 1127 } |
| 1121 WebInspector.DOMModel.hideDOMNodeHighlight(); | 1128 WebInspector.DOMModel.hideDOMNodeHighlight(); |
| 1122 }, | 1129 }, |
| 1123 | 1130 |
| 1124 __proto__: WebInspector.Panel.prototype | 1131 __proto__: WebInspector.Panel.prototype |
| 1125 } | 1132 } |
| 1126 | 1133 |
| 1127 /** | 1134 /** |
| 1128 * @constructor | 1135 * @constructor |
| 1129 * @implements {WebInspector.ContextMenu.Provider} | 1136 * @implements {WebInspector.ContextMenu.Provider} |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1316 WebInspector.ElementsPanel.LayoutEditorNodeHighlighter.prototype = { | 1323 WebInspector.ElementsPanel.LayoutEditorNodeHighlighter.prototype = { |
| 1317 /** | 1324 /** |
| 1318 * @override | 1325 * @override |
| 1319 * @param {?WebInspector.DOMNode} node | 1326 * @param {?WebInspector.DOMNode} node |
| 1320 * @param {!DOMAgent.HighlightConfig} config | 1327 * @param {!DOMAgent.HighlightConfig} config |
| 1321 * @param {!DOMAgent.BackendNodeId=} backendNodeId | 1328 * @param {!DOMAgent.BackendNodeId=} backendNodeId |
| 1322 * @param {!RuntimeAgent.RemoteObjectId=} objectId | 1329 * @param {!RuntimeAgent.RemoteObjectId=} objectId |
| 1323 */ | 1330 */ |
| 1324 highlightDOMNode: function(node, config, backendNodeId, objectId) | 1331 highlightDOMNode: function(node, config, backendNodeId, objectId) |
| 1325 { | 1332 { |
| 1326 config.showLayoutEditor = config.showInfo; | |
| 1327 var selectedNode = this._treeOutline.selectedDOMNode(); | 1333 var selectedNode = this._treeOutline.selectedDOMNode(); |
| 1328 if (objectId || node || backendNodeId || !selectedNode) | 1334 if (objectId || node || backendNodeId || !selectedNode) { |
| 1329 WebInspector.DefaultDOMNodeHighlighter.prototype.highlightDOMNode.ca ll(this, node, config, backendNodeId, objectId); | 1335 WebInspector.DefaultDOMNodeHighlighter.prototype.highlightDOMNode.ca ll(this, node, config, backendNodeId, objectId); |
| 1330 else | 1336 } else { |
| 1337 config.showLayoutEditor = config.showInfo; | |
|
pfeldman
2015/08/24 23:18:14
Why is showInfo being converted into showLayoutEdi
sergeyv
2015/08/25 17:58:02
Removed this
| |
| 1331 WebInspector.DefaultDOMNodeHighlighter.prototype.highlightDOMNode.ca ll(this, selectedNode, config); | 1338 WebInspector.DefaultDOMNodeHighlighter.prototype.highlightDOMNode.ca ll(this, selectedNode, config); |
| 1339 } | |
| 1332 }, | 1340 }, |
| 1333 | |
| 1334 /** | |
| 1335 * @override | |
| 1336 * @param {boolean} enabled | |
| 1337 * @param {boolean} inspectUAShadowDOM | |
| 1338 * @param {!DOMAgent.HighlightConfig} config | |
| 1339 * @param {function(?Protocol.Error)=} callback | |
| 1340 */ | |
| 1341 setInspectModeEnabled: function(enabled, inspectUAShadowDOM, config, callbac k) | |
| 1342 { | |
| 1343 config.showLayoutEditor = config.showInfo; | |
|
pfeldman
2015/08/24 23:18:14
Where did this code go?
sergeyv
2015/08/25 17:58:02
To the backend
| |
| 1344 WebInspector.DefaultDOMNodeHighlighter.prototype.setInspectModeEnabled.c all(this, enabled, inspectUAShadowDOM, config, callback); | |
| 1345 | |
| 1346 if (enabled) | |
| 1347 return; | |
| 1348 | |
| 1349 var selectedNode = this._treeOutline.selectedDOMNode(); | |
| 1350 if (selectedNode) | |
| 1351 WebInspector.DefaultDOMNodeHighlighter.prototype.highlightDOMNode.ca ll(this, selectedNode, config); | |
| 1352 }, | |
| 1353 | |
| 1354 __proto__: WebInspector.DefaultDOMNodeHighlighter.prototype | 1341 __proto__: WebInspector.DefaultDOMNodeHighlighter.prototype |
| 1355 } | 1342 } |
| OLD | NEW |