2012-01-30 Yury Semikhatsky <yurys@chromium.org>
+ Web Inspector: keyboard navigation through comparison view in heap profiler should update retainers view
+ https://bugs.webkit.org/show_bug.cgi?id=77326
+
+ Keyboard navigation in the detailed heap snapshot view now updates retainers view.
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/front-end/DataGrid.js: Added SelectedNode/DeselectedNode events to DataGrid.
+ (WebInspector.DataGridNode.prototype.select):
+ (WebInspector.DataGridNode.prototype.deselect):
+ * inspector/front-end/DetailedHeapshotView.js:
+ (WebInspector.DetailedHeapshotView.prototype._selectionChanged):
+ (WebInspector.DetailedHeapshotView.prototype._setRetainmentDataGridSource):
+
+2012-01-30 Yury Semikhatsky <yurys@chromium.org>
+
Unreviewed. Fix inspector front-end compilation.
* inspector/front-end/RemoteObject.js:
this._columnWidthsInitialized = false;
}
+WebInspector.DataGrid.Events = {
+ SelectedNode: "SelectedNode",
+ DeselectedNode: "DeselectedNode"
+}
+
/**
* @param {Array.<string>} columnNames
* @param {Array.<string>} values
if (this._element)
this._element.addStyleClass("selected");
- if (!supressSelectedEvent)
+ if (!supressSelectedEvent) {
this.dispatchEventToListeners("selected");
+ this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Events.SelectedNode);
+ }
},
revealAndSelect: function()
if (this._element)
this._element.removeStyleClass("selected");
- if (!supressDeselectedEvent)
+ if (!supressDeselectedEvent) {
this.dispatchEventToListeners("deselected");
+ this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Events.DeselectedNode);
+ }
},
traverseNextNode: function(skipHidden, stayWithin, dontPopulate, info)
this.containmentView = new WebInspector.View();
this.containmentView.element.addStyleClass("view");
this.containmentDataGrid = new WebInspector.HeapSnapshotContainmentDataGrid();
- this.containmentDataGrid.element.addEventListener("click", this._mouseClickInContentsGrid.bind(this), true);
this.containmentDataGrid.element.addEventListener("mousedown", this._mouseDownInContentsGrid.bind(this), true);
this.containmentDataGrid.show(this.containmentView.element);
+ this.containmentDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._selectionChanged, this);
this.constructorsView = new WebInspector.View();
this.constructorsView.element.addStyleClass("view");
this.constructorsDataGrid = new WebInspector.HeapSnapshotConstructorsDataGrid();
- this.constructorsDataGrid.element.addEventListener("click", this._mouseClickInContentsGrid.bind(this), true);
this.constructorsDataGrid.element.addEventListener("mousedown", this._mouseDownInContentsGrid.bind(this), true);
this.constructorsDataGrid.show(this.constructorsView.element);
+ this.constructorsDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._selectionChanged, this);
this.diffView = new WebInspector.View();
this.diffView.element.addStyleClass("view");
this.diffDataGrid = new WebInspector.HeapSnapshotDiffDataGrid();
- this.diffDataGrid.element.addEventListener("click", this._mouseClickInContentsGrid.bind(this), true);
this.diffDataGrid.show(this.diffView.element);
+ this.diffDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._selectionChanged, this);
this.dominatorView = new WebInspector.View();
this.dominatorView.element.addStyleClass("view");
this.dominatorDataGrid = new WebInspector.HeapSnapshotDominatorsDataGrid();
- this.dominatorDataGrid.element.addEventListener("click", this._mouseClickInContentsGrid.bind(this), true);
this.dominatorDataGrid.element.addEventListener("mousedown", this._mouseDownInContentsGrid.bind(this), true);
this.dominatorDataGrid.show(this.dominatorView.element);
+ this.dominatorDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._selectionChanged, this);
this.retainmentViewHeader = document.createElement("div");
this.retainmentViewHeader.addStyleClass("retainers-view-header");
profile.sidebarElement.subtitle = Number.bytesToString(s.totalSize);
},
- _mouseClickInContentsGrid: function(event)
+ _selectionChanged: function(event)
{
- var cell = event.target.enclosingNodeOrSelfWithNodeName("td");
- if (!cell || (!cell.hasStyleClass("object-column")))
- return;
- var row = event.target.enclosingNodeOrSelfWithNodeName("tr");
- if (!row)
- return;
- var nodeItem = row._dataGridNode;
- if (!nodeItem || nodeItem.isEventWithinDisclosureTriangle(event))
- return;
- if (nodeItem.snapshotNodeIndex)
+ var selectedNode = event.target.selectedNode;
+ this._setRetainmentDataGridSource(selectedNode);
+ },
+
+ _setRetainmentDataGridSource: function(nodeItem)
+ {
+ if (nodeItem && nodeItem.snapshotNodeIndex)
this.retainmentDataGrid.setDataSource(this, nodeItem.isDeletedNode ? nodeItem.dataGrid.baseSnapshot : nodeItem.dataGrid.snapshot, nodeItem.snapshotNodeIndex, nodeItem.isDeletedNode ? this.baseSelectElement.childNodes[this.baseSelectElement.selectedIndex].label + " | " : "");
else
this.retainmentDataGrid.reset();