Changeset 117753 in webkit


Ignore:
Timestamp:
May 21, 2012 2:49:53 AM (12 years ago)
Author:
yurys@chromium.org
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):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r117752 r117753  
     12012-05-21  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Web Inspector: expand only neighbors of the highlighted node when revealing it in heap snapshot
     4        https://bugs.webkit.org/show_bug.cgi?id=86998
     5
     6        Reviewed by Pavel Feldman.
     7
     8        Only nearest nodes are expanded when a node is revealed in heap snapshot
     9        summary view.
     10
     11        * inspector/front-end/HeapSnapshotDataGrids.js:
     12        (WebInspector.HeapSnapshotSortableDataGrid.prototype.highlightNode):
     13        (WebInspector.HeapSnapshotViewportDataGrid.prototype.highlightNode):
     14        (WebInspector.HeapSnapshotViewportDataGrid.prototype._isScrolledIntoView):
     15        * inspector/front-end/HeapSnapshotGridNodes.js:
     16        (WebInspector.HeapSnapshotConstructorNode.prototype.revealNodeBySnapshotObjectId):
     17        (WebInspector.HeapSnapshotConstructorNode.prototype.revealNodeBySnapshotObjectId.didGetNodePosition):
     18        * inspector/front-end/ProfilesPanel.js:
     19        (WebInspector.ProfilesPanel.prototype.showProfile):
     20
    1212012-05-21  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
    222
  • trunk/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js

    r117051 r117753  
    8787    highlightNode: function(node)
    8888    {
     89        var prevNode = this._highlightedNode;
    8990        this._clearCurrentHighlight();
    9091        this._highlightedNode = node;
    9192        this._highlightedNode.element.addStyleClass("highlighted-row");
     93        // If highlighted node hasn't changed reinsert it to make the highlight animation restart.
     94        if (node === prevNode) {
     95            var element = node.element;
     96            var parent = element.parentElement;
     97            var nextSibling = element.nextSibling;
     98            parent.removeChild(element);
     99            parent.insertBefore(element, nextSibling);
     100        }
    92101    },
    93102
     
    279288    highlightNode: function(node)
    280289    {
    281         node.element.scrollIntoViewIfNeeded(true);
    282         this._nodeToHighlightAfterScroll = node;
     290        if (this._isScrolledIntoView(node.element))
     291            WebInspector.HeapSnapshotSortableDataGrid.prototype.highlightNode.call(this, node);
     292        else {
     293            node.element.scrollIntoViewIfNeeded(true);
     294            this._nodeToHighlightAfterScroll = node;
     295        }
     296    },
     297
     298    _isScrolledIntoView: function(element)
     299    {
     300        var viewportTop = this.scrollContainer.scrollTop;
     301        var viewportBottom = viewportTop + this.scrollContainer.clientHeight;
     302        var elemTop = element.offsetTop
     303        var elemBottom = elemTop + element.offsetHeight;
     304        return elemBottom <= viewportBottom && elemTop >= viewportTop;
    283305    },
    284306
  • trunk/Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js

    r117057 r117753  
    729729    revealNodeBySnapshotObjectId: function(snapshotObjectId)
    730730    {
     731        function didExpand()
     732        {
     733            this._provider.nodePosition(snapshotObjectId, didGetNodePosition.bind(this));
     734        }
     735
    731736        function didGetNodePosition(nodePosition)
    732737        {
    733             if (nodePosition !== -1)
     738            if (nodePosition === -1) {
     739                this.collapse();
     740                callback(null);
     741            } else
    734742                this._populateChildren(nodePosition, null, didPopulateChildren.bind(this, nodePosition));
    735743        }
     
    750758        }
    751759
    752         this.expand();
    753         this._provider.nodePosition(snapshotObjectId, didGetNodePosition.bind(this));
     760        this.expandWithoutPopulate(didExpand.bind(this));
    754761    },
    755762
  • trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js

    r117581 r117753  
    559559            return;
    560560
     561        var view = profile.view();
     562        if (view === this.visibleView)
     563            return;
     564
    561565        this.closeVisibleView();
    562 
    563         var view = profile.view();
    564566
    565567        view.show(this.profileViews);
Note: See TracChangeset for help on using the changeset viewer.