OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 * @param {?string} text | 626 * @param {?string} text |
627 * @param {number} barX | 627 * @param {number} barX |
628 * @param {number} barY | 628 * @param {number} barY |
629 * @param {number} barWidth | 629 * @param {number} barWidth |
630 * @param {number} barHeight | 630 * @param {number} barHeight |
631 * @param {function(number):number} offsetToPosition | 631 * @param {function(number):number} offsetToPosition |
632 * @return {boolean} | 632 * @return {boolean} |
633 */ | 633 */ |
634 decorateEntry: function(entryIndex, context, text, barX, barY, barWidth, bar
Height, offsetToPosition) | 634 decorateEntry: function(entryIndex, context, text, barX, barY, barWidth, bar
Height, offsetToPosition) |
635 { | 635 { |
636 return false; | 636 if (barWidth < 5) |
| 637 return false; |
| 638 |
| 639 var record = this._records[entryIndex]; |
| 640 var timelineData = this._timelineData; |
| 641 |
| 642 var category = WebInspector.TimelineUIUtils.styleForTimelineEvent(record
.name).category; |
| 643 // Paint text using white color on dark background. |
| 644 if (text) { |
| 645 context.save(); |
| 646 context.fillStyle = "white"; |
| 647 context.shadowColor = "rgba(0, 0, 0, 0.1)"; |
| 648 context.shadowOffsetX = 1; |
| 649 context.shadowOffsetY = 1; |
| 650 context.font = this._font; |
| 651 context.fillText(text, barX + this.textPadding(), barY + barHeight -
this.textBaseline()); |
| 652 context.restore(); |
| 653 } |
| 654 |
| 655 if (this._model.eventWarning(record)) { |
| 656 context.save(); |
| 657 |
| 658 context.rect(barX, barY, barWidth, this.barHeight()); |
| 659 context.clip(); |
| 660 |
| 661 context.beginPath(); |
| 662 context.fillStyle = "red"; |
| 663 context.moveTo(barX + barWidth - 15, barY + 1); |
| 664 context.lineTo(barX + barWidth - 1, barY + 1); |
| 665 context.lineTo(barX + barWidth - 1, barY + 15); |
| 666 context.fill(); |
| 667 |
| 668 context.restore(); |
| 669 } |
| 670 |
| 671 return true; |
637 }, | 672 }, |
638 | 673 |
639 /** | 674 /** |
640 * @param {number} entryIndex | 675 * @param {number} entryIndex |
641 * @return {boolean} | 676 * @return {boolean} |
642 */ | 677 */ |
643 forceDecoration: function(entryIndex) | 678 forceDecoration: function(entryIndex) |
644 { | 679 { |
645 return false; | 680 var record = this._records[entryIndex]; |
| 681 return !!this._model.eventWarning(record); |
646 }, | 682 }, |
647 | 683 |
648 /** | 684 /** |
649 * @param {number} entryIndex | 685 * @param {number} entryIndex |
650 * @return {?{startTimeOffset: number, endTimeOffset: number}} | 686 * @return {?{startTimeOffset: number, endTimeOffset: number}} |
651 */ | 687 */ |
652 highlightTimeRange: function(entryIndex) | 688 highlightTimeRange: function(entryIndex) |
653 { | 689 { |
654 var record = this._records[entryIndex]; | 690 var record = this._records[entryIndex]; |
655 if (!record || this._isHeaderRecord(record)) | 691 if (!record || this._isHeaderRecord(record)) |
656 return null; | 692 return null; |
657 return { | 693 return { |
658 startTimeOffset: this._toTimelineTime(record.startTime - this._zeroT
ime), | 694 startTimeOffset: this._toTimelineTime(record.startTime - this._zeroT
ime), |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 _onEntrySelected: function(event) | 930 _onEntrySelected: function(event) |
895 { | 931 { |
896 var entryIndex = event.data; | 932 var entryIndex = event.data; |
897 var record = this._dataProvider._records[entryIndex]; | 933 var record = this._dataProvider._records[entryIndex]; |
898 if (record instanceof WebInspector.TimelineModel.Record) | 934 if (record instanceof WebInspector.TimelineModel.Record) |
899 this._delegate.selectRecord(record); | 935 this._delegate.selectRecord(record); |
900 }, | 936 }, |
901 | 937 |
902 __proto__: WebInspector.VBox.prototype | 938 __proto__: WebInspector.VBox.prototype |
903 } | 939 } |
OLD | NEW |