Title: [117753] trunk/Source/WebCore
Revision
117753
Author
[email protected]
Date
2012-05-21 02:49:53 -0700 (Mon, 21 May 2012)

Log Message

Web Inspector: expand only neighbors of the highlighted node when revealing it in heap snapshot
https://bugs.webkit.org/show_bug.cgi?id=86998

Reviewed by Pavel Feldman.

Only nearest nodes are expanded when a node is revealed in heap snapshot
summary view.

* inspector/front-end/HeapSnapshotDataGrids.js:
(WebInspector.HeapSnapshotSortableDataGrid.prototype.highlightNode):
(WebInspector.HeapSnapshotViewportDataGrid.prototype.highlightNode):
(WebInspector.HeapSnapshotViewportDataGrid.prototype._isScrolledIntoView):
* inspector/front-end/HeapSnapshotGridNodes.js:
(WebInspector.HeapSnapshotConstructorNode.prototype.revealNodeBySnapshotObjectId):
(WebInspector.HeapSnapshotConstructorNode.prototype.revealNodeBySnapshotObjectId.didGetNodePosition):
* inspector/front-end/ProfilesPanel.js:
(WebInspector.ProfilesPanel.prototype.showProfile):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (117752 => 117753)


--- trunk/Source/WebCore/ChangeLog	2012-05-21 09:43:48 UTC (rev 117752)
+++ trunk/Source/WebCore/ChangeLog	2012-05-21 09:49:53 UTC (rev 117753)
@@ -1,3 +1,23 @@
+2012-05-21  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: expand only neighbors of the highlighted node when revealing it in heap snapshot
+        https://bugs.webkit.org/show_bug.cgi?id=86998
+
+        Reviewed by Pavel Feldman.
+
+        Only nearest nodes are expanded when a node is revealed in heap snapshot
+        summary view.
+
+        * inspector/front-end/HeapSnapshotDataGrids.js:
+        (WebInspector.HeapSnapshotSortableDataGrid.prototype.highlightNode):
+        (WebInspector.HeapSnapshotViewportDataGrid.prototype.highlightNode):
+        (WebInspector.HeapSnapshotViewportDataGrid.prototype._isScrolledIntoView):
+        * inspector/front-end/HeapSnapshotGridNodes.js:
+        (WebInspector.HeapSnapshotConstructorNode.prototype.revealNodeBySnapshotObjectId):
+        (WebInspector.HeapSnapshotConstructorNode.prototype.revealNodeBySnapshotObjectId.didGetNodePosition):
+        * inspector/front-end/ProfilesPanel.js:
+        (WebInspector.ProfilesPanel.prototype.showProfile):
+
 2012-05-21  Mikhail Pozdnyakov  <[email protected]>
 
         [EFL] PlatformKeyboardEventEfl is missing ESC key handling.

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js (117752 => 117753)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js	2012-05-21 09:43:48 UTC (rev 117752)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js	2012-05-21 09:49:53 UTC (rev 117753)
@@ -86,9 +86,18 @@
      */
     highlightNode: function(node)
     {
+        var prevNode = this._highlightedNode;
         this._clearCurrentHighlight();
         this._highlightedNode = node;
         this._highlightedNode.element.addStyleClass("highlighted-row");
+        // If highlighted node hasn't changed reinsert it to make the highlight animation restart.
+        if (node === prevNode) {
+            var element = node.element;
+            var parent = element.parentElement;
+            var nextSibling = element.nextSibling;
+            parent.removeChild(element);
+            parent.insertBefore(element, nextSibling);
+        }
     },
 
     nodeWasDetached: function(node)
@@ -278,10 +287,23 @@
      */
     highlightNode: function(node)
     {
-        node.element.scrollIntoViewIfNeeded(true);
-        this._nodeToHighlightAfterScroll = node;
+        if (this._isScrolledIntoView(node.element))
+            WebInspector.HeapSnapshotSortableDataGrid.prototype.highlightNode.call(this, node);
+        else {
+            node.element.scrollIntoViewIfNeeded(true);
+            this._nodeToHighlightAfterScroll = node;
+        }
     },
 
+    _isScrolledIntoView: function(element)
+    {
+        var viewportTop = this.scrollContainer.scrollTop;
+        var viewportBottom = viewportTop + this.scrollContainer.clientHeight;
+        var elemTop = element.offsetTop
+        var elemBottom = elemTop + element.offsetHeight;
+        return elemBottom <= viewportBottom && elemTop >= viewportTop;
+    },
+
     _addPaddingRows: function(top, bottom)
     {
         if (this._topPadding.element.parentNode !== this.dataTableBody)

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js (117752 => 117753)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js	2012-05-21 09:43:48 UTC (rev 117752)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js	2012-05-21 09:49:53 UTC (rev 117753)
@@ -728,9 +728,17 @@
      */
     revealNodeBySnapshotObjectId: function(snapshotObjectId)
     {
+        function didExpand()
+        {
+            this._provider.nodePosition(snapshotObjectId, didGetNodePosition.bind(this));
+        }
+
         function didGetNodePosition(nodePosition)
         {
-            if (nodePosition !== -1)
+            if (nodePosition === -1) {
+                this.collapse();
+                callback(null);
+            } else
                 this._populateChildren(nodePosition, null, didPopulateChildren.bind(this, nodePosition));
         }
 
@@ -749,8 +757,7 @@
             }
         }
 
-        this.expand();
-        this._provider.nodePosition(snapshotObjectId, didGetNodePosition.bind(this));
+        this.expandWithoutPopulate(didExpand.bind(this));
     },
 
     createCell: function(columnIdentifier)

Modified: trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js (117752 => 117753)


--- trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js	2012-05-21 09:43:48 UTC (rev 117752)
+++ trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js	2012-05-21 09:49:53 UTC (rev 117753)
@@ -558,10 +558,12 @@
         if (!profile || profile.isTemporary)
             return;
 
+        var view = profile.view();
+        if (view === this.visibleView)
+            return;
+
         this.closeVisibleView();
 
-        var view = profile.view();
-
         view.show(this.profileViews);
 
         profile._profilesTreeElement._suppressOnSelect = true;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to