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

Unified Diff: third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js

Issue 2887183002: [DevTools] Fix Application Panel initial selection (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js b/third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js
index ae2fb72cbbb76b096ec17b6f09a78433bc85bdc6..d2e6d7af0541eb79cd8909bb23145fea78b8e1e7 100644
--- a/third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js
+++ b/third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js
@@ -40,6 +40,8 @@ Resources.ApplicationPanelSidebar = class extends UI.VBox {
this._panel = panel;
+ this._shouldRestoreSelection = true;
+
this._sidebarTree = new UI.TreeOutlineInShadow();
this._sidebarTree.element.classList.add('resources-sidebar');
this._sidebarTree.registerRequiredCSS('resources/resourcesSidebar.css');
@@ -105,8 +107,6 @@ Resources.ApplicationPanelSidebar = class extends UI.VBox {
/** @type {!Object.<string, boolean>} */
this._domains = {};
- this._shouldRestoreSelection = true;
-
this._sidebarTree.contentElement.addEventListener('mousemove', this._onmousemove.bind(this), false);
this._sidebarTree.contentElement.addEventListener('mouseleave', this._onmouseleave.bind(this), false);
@@ -115,6 +115,10 @@ Resources.ApplicationPanelSidebar = class extends UI.VBox {
SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this._frameNavigated, this);
SDK.targetManager.addModelListener(
SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this._willReloadPage, this);
+
+ var selection = this._panel.lastSelectedItemPath();
+ if (this._shouldRestoreSelection && !selection.length)
+ this._manifestTreeElement.select();
}
/**
@@ -244,14 +248,15 @@ Resources.ApplicationPanelSidebar = class extends UI.VBox {
return;
var element = event.data;
var index = selection.indexOf(element.itemURL);
- if (index > 0)
- element.expand();
- if (index)
+ if (index < 0)
return;
for (var parent = element.parent; parent; parent = parent.parent)
parent.expand();
+ if (index > 0)
+ element.expand();
element.select();
- this._shouldRestoreSelection = false;
+ if (index === 0)
+ this._shouldRestoreSelection = false;
}
_reset() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698