|
5 | 5 | import * as i18n from '../../../core/i18n/i18n.js'; |
6 | 6 | import type * as Platform from '../../../core/platform/platform.js'; |
7 | 7 | import * as Trace from '../../../models/trace/trace.js'; |
8 | | -import * as ThemeSupport from '../../../ui/legacy/theme_support/theme_support.js'; |
9 | 8 |
|
10 | 9 | const UIStrings = { |
11 | 10 | /** |
@@ -558,34 +557,29 @@ export class TimelineCategory { |
558 | 557 | name: EventCategory; |
559 | 558 | title: Platform.UIString.LocalizedString; |
560 | 559 | visible: boolean; |
561 | | - childColor: string; |
562 | | - #color: string; |
563 | 560 | #hidden?: boolean; |
| 561 | + #cssVariable: `--app-color-${string}`; |
564 | 562 |
|
565 | 563 | constructor( |
566 | | - name: EventCategory, title: Platform.UIString.LocalizedString, visible: boolean, childColor: string, |
567 | | - color: string) { |
| 564 | + name: EventCategory, title: Platform.UIString.LocalizedString, visible: boolean, |
| 565 | + cssVariable: `--app-color-${string}`) { |
568 | 566 | this.name = name; |
569 | 567 | this.title = title; |
570 | 568 | this.visible = visible; |
571 | | - this.childColor = childColor; |
572 | | - this.#color = color; |
| 569 | + this.#cssVariable = cssVariable; |
573 | 570 | this.hidden = false; |
574 | 571 | } |
575 | 572 |
|
576 | 573 | get hidden(): boolean { |
577 | 574 | return Boolean(this.#hidden); |
578 | 575 | } |
579 | 576 |
|
580 | | - get color(): string { |
581 | | - return this.getComputedColorValue(); |
582 | | - } |
583 | | - getCSSValue(): string { |
584 | | - return `var(${this.#color})`; |
| 577 | + get cssVariable(): string { |
| 578 | + return this.#cssVariable; |
585 | 579 | } |
586 | 580 |
|
587 | | - getComputedColorValue(): string { |
588 | | - return ThemeSupport.ThemeSupport.instance().getComputedValue(this.#color); |
| 581 | + getCSSValue(): string { |
| 582 | + return `var(${this.#cssVariable})`; |
589 | 583 | } |
590 | 584 |
|
591 | 585 | set hidden(hidden: boolean) { |
@@ -630,41 +624,25 @@ export function getCategoryStyles(): CategoryPalette { |
630 | 624 | return categoryStyles; |
631 | 625 | } |
632 | 626 | categoryStyles = { |
633 | | - loading: new TimelineCategory( |
634 | | - EventCategory.LOADING, i18nString(UIStrings.loading), true, '--app-color-loading-children', |
635 | | - '--app-color-loading'), |
| 627 | + loading: new TimelineCategory(EventCategory.LOADING, i18nString(UIStrings.loading), true, '--app-color-loading'), |
636 | 628 | experience: new TimelineCategory( |
637 | | - EventCategory.EXPERIENCE, i18nString(UIStrings.experience), false, '--app-color-rendering-children', |
638 | | - '--app-color-rendering'), |
639 | | - messaging: new TimelineCategory( |
640 | | - EventCategory.MESSAGING, i18nString(UIStrings.messaging), true, '--app-color-messaging-children', |
641 | | - '--app-color-messaging'), |
642 | | - scripting: new TimelineCategory( |
643 | | - EventCategory.SCRIPTING, i18nString(UIStrings.scripting), true, '--app-color-scripting-children', |
644 | | - '--app-color-scripting'), |
645 | | - rendering: new TimelineCategory( |
646 | | - EventCategory.RENDERING, i18nString(UIStrings.rendering), true, '--app-color-rendering-children', |
647 | | - '--app-color-rendering'), |
648 | | - painting: new TimelineCategory( |
649 | | - EventCategory.PAINTING, i18nString(UIStrings.painting), true, '--app-color-painting-children', |
650 | | - '--app-color-painting'), |
651 | | - gpu: new TimelineCategory( |
652 | | - EventCategory.GPU, i18nString(UIStrings.gpu), false, '--app-color-painting-children', '--app-color-painting'), |
653 | | - async: new TimelineCategory( |
654 | | - EventCategory.ASYNC, i18nString(UIStrings.async), false, '--app-color-async-children', '--app-color-async'), |
655 | | - other: new TimelineCategory( |
656 | | - EventCategory.OTHER, i18nString(UIStrings.system), false, '--app-color-system-children', '--app-color-system'), |
657 | | - idle: new TimelineCategory( |
658 | | - EventCategory.IDLE, i18nString(UIStrings.idle), false, '--app-color-idle-children', '--app-color-idle'), |
659 | | - layout: new TimelineCategory( |
660 | | - EventCategory.LAYOUT, i18nString(UIStrings.layout), false, '--app-color-loading-children', |
661 | | - '--app-color-loading'), |
| 629 | + EventCategory.EXPERIENCE, i18nString(UIStrings.experience), false, '--app-color-rendering'), |
| 630 | + messaging: |
| 631 | + new TimelineCategory(EventCategory.MESSAGING, i18nString(UIStrings.messaging), true, '--app-color-messaging'), |
| 632 | + scripting: |
| 633 | + new TimelineCategory(EventCategory.SCRIPTING, i18nString(UIStrings.scripting), true, '--app-color-scripting'), |
| 634 | + rendering: |
| 635 | + new TimelineCategory(EventCategory.RENDERING, i18nString(UIStrings.rendering), true, '--app-color-rendering'), |
| 636 | + painting: |
| 637 | + new TimelineCategory(EventCategory.PAINTING, i18nString(UIStrings.painting), true, '--app-color-painting'), |
| 638 | + gpu: new TimelineCategory(EventCategory.GPU, i18nString(UIStrings.gpu), false, '--app-color-painting'), |
| 639 | + async: new TimelineCategory(EventCategory.ASYNC, i18nString(UIStrings.async), false, '--app-color-async'), |
| 640 | + other: new TimelineCategory(EventCategory.OTHER, i18nString(UIStrings.system), false, '--app-color-system'), |
| 641 | + idle: new TimelineCategory(EventCategory.IDLE, i18nString(UIStrings.idle), false, '--app-color-idle'), |
| 642 | + layout: new TimelineCategory(EventCategory.LAYOUT, i18nString(UIStrings.layout), false, '--app-color-loading'), |
662 | 643 | rasterizing: new TimelineCategory( |
663 | | - EventCategory.RASTERIZING, i18nString(UIStrings.rasterizing), false, '--app-color-children', |
664 | | - '--app-color-scripting'), |
665 | | - drawing: new TimelineCategory( |
666 | | - EventCategory.DRAWING, i18nString(UIStrings.drawing), false, '--app-color-rendering-children', |
667 | | - '--app-color-rendering'), |
| 644 | + EventCategory.RASTERIZING, i18nString(UIStrings.rasterizing), false, '--app-color-scripting'), |
| 645 | + drawing: new TimelineCategory(EventCategory.DRAWING, i18nString(UIStrings.drawing), false, '--app-color-rendering'), |
668 | 646 | }; |
669 | 647 | return categoryStyles; |
670 | 648 | } |
|
0 commit comments