2009-06-24 Mikhail Naganov <mnaganov@chromium.org>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Jun 2009 01:52:46 +0000 (01:52 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Jun 2009 01:52:46 +0000 (01:52 +0000)
        Reviewed by Timothy Hatcher.

        Bug 26604: Search doesn't work in Web Inspector Profiler
        https://bugs.webkit.org/show_bug.cgi?id=26604

        Seems like search was damaged in revision 42808.

        * inspector/front-end/ProfileView.js:
        (WebInspector.ProfileView.prototype.refresh):
        Here and in other functions: nodes we're searching in are profile data grid
        nodes, so there is no more need for '_dataGridNode' references.
        (WebInspector.ProfileView.prototype.searchCanceled):
        (WebInspector.ProfileView.prototype.performSearch.matchesQuery):
        Fixed accidental semicolon that caused 'matchesQuery' always return true.
        (WebInspector.ProfileView.prototype.performSearch):
        To perform search correctly in the case of bottom up tree, we need to populate
        the tree, because there's no 1-to-1 correspondence between profile nodes and
        data grid nodes in this case.
        (WebInspector.ProfileView.prototype._jumpToSearchResult):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@45131 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/inspector/front-end/ProfileView.js

index 79abc8e..1039578 100644 (file)
@@ -1,3 +1,25 @@
+2009-06-24  Mikhail Naganov  <mnaganov@chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Bug 26604: Search doesn't work in Web Inspector Profiler
+        https://bugs.webkit.org/show_bug.cgi?id=26604
+
+        Seems like search was damaged in revision 42808.
+
+        * inspector/front-end/ProfileView.js:
+        (WebInspector.ProfileView.prototype.refresh):
+        Here and in other functions: nodes we're searching in are profile data grid
+        nodes, so there is no more need for '_dataGridNode' references.
+        (WebInspector.ProfileView.prototype.searchCanceled):
+        (WebInspector.ProfileView.prototype.performSearch.matchesQuery):
+        Fixed accidental semicolon that caused 'matchesQuery' always return true.
+        (WebInspector.ProfileView.prototype.performSearch):
+        To perform search correctly in the case of bottom up tree, we need to populate
+        the tree, because there's no 1-to-1 correspondence between profile nodes and
+        data grid nodes in this case.
+        (WebInspector.ProfileView.prototype._jumpToSearchResult):
+
 2009-06-24  Simon Fraser  <simon.fraser@apple.com>
 
         Reviewed by Darin Adler.
index d00733c..bc78fc8 100644 (file)
@@ -166,8 +166,8 @@ WebInspector.ProfileView.prototype = {
         for (var index = 0; index < count; ++index)
             this.dataGrid.appendChild(children[index]);
 
-        if (selectedProfileNode && selectedProfileNode._dataGridNode)
-            selectedProfileNode._dataGridNode.selected = true;
+        if (selectedProfileNode)
+            selectedProfileNode.selected = true;
     },
 
     refreshVisibleData: function()
@@ -196,8 +196,7 @@ WebInspector.ProfileView.prototype = {
                 delete profileNode._searchMatchedCallsColumn;
                 delete profileNode._searchMatchedFunctionColumn;
 
-                if (profileNode._dataGridNode)
-                    profileNode._dataGridNode.refresh();
+                profileNode.refresh();
             }
         }
 
@@ -313,7 +312,7 @@ WebInspector.ProfileView.prototype = {
                 profileDataGridNode._searchMatchedTotalColumn ||
                 profileDataGridNode._searchMatchedAverageColumn ||
                 profileDataGridNode._searchMatchedCallsColumn ||
-                profileDataGridNode._searchMatchedFunctionColumn);
+                profileDataGridNode._searchMatchedFunctionColumn)
             {
                 profileDataGridNode.refresh();
                 return true;
@@ -322,48 +321,14 @@ WebInspector.ProfileView.prototype = {
             return false;
         }
 
-        var current = this.dataGrid;
-        var ancestors = [];
-        var nextIndexes = [];
-        var startIndex = 0;
+        var current = this.profileDataGridTree.children[0];
 
         while (current) {
-            var children = current.children;
-            var childrenLength = children.length;
-
-            if (startIndex >= childrenLength) {
-                current = ancestors.pop();
-                startIndex = nextIndexes.pop();
-                continue;
+            if (matchesQuery(current)) {
+                this._searchResults.push({ profileNode: current });
             }
 
-            for (var i = startIndex; i < childrenLength; ++i) {
-                var child = children[i];
-
-                if (matchesQuery(child)) {
-                    if (child._dataGridNode) {
-                        // The child has a data grid node already, no need to remember the ancestors.
-                        this._searchResults.push({ profileNode: child });
-                    } else {
-                        var ancestorsCopy = [].concat(ancestors);
-                        ancestorsCopy.push(current);
-                        this._searchResults.push({ profileNode: child, ancestors: ancestorsCopy });
-                    }
-                }
-
-                if (child.children.length) {
-                    ancestors.push(current);
-                    nextIndexes.push(i + 1);
-                    current = child;
-                    startIndex = 0;
-                    break;
-                }
-
-                if (i === (childrenLength - 1)) {
-                    current = ancestors.pop();
-                    startIndex = nextIndexes.pop();
-                }
-            }
+            current = current.traverseNextNode(false, null, false);
         }
 
         finishedCallback(this, this._searchResults.length);
@@ -419,26 +384,9 @@ WebInspector.ProfileView.prototype = {
         if (!searchResult)
             return;
 
-        var profileNode = this._searchResults[index].profileNode;
-        if (!profileNode._dataGridNode && searchResult.ancestors) {
-            var ancestors = searchResult.ancestors;
-            for (var i = 0; i < ancestors.length; ++i) {
-                var ancestorProfileNode = ancestors[i];
-                var gridNode = ancestorProfileNode._dataGridNode;
-                if (gridNode)
-                    gridNode.expand();
-            }
-
-            // No need to keep the ancestors around.
-            delete searchResult.ancestors;
-        }
-
-        gridNode = profileNode._dataGridNode;
-        if (!gridNode)
-            return;
-
-        gridNode.reveal();
-        gridNode.select();
+        var profileNode = searchResult.profileNode;
+        profileNode.reveal();
+        profileNode.select();
     },
 
     _changeView: function(event)