Title: [119830] trunk/Source/WebCore
- Revision
- 119830
- Author
- commit-qu...@webkit.org
- Date
- 2012-06-08 07:44:04 -0700 (Fri, 08 Jun 2012)
Log Message
Web Inspector: Better labels positioning on the memory pie chart
https://bugs.webkit.org/show_bug.cgi?id=88652
Patch by Alexei Filippov <alex...@chromium.org> on 2012-06-08
Reviewed by Vsevolod Vlasov.
* inspector/front-end/NativeMemorySnapshotView.js:
(WebInspector.NativeMemoryPieChart.prototype._paint.paintPercentAndLabel):
(WebInspector.NativeMemoryPieChart.prototype._paint):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (119829 => 119830)
--- trunk/Source/WebCore/ChangeLog 2012-06-08 14:30:49 UTC (rev 119829)
+++ trunk/Source/WebCore/ChangeLog 2012-06-08 14:44:04 UTC (rev 119830)
@@ -1,3 +1,14 @@
+2012-06-08 Alexei Filippov <alex...@chromium.org>
+
+ Web Inspector: Better labels positioning on the memory pie chart
+ https://bugs.webkit.org/show_bug.cgi?id=88652
+
+ Reviewed by Vsevolod Vlasov.
+
+ * inspector/front-end/NativeMemorySnapshotView.js:
+ (WebInspector.NativeMemoryPieChart.prototype._paint.paintPercentAndLabel):
+ (WebInspector.NativeMemoryPieChart.prototype._paint):
+
2012-06-08 Bryan McQuade <bmcqu...@google.com>
Web Inspector: Annotate timeline records with a frame identifier
Modified: trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js (119829 => 119830)
--- trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js 2012-06-08 14:30:49 UTC (rev 119829)
+++ trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js 2012-06-08 14:44:04 UTC (rev 119830)
@@ -302,30 +302,31 @@
ctx.stroke();
ctx.closePath();
- var startAngle = - Math.PI / 2;
- var currentAngle = startAngle;
+ var currentAngle = 0;
var memoryBlock = this._memorySnapshot;
function paintPercentAndLabel(fraction, title, midAngle)
{
ctx.beginPath();
- ctx.font = "14px Arial";
+ ctx.font = "13px Arial";
ctx.fillStyle = "rgba(10, 10, 10, 0.8)";
- var textX = x + radius * Math.cos(midAngle) / 2;
- var textY = y + radius * Math.sin(midAngle) / 2;
- ctx.fillText((100 * fraction).toFixed(0) + "%", textX, textY);
+ var textX = x + (radius + 10) * Math.cos(midAngle);
+ var textY = y + (radius + 10) * Math.sin(midAngle);
+ var relativeOffset = -Math.cos(midAngle) / Math.sin(Math.PI / 12);
+ relativeOffset = Number.constrain(relativeOffset, -1, 1);
+ var metrics = ctx.measureText(title);
+ textX -= metrics.width * (relativeOffset + 1) / 2;
+ textY += 5;
+ ctx.fillText(title, textX, textY);
- textX = x + radius * Math.cos(midAngle);
- textY = y + radius * Math.sin(midAngle);
- if (midAngle <= startAngle + Math.PI) {
- textX += 10;
- textY += 10;
- } else {
- var metrics = ctx.measureText(title);
- textX -= metrics.width + 10;
+ // Do not print percentage if the sector is too narrow.
+ if (fraction > 0.03) {
+ textX = x + radius * Math.cos(midAngle) / 2;
+ textY = y + radius * Math.sin(midAngle) / 2;
+ ctx.fillText((100 * fraction).toFixed(0) + "%", textX - 8, textY + 5);
}
- ctx.fillText(title, textX, textY);
+
ctx.closePath();
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes