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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 * @param {?string} text | 613 * @param {?string} text |
614 * @param {number} barX | 614 * @param {number} barX |
615 * @param {number} barY | 615 * @param {number} barY |
616 * @param {number} barWidth | 616 * @param {number} barWidth |
617 * @param {number} barHeight | 617 * @param {number} barHeight |
618 * @param {function(number):number} offsetToPosition | 618 * @param {function(number):number} offsetToPosition |
619 * @return {boolean} | 619 * @return {boolean} |
620 */ | 620 */ |
621 decorateEntry: function(entryIndex, context, text, barX, barY, barWidth, bar
Height, offsetToPosition) | 621 decorateEntry: function(entryIndex, context, text, barX, barY, barWidth, bar
Height, offsetToPosition) |
622 { | 622 { |
623 return false; | 623 if (barWidth < 5) |
| 624 return false; |
| 625 |
| 626 var record = this._records[entryIndex]; |
| 627 var timelineData = this._timelineData; |
| 628 |
| 629 var category = WebInspector.TimelineUIUtils.styleForTimelineEvent(record
.name).category; |
| 630 // Paint text using white color on dark background. |
| 631 if (text) { |
| 632 context.save(); |
| 633 context.fillStyle = "white"; |
| 634 context.shadowColor = "rgba(0, 0, 0, 0.1)"; |
| 635 context.shadowOffsetX = 1; |
| 636 context.shadowOffsetY = 1; |
| 637 context.font = this._font; |
| 638 context.fillText(text, barX + this.textPadding(), barY + barHeight -
this.textBaseline()); |
| 639 context.restore(); |
| 640 } |
| 641 |
| 642 var bindings = this._model.bindings(); |
| 643 if (bindings && bindings.eventWarning(record)) { |
| 644 context.save(); |
| 645 |
| 646 context.rect(barX, barY, barWidth, this.barHeight()); |
| 647 context.clip(); |
| 648 |
| 649 context.beginPath(); |
| 650 context.fillStyle = "red"; |
| 651 context.moveTo(barX + barWidth - 15, barY + 1); |
| 652 context.lineTo(barX + barWidth - 1, barY + 1); |
| 653 context.lineTo(barX + barWidth - 1, barY + 15); |
| 654 context.fill(); |
| 655 |
| 656 context.restore(); |
| 657 } |
| 658 |
| 659 return true; |
624 }, | 660 }, |
625 | 661 |
626 /** | 662 /** |
627 * @param {number} entryIndex | 663 * @param {number} entryIndex |
628 * @return {boolean} | 664 * @return {boolean} |
629 */ | 665 */ |
630 forceDecoration: function(entryIndex) | 666 forceDecoration: function(entryIndex) |
631 { | 667 { |
632 return false; | 668 var record = this._records[entryIndex]; |
| 669 var bindings = this._model.bindings(); |
| 670 return !!bindings && !!bindings.eventWarning(record); |
633 }, | 671 }, |
634 | 672 |
635 /** | 673 /** |
636 * @param {number} entryIndex | 674 * @param {number} entryIndex |
637 * @return {?{startTimeOffset: number, endTimeOffset: number}} | 675 * @return {?{startTimeOffset: number, endTimeOffset: number}} |
638 */ | 676 */ |
639 highlightTimeRange: function(entryIndex) | 677 highlightTimeRange: function(entryIndex) |
640 { | 678 { |
641 var record = this._records[entryIndex]; | 679 var record = this._records[entryIndex]; |
642 if (!record || this._isHeaderRecord(record)) | 680 if (!record || this._isHeaderRecord(record)) |
643 return null; | 681 return null; |
644 return { | 682 return { |
645 startTimeOffset: this._toTimelineTime(record.startTime - this._zeroT
ime), | 683 startTimeOffset: this._toTimelineTime(record.startTime - this._zeroT
ime), |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 _onEntrySelected: function(event) | 926 _onEntrySelected: function(event) |
889 { | 927 { |
890 var entryIndex = event.data; | 928 var entryIndex = event.data; |
891 var record = this._dataProvider._records[entryIndex]; | 929 var record = this._dataProvider._records[entryIndex]; |
892 if (record instanceof WebInspector.TimelineModel.RecordImpl) | 930 if (record instanceof WebInspector.TimelineModel.RecordImpl) |
893 this._delegate.select(WebInspector.TimelineSelection.fromRecord(reco
rd)); | 931 this._delegate.select(WebInspector.TimelineSelection.fromRecord(reco
rd)); |
894 }, | 932 }, |
895 | 933 |
896 __proto__: WebInspector.VBox.prototype | 934 __proto__: WebInspector.VBox.prototype |
897 } | 935 } |
OLD | NEW |