2011-03-29 Mikhail Naganov <mnaganov@chromium.org>
authormnaganov@chromium.org <mnaganov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Mar 2011 11:34:20 +0000 (11:34 +0000)
committermnaganov@chromium.org <mnaganov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Mar 2011 11:34:20 +0000 (11:34 +0000)
        Reviewed by Pavel Feldman.

        Web Inspector: [Chromium] Fix detailed heap snapshots UI.
        https://bugs.webkit.org/show_bug.cgi?id=57235

        Fix two problems:
          1. Text color of grid cells under selection needs to be white, otherwise it's unreadable for some colors;
          2. Long strings need to be truncated in grid, their contents can be shown on hover.

        * inspector/front-end/DetailedHeapshotView.js:
        (WebInspector.DetailedHeapshotView.prototype._getHoverAnchor):
        (WebInspector.DetailedHeapshotView.prototype._showStringContentPopup):
        * inspector/front-end/heapProfiler.css:
        (.detailed-heapshot-view .console-formatted-string):
        (.detailed-heapshot-view .data-grid tr.selected *):
        (.detailed-heapshot-view .data-grid:focus tr.selected *):

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

Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/DetailedHeapshotView.js
Source/WebCore/inspector/front-end/heapProfiler.css

index b288b0c..b1a5214 100644 (file)
@@ -1,3 +1,22 @@
+2011-03-29  Mikhail Naganov  <mnaganov@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: [Chromium] Fix detailed heap snapshots UI.
+        https://bugs.webkit.org/show_bug.cgi?id=57235
+
+        Fix two problems:
+          1. Text color of grid cells under selection needs to be white, otherwise it's unreadable for some colors;
+          2. Long strings need to be truncated in grid, their contents can be shown on hover.
+
+        * inspector/front-end/DetailedHeapshotView.js:
+        (WebInspector.DetailedHeapshotView.prototype._getHoverAnchor):
+        (WebInspector.DetailedHeapshotView.prototype._showStringContentPopup):
+        * inspector/front-end/heapProfiler.css:
+        (.detailed-heapshot-view .console-formatted-string):
+        (.detailed-heapshot-view .data-grid tr.selected *):
+        (.detailed-heapshot-view .data-grid:focus tr.selected *):
+
 2011-03-29  Andrey Adaikin  <aandrey@google.com>
 
         Reviewed by Yury Semikhatsky.
index 54554bb..5c56f15 100644 (file)
@@ -450,6 +450,8 @@ WebInspector.DetailedHeapshotView = function(parent, profile)
     this.helpButton = new WebInspector.StatusBarButton("", "heapshot-help-status-bar-item status-bar-item");
     this.helpButton.addEventListener("click", this._helpClicked.bind(this), false);
 
+    var popoverHelper = new WebInspector.PopoverHelper(this.element, this._getHoverAnchor.bind(this), this._showStringContentPopup.bind(this));
+
     this._loadProfile(this._profileUid, profileCallback.bind(this));
 
     function profileCallback(profile)
@@ -835,6 +837,21 @@ WebInspector.DetailedHeapshotView.prototype = {
         this.retainmentDataGrid.refresh();
     },
 
+    _getHoverAnchor: function(target)
+    {
+        var span = target.enclosingNodeOrSelfWithNodeName("span");
+        if (!span || !span.hasStyleClass("console-formatted-string"))
+            return;
+        var row = target.enclosingNodeOrSelfWithNodeName("tr");
+        if (!row)
+            return;
+        var gridNode = row._dataGridNode;
+        if (!gridNode.snapshotNodeIndex)
+            return;
+        span.snapshotNodeIndex = gridNode.snapshotNodeIndex;
+        return span;
+    },
+
     get isTracingToWindowObjects()
     {
         return this.retainingPathsRoot.selectedIndex === 1;
@@ -854,6 +871,18 @@ WebInspector.DetailedHeapshotView.prototype = {
         this.refreshShowAsPercents();
     },
 
+    _showStringContentPopup: function(span)
+    {
+        var snapshotNode = new WebInspector.HeapSnapshotNode(this.profileWrapper, span.snapshotNodeIndex);
+        var stringContentElement = document.createElement("span");
+        stringContentElement.className = "monospace console-formatted-string";
+        stringContentElement.style.whiteSpace = "pre";
+        stringContentElement.textContent = "\"" + snapshotNode.name + "\"";
+        var popover = new WebInspector.Popover(stringContentElement);
+        popover.show(span);
+        return popover;
+    },
+
     _helpClicked: function(event)
     {
         if (!this.helpPopover) {
index fb8485d..ceeafca 100644 (file)
     position: static;
 }
 
+.detailed-heapshot-view .console-formatted-string {
+    white-space: nowrap;
+}
+
+.detailed-heapshot-view .data-grid tr.selected * {
+    color: inherit;
+}
+
+.detailed-heapshot-view .data-grid:focus tr.selected * {
+    color: white;
+}
+
 .detailed-heapshot-view .delimiter {
     height: 24px;
     background-color: #d6dde5;