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

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

Issue 964493002: DevTools: improve TTIE, do not select body before the target element upon inspect element. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: headless test fixed Created 5 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/core/inspector/InspectorInspectorAgent.cpp ('k') | Source/devtools/front_end/main/Main.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/elements/ElementsPanel.js
diff --git a/Source/devtools/front_end/elements/ElementsPanel.js b/Source/devtools/front_end/elements/ElementsPanel.js
index 04a3c673a8a04bed993aa48ac6e8601526b4aeaf..0c5b3641a416ed6a02f2b5b071cd0aaf880513ea 100644
--- a/Source/devtools/front_end/elements/ElementsPanel.js
+++ b/Source/devtools/front_end/elements/ElementsPanel.js
@@ -339,9 +339,11 @@ WebInspector.ElementsPanel.prototype = {
if (!candidateFocusNode)
return;
- this.selectDOMNode(candidateFocusNode);
- if (treeOutline.selectedTreeElement)
- treeOutline.selectedTreeElement.expand();
+ if (!this._pendingNodeReveal) {
+ this.selectDOMNode(candidateFocusNode);
+ if (treeOutline.selectedTreeElement)
+ treeOutline.selectedTreeElement.expand();
+ }
}
/**
@@ -1008,6 +1010,9 @@ WebInspector.ElementsPanel.DOMNodeRevealer.prototype = {
*/
reveal: function(node)
{
+ var panel = WebInspector.ElementsPanel.instance();
+ panel._pendingNodeReveal = true;
+
return new Promise(revealPromise);
/**
@@ -1016,21 +1021,24 @@ WebInspector.ElementsPanel.DOMNodeRevealer.prototype = {
*/
function revealPromise(resolve, reject)
{
- var panel = WebInspector.ElementsPanel.instance();
- if (node instanceof WebInspector.DOMNode)
+ if (node instanceof WebInspector.DOMNode) {
onNodeResolved(/** @type {!WebInspector.DOMNode} */ (node));
- else if (node instanceof WebInspector.DeferredDOMNode)
+ } else if (node instanceof WebInspector.DeferredDOMNode) {
(/** @type {!WebInspector.DeferredDOMNode} */ (node)).resolve(onNodeResolved);
- else if (node instanceof WebInspector.RemoteObject)
+ } else if (node instanceof WebInspector.RemoteObject) {
(/** @type {!WebInspector.RemoteObject} */ (node)).pushNodeToFrontend(onNodeResolved);
- else
+ } else {
reject(new Error("Can't reveal a non-node."));
+ panel._pendingNodeReveal = false;
+ }
/**
* @param {?WebInspector.DOMNode} resolvedNode
*/
function onNodeResolved(resolvedNode)
{
+ panel._pendingNodeReveal = false;
+
if (resolvedNode) {
panel.revealAndSelectNode(resolvedNode);
resolve(undefined);
« no previous file with comments | « Source/core/inspector/InspectorInspectorAgent.cpp ('k') | Source/devtools/front_end/main/Main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698