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

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

Issue 1813813005: Timeline: fix overlapping group headers in Flame Chart (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 | « no previous file | 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 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 var top = this._scrollTop; 1329 var top = this._scrollTop;
1330 var ratio = window.devicePixelRatio; 1330 var ratio = window.devicePixelRatio;
1331 var barHeight = this._barHeight; 1331 var barHeight = this._barHeight;
1332 var textBaseHeight = barHeight - this._dataProvider.textBaseline(); 1332 var textBaseHeight = barHeight - this._dataProvider.textBaseline();
1333 var groups = this._rawTimelineData.groups || []; 1333 var groups = this._rawTimelineData.groups || [];
1334 if (!groups.length) 1334 if (!groups.length)
1335 return; 1335 return;
1336 1336
1337 var groupOffsets = this._groupOffsets; 1337 var groupOffsets = this._groupOffsets;
1338 var lastGroupOffset = Array.prototype.peekLast.call(groupOffsets); 1338 var lastGroupOffset = Array.prototype.peekLast.call(groupOffsets);
1339 var firstVisibleGroup = Math.max(groupOffsets.upperBound(top) - 1, 0);
1340 var colorUsage = WebInspector.ThemeSupport.ColorUsage; 1339 var colorUsage = WebInspector.ThemeSupport.ColorUsage;
1341 1340
1342 context.save(); 1341 context.save();
1343 context.scale(ratio, ratio); 1342 context.scale(ratio, ratio);
1344 context.translate(0, -top); 1343 context.translate(0, -top);
1345 1344
1346 context.fillStyle = WebInspector.themeSupport.patchColor("#eee", colorUs age.Background); 1345 context.fillStyle = WebInspector.themeSupport.patchColor("#eee", colorUs age.Background);
1347 forEachGroup((offset, index, group) => { 1346 forEachGroup((offset, index, group) => {
1348 var paddingHeight = group.style.padding; 1347 var paddingHeight = group.style.padding;
1349 if (paddingHeight < 5) 1348 if (paddingHeight < 5)
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 context.restore(); 1455 context.restore();
1457 } 1456 }
1458 1457
1459 /** 1458 /**
1460 * @param {function(number, number, !WebInspector.FlameChart.Group, bool ean)} callback 1459 * @param {function(number, number, !WebInspector.FlameChart.Group, bool ean)} callback
1461 */ 1460 */
1462 function forEachGroup(callback) 1461 function forEachGroup(callback)
1463 { 1462 {
1464 /** @type !Array<{nestingLevel: number, visible: boolean}> */ 1463 /** @type !Array<{nestingLevel: number, visible: boolean}> */
1465 var groupStack = [{nestingLevel: -1, visible: true}]; 1464 var groupStack = [{nestingLevel: -1, visible: true}];
1466 for (var i = firstVisibleGroup; i < groups.length; ++i) { 1465 for (var i = 0; i < groups.length; ++i) {
1467 var groupTop = groupOffsets[i]; 1466 var groupTop = groupOffsets[i];
1468 var group = groups[i]; 1467 var group = groups[i];
1469 if (groupTop - group.style.padding > top + height) 1468 if (groupTop - group.style.padding > top + height)
1470 break; 1469 break;
1471 var firstGroup = true; 1470 var firstGroup = true;
1472 while (groupStack.peekLast().nestingLevel >= group.style.nesting Level) { 1471 while (groupStack.peekLast().nestingLevel >= group.style.nesting Level) {
1473 groupStack.pop(); 1472 groupStack.pop();
1474 firstGroup = false; 1473 firstGroup = false;
1475 } 1474 }
1476 var parentGroupVisible = groupStack.peekLast().visible; 1475 var parentGroupVisible = groupStack.peekLast().visible;
1477 var thisGroupVisible = parentGroupVisible && (!group.style.colla psible || group.expanded); 1476 var thisGroupVisible = parentGroupVisible && (!group.style.colla psible || group.expanded);
1478 groupStack.push({nestingLevel: group.style.nestingLevel, visible : thisGroupVisible}); 1477 groupStack.push({nestingLevel: group.style.nestingLevel, visible : thisGroupVisible});
1479 if (!parentGroupVisible) 1478 if (!parentGroupVisible || groupTop + group.style.height < top)
1480 continue; 1479 continue;
1481 callback(groupTop, i, group, firstGroup); 1480 callback(groupTop, i, group, firstGroup);
1482 } 1481 }
1483 } 1482 }
1484 }, 1483 },
1485 1484
1486 /** 1485 /**
1487 * @param {number} y 1486 * @param {number} y
1488 * @param {number} startLevel 1487 * @param {number} startLevel
1489 * @param {number} endLevel 1488 * @param {number} endLevel
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1962 this.update(); 1961 this.update();
1963 }, 1962 },
1964 1963
1965 _enabled: function() 1964 _enabled: function()
1966 { 1965 {
1967 return this._rawTimelineDataLength !== 0; 1966 return this._rawTimelineDataLength !== 0;
1968 }, 1967 },
1969 1968
1970 __proto__: WebInspector.HBox.prototype 1969 __proto__: WebInspector.HBox.prototype
1971 } 1970 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698