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

Unified Diff: Source/devtools/front_end/ElementsPanel.js

Issue 177653004: DevTools: Get rid of redundant default selection during inspectElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master Created 6 years, 10 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 | « Source/devtools/front_end/DOMAgent.js ('k') | Source/devtools/front_end/ScreencastView.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ElementsPanel.js
diff --git a/Source/devtools/front_end/ElementsPanel.js b/Source/devtools/front_end/ElementsPanel.js
index 707c4c0ff64b47ba3e7857bab59b416825513225..53e762263411ce3f65225e20474270a63eef364b 100644
--- a/Source/devtools/front_end/ElementsPanel.js
+++ b/Source/devtools/front_end/ElementsPanel.js
@@ -119,9 +119,6 @@ WebInspector.ElementsPanel = function()
WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this._documentUpdatedEvent, this);
WebInspector.settings.showShadowDOM.addChangeListener(this._showShadowDOMChanged.bind(this));
- if (WebInspector.domAgent.existingDocument())
- this._documentUpdated(WebInspector.domAgent.existingDocument());
-
WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.ModelWasEnabled, this._updateSidebars, this);
}
@@ -168,7 +165,10 @@ WebInspector.ElementsPanel.prototype = {
this.treeOutline.setVisible(true);
if (!this.treeOutline.rootDOMNode)
- WebInspector.domAgent.requestDocument();
+ if (WebInspector.domAgent.existingDocument())
+ this._documentUpdated(WebInspector.domAgent.existingDocument());
+ else
+ WebInspector.domAgent.requestDocument();
},
willHide: function()
@@ -188,6 +188,16 @@ WebInspector.ElementsPanel.prototype = {
this._updateTreeOutlineVisibleWidth();
},
+ omitDefaultSelection: function()
+ {
+ this._omitDefaultSelection = true;
+ },
+
+ stopOmittingDefaultSelection: function()
+ {
+ delete this._omitDefaultSelection;
+ },
+
/**
* @param {!DOMAgent.NodeId} nodeId
* @param {string} pseudoClass
@@ -312,6 +322,9 @@ WebInspector.ElementsPanel.prototype = {
selectNode.call(this, node);
}
+ if (this._omitDefaultSelection)
+ return;
+
if (this._selectedPathOnReset)
WebInspector.domAgent.pushNodeByPathToFrontend(this._selectedPathOnReset, selectLastSelectedNode.bind(this));
else
@@ -1350,7 +1363,14 @@ WebInspector.ElementsPanel.DOMNodeRevealer.prototype = {
*/
reveal: function(node)
{
- if (node instanceof WebInspector.DOMNode)
- /** @type {!WebInspector.ElementsPanel} */ (WebInspector.showPanel("elements")).revealAndSelectNode(node.id);
+ if (!(node instanceof WebInspector.DOMNode))
+ return;
+
+ if (WebInspector.inspectElementModeController && WebInspector.inspectElementModeController.enabled()) {
+ InspectorFrontendHost.bringToFront();
+ WebInspector.inspectElementModeController.disable();
+ }
+
+ /** @type {!WebInspector.ElementsPanel} */ (WebInspector.panel("elements")).revealAndSelectNode(node.id);
}
}
« no previous file with comments | « Source/devtools/front_end/DOMAgent.js ('k') | Source/devtools/front_end/ScreencastView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698