Web Inspector: add an option to show last N hidden children of node in heap profiler
authoryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 May 2012 08:25:07 +0000 (08:25 +0000)
committeryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 May 2012 08:25:07 +0000 (08:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=86757

Reviewed by Pavel Feldman.

Renamed "Show next N" to "Show N before" and added "Show N after" button. Also
when all 3 buttons would have equal effect there is now only "Show all N" button.

* English.lproj/localizedStrings.js:
* inspector/front-end/ShowMoreDataGridNode.js:
(WebInspector.ShowMoreDataGridNode):
(WebInspector.ShowMoreDataGridNode.prototype._showLastChunk):
(WebInspector.ShowMoreDataGridNode.prototype._updateLabels):
(WebInspector.ShowMoreDataGridNode.prototype.createCells):

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

Source/WebCore/ChangeLog
Source/WebCore/English.lproj/localizedStrings.js
Source/WebCore/inspector/front-end/ShowMoreDataGridNode.js

index a1bffb9..2a70852 100644 (file)
@@ -1,3 +1,20 @@
+2012-05-17  Yury Semikhatsky  <yurys@chromium.org>
+
+        Web Inspector: add an option to show last N hidden children of node in heap profiler
+        https://bugs.webkit.org/show_bug.cgi?id=86757
+
+        Reviewed by Pavel Feldman.
+
+        Renamed "Show next N" to "Show N before" and added "Show N after" button. Also
+        when all 3 buttons would have equal effect there is now only "Show all N" button.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/front-end/ShowMoreDataGridNode.js:
+        (WebInspector.ShowMoreDataGridNode):
+        (WebInspector.ShowMoreDataGridNode.prototype._showLastChunk):
+        (WebInspector.ShowMoreDataGridNode.prototype._updateLabels):
+        (WebInspector.ShowMoreDataGridNode.prototype.createCells):
+
 2012-05-17  Ryosuke Niwa  <rniwa@webkit.org>
 
         WebKit erroneously add 1px padding in input elements
index 104c6d0..5660511 100644 (file)
Binary files a/Source/WebCore/English.lproj/localizedStrings.js and b/Source/WebCore/English.lproj/localizedStrings.js differ
index de39820..0ba7f1b 100644 (file)
@@ -47,11 +47,17 @@ WebInspector.ShowMoreDataGridNode = function(callback, startPosition, endPositio
     this.showNext = document.createElement("button");
     this.showNext.setAttribute("type", "button");
     this.showNext.addEventListener("click", this._showNextChunk.bind(this), false);
+    this.showNext.textContent = WebInspector.UIString("Show %d before", this._chunkSize);
 
     this.showAll = document.createElement("button");
     this.showAll.setAttribute("type", "button");
     this.showAll.addEventListener("click", this._showAll.bind(this), false);
 
+    this.showLast = document.createElement("button");
+    this.showLast.setAttribute("type", "button");
+    this.showLast.addEventListener("click", this._showLastChunk.bind(this), false);
+    this.showLast.textContent = WebInspector.UIString("Show %d after", this._chunkSize);
+
     this._updateLabels();
     this.selectable = false;
 }
@@ -67,11 +73,21 @@ WebInspector.ShowMoreDataGridNode.prototype = {
         this._callback(this._startPosition, this._endPosition);
     },
 
+    _showLastChunk: function()
+    {
+        this._callback(this._endPosition - this._chunkSize, this._endPosition);
+    },
+
     _updateLabels: function()
     {
         var totalSize = this._endPosition - this._startPosition;
-        var nextChunkSize = Math.min(this._chunkSize, totalSize);
-        this.showNext.textContent = WebInspector.UIString("Show next %d", nextChunkSize);
+        if (totalSize > this._chunkSize) {
+            this.showNext.removeStyleClass("hidden");
+            this.showLast.removeStyleClass("hidden");
+        } else {
+            this.showNext.addStyleClass("hidden");
+            this.showLast.addStyleClass("hidden");
+        }
         this.showAll.textContent = WebInspector.UIString("Show all %d", totalSize);
     },
 
@@ -81,8 +97,8 @@ WebInspector.ShowMoreDataGridNode.prototype = {
         if (this.depth)
             cell.style.setProperty("padding-left", (this.depth * this.dataGrid.indentWidth) + "px");
         cell.appendChild(this.showNext);
-        if (this.showAll)
-            cell.appendChild(this.showAll);
+        cell.appendChild(this.showAll);
+        cell.appendChild(this.showLast);
         this._element.appendChild(cell);
 
         var columns = this.dataGrid.columns;