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

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

Issue 2640403003: Fix UI glitches on Performance and Memory panels (Closed)
Patch Set: fix flamechart panning bug Created 3 years, 11 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 | third_party/WebKit/Source/devtools/front_end/profiler/profilesPanel.css » ('j') | 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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 } 690 }
691 var unclippedBarX = this._timeToPosition(entryStartTime); 691 var unclippedBarX = this._timeToPosition(entryStartTime);
692 if (this._dataProvider.decorateEntry( 692 if (this._dataProvider.decorateEntry(
693 entryIndex, context, text, barX, barY, barWidth, barHeight, unclip pedBarX, this._timeToPixel)) 693 entryIndex, context, text, barX, barY, barWidth, barHeight, unclip pedBarX, this._timeToPixel))
694 continue; 694 continue;
695 if (!text || !text.length) 695 if (!text || !text.length)
696 continue; 696 continue;
697 context.fillStyle = this._dataProvider.textColor(entryIndex); 697 context.fillStyle = this._dataProvider.textColor(entryIndex);
698 context.fillText(text, barX + textPadding, barY + textBaseHeight); 698 context.fillText(text, barX + textPadding, barY + textBaseHeight);
699 } 699 }
700
701 context.restore(); 700 context.restore();
702 701
703 this._drawGroupHeaders(width, height); 702 this._drawGroupHeaders(width, height);
704 this._drawMarkers(); 703 this._drawMarkers();
705 const headerHeight = this._rulerEnabled ? PerfUI.FlameChart.HeaderHeight : 0 ; 704 const headerHeight = this._rulerEnabled ? PerfUI.FlameChart.HeaderHeight : 0 ;
706 PerfUI.TimelineGrid.drawCanvasGrid(context, this._calculator, 3, headerHeigh t); 705 PerfUI.TimelineGrid.drawCanvasGrid(context, this._calculator, 3, headerHeigh t);
707 706
708 this._updateElementPosition(this._highlightElement, this._highlightedEntryIn dex); 707 this._updateElementPosition(this._highlightElement, this._highlightedEntryIn dex);
709 this._updateElementPosition(this._selectedElement, this._selectedEntryIndex) ; 708 this._updateElementPosition(this._selectedElement, this._selectedEntryIndex) ;
710 this._updateMarkerHighlight(); 709 this._updateMarkerHighlight();
(...skipping 13 matching lines...) Expand all
724 if (!groups.length) 723 if (!groups.length)
725 return; 724 return;
726 725
727 var groupOffsets = this._groupOffsets; 726 var groupOffsets = this._groupOffsets;
728 var lastGroupOffset = Array.prototype.peekLast.call(groupOffsets); 727 var lastGroupOffset = Array.prototype.peekLast.call(groupOffsets);
729 var colorUsage = UI.ThemeSupport.ColorUsage; 728 var colorUsage = UI.ThemeSupport.ColorUsage;
730 729
731 context.save(); 730 context.save();
732 context.scale(ratio, ratio); 731 context.scale(ratio, ratio);
733 context.translate(0, -top); 732 context.translate(0, -top);
733 var defaultFont = '11px ' + Host.fontFamily();
734 context.font = defaultFont;
734 735
735 context.fillStyle = UI.themeSupport.patchColor('#fff', colorUsage.Background ); 736 context.fillStyle = UI.themeSupport.patchColor('#fff', colorUsage.Background );
736 forEachGroup.call(this, (offset, index, group) => { 737 forEachGroup.call(this, (offset, index, group) => {
737 var paddingHeight = group.style.padding; 738 var paddingHeight = group.style.padding;
738 if (paddingHeight < 5) 739 if (paddingHeight < 5)
739 return; 740 return;
740 context.fillRect(0, offset - paddingHeight + 2, width, paddingHeight - 4); 741 context.fillRect(0, offset - paddingHeight + 2, width, paddingHeight - 4);
741 }); 742 });
742 if (groups.length && lastGroupOffset < top + height) 743 if (groups.length && lastGroupOffset < top + height)
743 context.fillRect(0, lastGroupOffset + 2, width, top + height - lastGroupOf fset); 744 context.fillRect(0, lastGroupOffset + 2, width, top + height - lastGroupOf fset);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 /** 870 /**
870 * @param {!PerfUI.FlameChart.Group} group 871 * @param {!PerfUI.FlameChart.Group} group
871 * @param {number} y 872 * @param {number} y
872 * @param {number} endLevel 873 * @param {number} endLevel
873 */ 874 */
874 _drawCollapsedOverviewForGroup(group, y, endLevel) { 875 _drawCollapsedOverviewForGroup(group, y, endLevel) {
875 var range = new Common.SegmentedRange(mergeCallback); 876 var range = new Common.SegmentedRange(mergeCallback);
876 var timeWindowRight = this._timeWindowRight; 877 var timeWindowRight = this._timeWindowRight;
877 var timeWindowLeft = this._timeWindowLeft - this._paddingLeft / this._timeTo Pixel; 878 var timeWindowLeft = this._timeWindowLeft - this._paddingLeft / this._timeTo Pixel;
878 var context = /** @type {!CanvasRenderingContext2D} */ (this._canvas.getCont ext('2d')); 879 var context = /** @type {!CanvasRenderingContext2D} */ (this._canvas.getCont ext('2d'));
879 var barHeight = this._barHeight - 2; 880 var barHeight = this._barHeight - 1;
880 var entryStartTimes = this._rawTimelineData.entryStartTimes; 881 var entryStartTimes = this._rawTimelineData.entryStartTimes;
881 var entryTotalTimes = this._rawTimelineData.entryTotalTimes; 882 var entryTotalTimes = this._rawTimelineData.entryTotalTimes;
882 883
883 for (var level = group.startLevel; level < endLevel; ++level) { 884 for (var level = group.startLevel; level < endLevel; ++level) {
884 var levelIndexes = this._timelineLevels[level]; 885 var levelIndexes = this._timelineLevels[level];
885 var rightIndexOnLevel = 886 var rightIndexOnLevel =
886 levelIndexes.lowerBound(timeWindowRight, (time, entryIndex) => time - entryStartTimes[entryIndex]) - 1; 887 levelIndexes.lowerBound(timeWindowRight, (time, entryIndex) => time - entryStartTimes[entryIndex]) - 1;
887 var lastDrawOffset = Infinity; 888 var lastDrawOffset = Infinity;
888 889
889 for (var entryIndexOnLevel = rightIndexOnLevel; entryIndexOnLevel >= 0; -- entryIndexOnLevel) { 890 for (var entryIndexOnLevel = rightIndexOnLevel; entryIndexOnLevel >= 0; -- entryIndexOnLevel) {
890 const entryIndex = levelIndexes[entryIndexOnLevel]; 891 const entryIndex = levelIndexes[entryIndexOnLevel];
891 const entryStartTime = entryStartTimes[entryIndex]; 892 const entryStartTime = entryStartTimes[entryIndex];
892 const barX = this._timeToPositionClipped(entryStartTime); 893 const barX = this._timeToPositionClipped(entryStartTime);
893 const entryEndTime = entryStartTime + entryTotalTimes[entryIndex]; 894 const entryEndTime = entryStartTime + entryTotalTimes[entryIndex];
894 if (isNaN(entryEndTime) || barX >= lastDrawOffset) 895 if (isNaN(entryEndTime) || barX >= lastDrawOffset)
895 continue; 896 continue;
896 if (entryEndTime <= timeWindowLeft) 897 if (entryEndTime <= timeWindowLeft)
897 break; 898 break;
898 lastDrawOffset = barX; 899 lastDrawOffset = barX;
899 const color = this._dataProvider.entryColor(entryIndex); 900 const color = this._dataProvider.entryColor(entryIndex);
900 const endBarX = this._timeToPositionClipped(entryEndTime); 901 const endBarX = this._timeToPositionClipped(entryEndTime);
901 if (group.style.useDecoratorsForOverview && this._dataProvider.forceDeco ration(entryIndex)) { 902 if (group.style.useDecoratorsForOverview && this._dataProvider.forceDeco ration(entryIndex)) {
902 const unclippedBarX = this._timeToPosition(entryStartTime); 903 const unclippedBarX = this._timeToPosition(entryStartTime);
903 const barWidth = endBarX - barX; 904 const barWidth = endBarX - barX;
904 context.beginPath(); 905 context.beginPath();
905 context.fillStyle = color; 906 context.fillStyle = color;
906 context.fillRect(barX, y, barWidth, barHeight - 1); 907 context.fillRect(barX, y, barWidth, barHeight);
907 this._dataProvider.decorateEntry( 908 this._dataProvider.decorateEntry(
908 entryIndex, context, '', barX, y, barWidth, barHeight, unclippedBa rX, this._timeToPixel); 909 entryIndex, context, '', barX, y, barWidth, this._barHeight, uncli ppedBarX, this._timeToPixel);
909 continue; 910 continue;
910 } 911 }
911 range.append(new Common.Segment(barX, endBarX, color)); 912 range.append(new Common.Segment(barX, endBarX, color));
912 } 913 }
913 } 914 }
914 915
915 var segments = range.segments().slice().sort((a, b) => a.data.localeCompare( b.data)); 916 var segments = range.segments().slice().sort((a, b) => a.data.localeCompare( b.data));
916 var lastColor; 917 var lastColor;
917 context.beginPath(); 918 context.beginPath();
918 for (var i = 0; i < segments.length; ++i) { 919 for (var i = 0; i < segments.length; ++i) {
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 } 1529 }
1529 1530
1530 /** 1531 /**
1531 * @override 1532 * @override
1532 * @return {number} 1533 * @return {number}
1533 */ 1534 */
1534 boundarySpan() { 1535 boundarySpan() {
1535 return this._maximumBoundaries - this._minimumBoundaries; 1536 return this._maximumBoundaries - this._minimumBoundaries;
1536 } 1537 }
1537 }; 1538 };
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/profiler/profilesPanel.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698