Title: [198707] trunk/Source/WebInspectorUI
- Revision
- 198707
- Author
- [email protected]
- Date
- 2016-03-25 20:45:01 -0700 (Fri, 25 Mar 2016)
Log Message
Web Inspector: Sometimes clearing focused nodes in ProfileView leaves a dangling call stack that can never be removed
https://bugs.webkit.org/show_bug.cgi?id=155915
Patch by Joseph Pecoraro <[email protected]> on 2016-03-25
Reviewed by Timothy Hatcher.
* UserInterface/Views/ProfileDataGridTree.js:
(WebInspector.ProfileDataGridTree.prototype.addFocusNode):
(WebInspector.ProfileDataGridTree.prototype.rollbackFocusNode):
(WebInspector.ProfileDataGridTree.prototype.clearFocusNodes):
(WebInspector.ProfileDataGridTree.prototype._focusChanged):
(WebInspector.ProfileDataGridTree.prototype._saveFocusedNodeOriginalParent):
(WebInspector.ProfileDataGridTree.prototype._restoreFocusedNodeToOriginalParent):
Be a little more explicit about saving and resotring nodes.
When restoring, work around a DataGrid issue by temporarily
collapsing and expanding the part of the node we are being
reattached to. This is a cheap workaround for an otherwise
complex DataGrid / DataGridTree issue.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (198706 => 198707)
--- trunk/Source/WebInspectorUI/ChangeLog 2016-03-26 02:09:34 UTC (rev 198706)
+++ trunk/Source/WebInspectorUI/ChangeLog 2016-03-26 03:45:01 UTC (rev 198707)
@@ -1,3 +1,23 @@
+2016-03-25 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Sometimes clearing focused nodes in ProfileView leaves a dangling call stack that can never be removed
+ https://bugs.webkit.org/show_bug.cgi?id=155915
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Views/ProfileDataGridTree.js:
+ (WebInspector.ProfileDataGridTree.prototype.addFocusNode):
+ (WebInspector.ProfileDataGridTree.prototype.rollbackFocusNode):
+ (WebInspector.ProfileDataGridTree.prototype.clearFocusNodes):
+ (WebInspector.ProfileDataGridTree.prototype._focusChanged):
+ (WebInspector.ProfileDataGridTree.prototype._saveFocusedNodeOriginalParent):
+ (WebInspector.ProfileDataGridTree.prototype._restoreFocusedNodeToOriginalParent):
+ Be a little more explicit about saving and resotring nodes.
+ When restoring, work around a DataGrid issue by temporarily
+ collapsing and expanding the part of the node we are being
+ reattached to. This is a cheap workaround for an otherwise
+ complex DataGrid / DataGridTree issue.
+
2016-03-25 Matt Baker <[email protected]>
Web Inspector: Clicking a result in Quick Open dialog dismisses the dialog, does nothing
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridTree.js (198706 => 198707)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridTree.js 2016-03-26 02:09:34 UTC (rev 198706)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridTree.js 2016-03-26 03:45:01 UTC (rev 198707)
@@ -154,7 +154,7 @@
console.assert(profileDataGridNode instanceof WebInspector.ProfileDataGridNode);
// Save the original parent for when we rollback.
- profileDataGridNode.__previousParent = profileDataGridNode.parent === profileDataGridNode.dataGrid ? this : profileDataGridNode.parent;
+ this._saveFocusedNodeOriginalParent(profileDataGridNode);
this._focusNodes.push(profileDataGridNode);
this._focusChanged();
@@ -170,6 +170,8 @@
if (index === -1)
return;
+ this._focusParentsToExpand = [];
+
for (let i = index + 1; i < this._focusNodes.length; ++i)
this._restoreFocusedNodeToOriginalParent(this._focusNodes[i]);
@@ -180,6 +182,8 @@
clearFocusNodes()
{
+ this._focusParentsToExpand = [];
+
for (let profileDataGridNode of this._focusNodes)
this._restoreFocusedNodeToOriginalParent(profileDataGridNode);
@@ -227,17 +231,19 @@
_focusChanged()
{
let profileDataGridNode = this.currentFocusNode;
- if (profileDataGridNode) {
+ if (profileDataGridNode)
this._updateCurrentFocusDetails(profileDataGridNode);
- if (profileDataGridNode.parent)
- profileDataGridNode.parent.removeChild(profileDataGridNode);
- }
-
// FIXME: This re-creates top level children, without remembering their expanded / unexpanded state.
this._repopulate();
this.dispatchEventToListeners(WebInspector.ProfileDataGridTree.Event.FocusChanged);
+
+ if (this._focusParentsToExpand) {
+ for (let profileDataGridNode of this._focusParentsToExpand)
+ profileDataGridNode.expand();
+ this._focusParentsToExpand = null;
+ }
}
_updateCurrentFocusDetails(focusDataGridNode)
@@ -250,8 +256,31 @@
this._currentFocusNumberOfSamples = timestampsInRange.length;
}
+ _saveFocusedNodeOriginalParent(focusDataGridNode)
+ {
+ focusDataGridNode.__previousParent = focusDataGridNode.parent;
+ focusDataGridNode.__previousParent.removeChild(focusDataGridNode);
+ }
+
_restoreFocusedNodeToOriginalParent(focusDataGridNode)
{
+ // NOTE: A DataGridTree maintains a list of children but those
+ // children get adopted by the DataGrid in ProfileView and
+ // actually displayed. When we focused this DataGridNode, its
+ // parent was removed from the real DataGrid, but if it was not
+ // at the top level it was not detached. When we re-append
+ // ourselves onto the previous parent, if it still thinks it is
+ // attached and expanded it will attach us immediately, which
+ // can create an orphaned <tr> in the DataGrid that is not one
+ // of the DataGrid's immediate children.
+ //
+ // Workaround this by:
+ // - collapsing our parent to prevent attaching when we get added.
+ // - reparent to our previous parent.
+ // - expanding our parent after the DataGrid has had a chance to update.
+ focusDataGridNode.__previousParent.collapse();
+ this._focusParentsToExpand.push(focusDataGridNode.__previousParent);
+
focusDataGridNode.__previousParent.appendChild(focusDataGridNode);
focusDataGridNode.__previousParent = undefined;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes