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

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

Issue 2832653002: DevTools: brush up color blending and theming APIs. (Closed)
Patch Set: Created 3 years, 8 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
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 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 var groupOffsets = this._groupOffsets; 733 var groupOffsets = this._groupOffsets;
734 var lastGroupOffset = Array.prototype.peekLast.call(groupOffsets); 734 var lastGroupOffset = Array.prototype.peekLast.call(groupOffsets);
735 var colorUsage = UI.ThemeSupport.ColorUsage; 735 var colorUsage = UI.ThemeSupport.ColorUsage;
736 736
737 context.save(); 737 context.save();
738 context.scale(ratio, ratio); 738 context.scale(ratio, ratio);
739 context.translate(0, -top); 739 context.translate(0, -top);
740 var defaultFont = '11px ' + Host.fontFamily(); 740 var defaultFont = '11px ' + Host.fontFamily();
741 context.font = defaultFont; 741 context.font = defaultFont;
742 742
743 context.fillStyle = UI.themeSupport.patchColor('#fff', colorUsage.Background ); 743 context.fillStyle = UI.themeSupport.patchColorText('#fff', colorUsage.Backgr ound);
744 forEachGroup.call(this, (offset, index, group) => { 744 forEachGroup.call(this, (offset, index, group) => {
745 var paddingHeight = group.style.padding; 745 var paddingHeight = group.style.padding;
746 if (paddingHeight < 5) 746 if (paddingHeight < 5)
747 return; 747 return;
748 context.fillRect(0, offset - paddingHeight + 2, width, paddingHeight - 4); 748 context.fillRect(0, offset - paddingHeight + 2, width, paddingHeight - 4);
749 }); 749 });
750 if (groups.length && lastGroupOffset < top + height) 750 if (groups.length && lastGroupOffset < top + height)
751 context.fillRect(0, lastGroupOffset + 2, width, top + height - lastGroupOf fset); 751 context.fillRect(0, lastGroupOffset + 2, width, top + height - lastGroupOf fset);
752 752
753 context.strokeStyle = UI.themeSupport.patchColor('#eee', colorUsage.Backgrou nd); 753 context.strokeStyle = UI.themeSupport.patchColorText('#eee', colorUsage.Back ground);
754 context.beginPath(); 754 context.beginPath();
755 forEachGroup.call(this, (offset, index, group, isFirst) => { 755 forEachGroup.call(this, (offset, index, group, isFirst) => {
756 if (isFirst || group.style.padding < 4) 756 if (isFirst || group.style.padding < 4)
757 return; 757 return;
758 hLine(offset - 2.5); 758 hLine(offset - 2.5);
759 }); 759 });
760 hLine(lastGroupOffset + 1.5); 760 hLine(lastGroupOffset + 1.5);
761 context.stroke(); 761 context.stroke();
762 762
763 forEachGroup.call(this, (offset, index, group) => { 763 forEachGroup.call(this, (offset, index, group) => {
(...skipping 23 matching lines...) Expand all
787 this._headerLeftPadding - this._headerLabelXPadding, offset + this._ headerLabelYPadding, width, 787 this._headerLeftPadding - this._headerLabelXPadding, offset + this._ headerLabelYPadding, width,
788 barHeight - 2 * this._headerLabelYPadding); 788 barHeight - 2 * this._headerLabelYPadding);
789 } 789 }
790 context.fillStyle = group.style.color; 790 context.fillStyle = group.style.color;
791 context.fillText( 791 context.fillText(
792 group.name, Math.floor(this._expansionArrowIndent * (group.style.nesti ngLevel + 1) + this._arrowSide), 792 group.name, Math.floor(this._expansionArrowIndent * (group.style.nesti ngLevel + 1) + this._arrowSide),
793 offset + textBaseHeight); 793 offset + textBaseHeight);
794 }); 794 });
795 context.restore(); 795 context.restore();
796 796
797 context.fillStyle = UI.themeSupport.patchColor('#6e6e6e', colorUsage.Foregro und); 797 context.fillStyle = UI.themeSupport.patchColorText('#6e6e6e', colorUsage.For eground);
798 context.beginPath(); 798 context.beginPath();
799 forEachGroup.call(this, (offset, index, group) => { 799 forEachGroup.call(this, (offset, index, group) => {
800 if (this._isGroupCollapsible(index)) { 800 if (this._isGroupCollapsible(index)) {
801 drawExpansionArrow.call( 801 drawExpansionArrow.call(
802 this, this._expansionArrowIndent * (group.style.nestingLevel + 1), 802 this, this._expansionArrowIndent * (group.style.nestingLevel + 1),
803 offset + textBaseHeight - this._arrowSide / 2, !!group.expanded); 803 offset + textBaseHeight - this._arrowSide / 2, !!group.expanded);
804 } 804 }
805 }); 805 });
806 context.fill(); 806 context.fill();
807 807
808 context.strokeStyle = UI.themeSupport.patchColor('#ddd', colorUsage.Backgrou nd); 808 context.strokeStyle = UI.themeSupport.patchColorText('#ddd', colorUsage.Back ground);
809 context.beginPath(); 809 context.beginPath();
810 context.stroke(); 810 context.stroke();
811 811
812 context.restore(); 812 context.restore();
813 813
814 /** 814 /**
815 * @param {number} y 815 * @param {number} y
816 */ 816 */
817 function hLine(y) { 817 function hLine(y) {
818 context.moveTo(0, y); 818 context.moveTo(0, y);
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 } 1600 }
1601 1601
1602 /** 1602 /**
1603 * @override 1603 * @override
1604 * @return {number} 1604 * @return {number}
1605 */ 1605 */
1606 boundarySpan() { 1606 boundarySpan() {
1607 return this._maximumBoundaries - this._minimumBoundaries; 1607 return this._maximumBoundaries - this._minimumBoundaries;
1608 } 1608 }
1609 }; 1609 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698