Changeset 51139 in webkit


Ignore:
Timestamp:
Nov 18, 2009 2:41:31 PM (14 years ago)
Author:
eric@webkit.org
Message:

2009-11-18 Mikhail Naganov <mnaganov@chromium.org>

Reviewed by Timothy Hatcher.

Fix profile tree nodes loss after focus / restore actions.

Focusing on a node is currently implemented via nodes reattaching
with some caching involved. It seems that not all code was updated
to handle this scenario correctly.

https://bugs.webkit.org/show_bug.cgi?id=31553

  • inspector/front-end/BottomUpProfileDataGridTree.js: (WebInspector.BottomUpProfileDataGridNode): (WebInspector.BottomUpProfileDataGridNode.prototype._restore): (WebInspector.BottomUpProfileDataGridNode.prototype._sharedPopulate): (WebInspector.BottomUpProfileDataGridNode.prototype._willHaveChildren):
  • inspector/front-end/DataGrid.js: (WebInspector.DataGrid.prototype.insertChild): (WebInspector.DataGridNode.prototype._detach): (WebInspector.DataGridNode.prototype.savePosition): (WebInspector.DataGridNode.prototype.restorePosition):
  • inspector/front-end/TopDownProfileDataGridTree.js: (WebInspector.TopDownProfileDataGridTree.prototype.focus): (WebInspector.TopDownProfileDataGridTree.prototype.restore):
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r51137 r51139  
     12009-11-18  Mikhail Naganov  <mnaganov@chromium.org>
     2
     3        Reviewed by Timothy Hatcher.
     4
     5        Fix profile tree nodes loss after focus / restore actions.
     6
     7        Focusing on a node is currently implemented via nodes reattaching
     8        with some caching involved. It seems that not all code was updated
     9        to handle this scenario correctly.
     10
     11        https://bugs.webkit.org/show_bug.cgi?id=31553
     12
     13        * inspector/front-end/BottomUpProfileDataGridTree.js:
     14        (WebInspector.BottomUpProfileDataGridNode):
     15        (WebInspector.BottomUpProfileDataGridNode.prototype._restore):
     16        (WebInspector.BottomUpProfileDataGridNode.prototype._sharedPopulate):
     17        (WebInspector.BottomUpProfileDataGridNode.prototype._willHaveChildren):
     18        * inspector/front-end/DataGrid.js:
     19        (WebInspector.DataGrid.prototype.insertChild):
     20        (WebInspector.DataGridNode.prototype._detach):
     21        (WebInspector.DataGridNode.prototype.savePosition):
     22        (WebInspector.DataGridNode.prototype.restorePosition):
     23        * inspector/front-end/TopDownProfileDataGridTree.js:
     24        (WebInspector.TopDownProfileDataGridTree.prototype.focus):
     25        (WebInspector.TopDownProfileDataGridTree.prototype.restore):
     26
    1272009-11-18  Carol Szabo  <carol.szabo@nokia.com>
    228
  • trunk/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js

    r49891 r51139  
    3232WebInspector.BottomUpProfileDataGridNode = function(/*ProfileView*/ profileView, /*ProfileNode*/ profileNode, /*BottomUpProfileDataGridTree*/ owningTree)
    3333{
    34     // In bottom up mode, our parents are our children since we display an inverted tree.
    35     // However, we don't want to show the very top parent since it is redundant.
    36     var hasChildren = !!(profileNode.parent && profileNode.parent.parent);
    37 
    38     WebInspector.ProfileDataGridNode.call(this, profileView, profileNode, owningTree, hasChildren);
     34    WebInspector.ProfileDataGridNode.call(this, profileView, profileNode, owningTree, this._willHaveChildren(profileNode));
    3935
    4036    this._remainingNodeInfos = [];
     
    7773        if (child)
    7874            this._merge(child, true);
     75    },
     76
     77    _restore: function()
     78    {
     79        WebInspector.ProfileDataGridNode.prototype._restore();
     80
     81        if (!this.children.length)
     82            this.hasChildren = this._willHaveChildren();
    7983    },
    8084
     
    129133
    130134        delete this._remainingNodeInfos;
     135    },
     136
     137    _willHaveChildren: function(profileNode)
     138    {
     139        profileNode = profileNode || this.profileNode;
     140        // In bottom up mode, our parents are our children since we display an inverted tree.
     141        // However, we don't want to show the very top parent since it is redundant.
     142        return !!(profileNode.parent && profileNode.parent.parent);
    131143    }
    132144}
  • trunk/WebCore/inspector/front-end/DataGrid.js

    r51119 r51139  
    386386        delete child._revealed;
    387387        delete child._attached;
     388        child._shouldRefreshChildren = true;
    388389
    389390        var current = child.children[0];
     
    393394            delete current._revealed;
    394395            delete current._attached;
     396            current._shouldRefreshChildren = true;
    395397            current = current.traverseNextNode(false, child, true);
    396398        }
     
    11511153        for (var i = 0; i < this.children.length; ++i)
    11521154            this.children[i]._detach();
     1155    },
     1156
     1157    savePosition: function()
     1158    {
     1159        if (this._savedPosition)
     1160            return;
     1161
     1162        if (!this.parent)
     1163            throw("savePosition: Node must have a parent.");
     1164        this._savedPosition = {
     1165            parent: this.parent,
     1166            index: this.parent.children.indexOf(this)
     1167        };
     1168    },
     1169
     1170    restorePosition: function()
     1171    {
     1172        if (!this._savedPosition)
     1173            return;
     1174
     1175        if (this.parent !== this._savedPosition.parent)
     1176            this._savedPosition.parent.insertChild(this, this._savedPosition.index);
     1177
     1178        delete this._savedPosition;
    11531179    }
    11541180}
  • trunk/WebCore/inspector/front-end/TopDownProfileDataGridTree.js

    r49891 r51139  
    8383
    8484        this._save();
     85        profileDataGrideNode.savePosition();
    8586
    8687        this.children = [profileDataGrideNode];
     
    103104    },
    104105
     106    restore: function()
     107    {
     108        if (!this._savedChildren)
     109            return;
     110
     111        this.children[0].restorePosition();
     112
     113        WebInspector.ProfileDataGridTree.prototype.restore.call(this);
     114    },
     115
    105116    _merge: WebInspector.TopDownProfileDataGridNode.prototype._merge,
    106117
Note: See TracChangeset for help on using the changeset viewer.