Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js

Issue 1744613002: DevTools: Tweak timeline group headers drawing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /** 1 /**
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 hLine(lastGroupOffset + 0.5); 1349 hLine(lastGroupOffset + 0.5);
1350 context.stroke(); 1350 context.stroke();
1351 1351
1352 forEachGroup(firstVisibleGroup, (offset, index, group) => { 1352 forEachGroup(firstVisibleGroup, (offset, index, group) => {
1353 if (group.expanded) 1353 if (group.expanded)
1354 return; 1354 return;
1355 var endLevel = index + 1 < groups.length ? groups[index + 1].startLe vel : this._dataProvider.maxStackDepth(); 1355 var endLevel = index + 1 < groups.length ? groups[index + 1].startLe vel : this._dataProvider.maxStackDepth();
1356 this._drawCollapsedOverviewForGroup(offset + 1, group.startLevel, en dLevel); 1356 this._drawCollapsedOverviewForGroup(offset + 1, group.startLevel, en dLevel);
1357 }); 1357 });
1358 1358
1359 var headerX = 2; 1359 var headerLeftPadding = 6;
1360 var arrowSide = 8; 1360 var arrowSide = 8;
1361 var arrowHeight = arrowSide * Math.sqrt(3) / 2; 1361 var expansionArrowX = headerLeftPadding + arrowSide / 2;
1362 var expansionArrowX = headerX + arrowHeight;
1363 context.font = "11px " + WebInspector.fontFamily(); 1362 context.font = "11px " + WebInspector.fontFamily();
1364 1363
1365 context.save(); 1364 context.save();
1366 context.fillStyle = "rgba(255, 255, 255, 0.5)"; 1365 context.fillStyle = "rgba(255, 255, 255, 0.5)";
1367 context.shadowColor = "#fff";
1368 context.shadowBlur = 10;
caseq 2016/02/26 20:53:24 why?
alph 2016/02/26 21:04:36 We currently don't like blurry stuff, gradients et
1369 forEachGroup(firstVisibleGroup, drawBackground.bind(this)); 1366 forEachGroup(firstVisibleGroup, drawBackground.bind(this));
1370 context.restore(); 1367 context.restore();
1371 1368
1372 context.fillStyle = "#888888"; 1369 context.fillStyle = "#6e6e6e";
1373 context.beginPath(); 1370 context.beginPath();
1374 forEachGroup(firstVisibleGroup, (offset, index, group) => drawExpansionA rrow(expansionArrowX, offset + barHeight / 2, group.expanded)); 1371 forEachGroup(firstVisibleGroup, (offset, index, group) => drawExpansionA rrow(expansionArrowX, offset + textBaseHeight - arrowSide / 2, group.expanded));
1375 context.fill(); 1372 context.fill();
1376 1373
1377 context.fillStyle = "#222"; 1374 context.fillStyle = "#222";
1378 forEachGroup(firstVisibleGroup, (offset, index, group) => 1375 forEachGroup(firstVisibleGroup, (offset, index, group) =>
1379 context.fillText(group.name, Math.floor(expansionArrowX + arrowSide) , offset + textBaseHeight)); 1376 context.fillText(group.name, Math.floor(expansionArrowX + arrowSide) , offset + textBaseHeight));
1380 1377
1381 context.strokeStyle = "#ddd"; 1378 context.strokeStyle = "#ddd";
1382 context.beginPath(); 1379 context.beginPath();
1383 forEachGroup(firstVisibleGroup, (offset, index, group) => { 1380 forEachGroup(firstVisibleGroup, (offset, index, group) => {
1384 if (group.expanded) 1381 if (group.expanded)
(...skipping 13 matching lines...) Expand all
1398 } 1395 }
1399 1396
1400 /** 1397 /**
1401 * @param {number} offset 1398 * @param {number} offset
1402 * @param {number} index 1399 * @param {number} index
1403 * @param {!WebInspector.FlameChart.Group} group 1400 * @param {!WebInspector.FlameChart.Group} group
1404 * @this {WebInspector.FlameChart} 1401 * @this {WebInspector.FlameChart}
1405 */ 1402 */
1406 function drawBackground(offset, index, group) 1403 function drawBackground(offset, index, group)
1407 { 1404 {
1408 var backgroundPadding = 3; 1405 var vPadding = 2;
1409 var textPadding = 4; 1406 var hPadding = 3;
1410 var width = this._measureWidth(context, group.name) + textPadding + 2 * arrowSide; 1407 var width = this._measureWidth(context, group.name) + 1.5 * arrowSid e + 2 * hPadding;
1411 context.fillRect(headerX, offset + backgroundPadding, width, barHeig ht - 2 * backgroundPadding); 1408 context.fillRect(headerLeftPadding - hPadding, offset + vPadding, wi dth, barHeight - 2 * vPadding);
1412 } 1409 }
1413 1410
1414 /** 1411 /**
1415 * @param {number} x 1412 * @param {number} x
1416 * @param {number} y 1413 * @param {number} y
1417 * @param {boolean} expanded 1414 * @param {boolean} expanded
1418 */ 1415 */
1419 function drawExpansionArrow(x, y, expanded) 1416 function drawExpansionArrow(x, y, expanded)
1420 { 1417 {
1421 var arrowCenterOffset = arrowHeight / 3; 1418 var arrowHeight = arrowSide * Math.sqrt(3) / 2;
1419 var arrowCenterOffset = Math.round(arrowHeight / 2);
1422 context.save(); 1420 context.save();
1423 context.translate(x, y); 1421 context.translate(x, y);
1424 context.rotate(expanded ? Math.PI / 2 : 0); 1422 context.rotate(expanded ? Math.PI / 2 : 0);
1425 context.moveTo(-arrowCenterOffset, -arrowSide / 2); 1423 context.moveTo(-arrowCenterOffset, -arrowSide / 2);
1426 context.lineTo(-arrowCenterOffset, arrowSide / 2); 1424 context.lineTo(-arrowCenterOffset, arrowSide / 2);
1427 context.lineTo(2 * arrowCenterOffset, 0); 1425 context.lineTo(arrowHeight - arrowCenterOffset, 0);
1428 context.lineTo(-arrowCenterOffset, -arrowSide / 2);
1429 context.restore(); 1426 context.restore();
1430 } 1427 }
1431 1428
1432 /** 1429 /**
1433 * @param {number} start 1430 * @param {number} start
1434 * @param {function(number, number, !WebInspector.FlameChart.Group)} cal lback 1431 * @param {function(number, number, !WebInspector.FlameChart.Group)} cal lback
1435 */ 1432 */
1436 function forEachGroup(start, callback) 1433 function forEachGroup(start, callback)
1437 { 1434 {
1438 for (var i = start; i < groups.length; ++i) { 1435 for (var i = start; i < groups.length; ++i) {
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1904 this.update(); 1901 this.update();
1905 }, 1902 },
1906 1903
1907 _enabled: function() 1904 _enabled: function()
1908 { 1905 {
1909 return this._rawTimelineDataLength !== 0; 1906 return this._rawTimelineDataLength !== 0;
1910 }, 1907 },
1911 1908
1912 __proto__: WebInspector.HBox.prototype 1909 __proto__: WebInspector.HBox.prototype
1913 } 1910 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698