Skip to content

Commit 6662b21

Browse files
danilsomsikovDevtools-frontend LUCI CQ
authored andcommitted
Remove the adorner from ToolbarButton, and its last client — last year's easter egg.
Bug: 301364727 Change-Id: I5295318d006b1b59c7645edd4470a6f129be38ad Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6387325 Commit-Queue: Danil Somsikov <[email protected]> Reviewed-by: Jack Franklin <[email protected]>
1 parent e440167 commit 6662b21

File tree

2 files changed

+6
-55
lines changed

2 files changed

+6
-55
lines changed

front_end/panels/timeline/TimelinePanel.ts

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ import * as AnnotationHelpers from './AnnotationHelpers.js';
6161
import {TraceLoadEvent} from './BenchmarkEvents.js';
6262
import * as TimelineComponents from './components/components.js';
6363
import * as TimelineInsights from './components/insights/insights.js';
64-
import {SHOULD_SHOW_EASTER_EGG} from './EasterEgg.js';
6564
import {Tracker} from './FreshRecording.js';
6665
import {IsolateSelector} from './IsolateSelector.js';
6766
import {AnnotationModifiedEvent, ModificationsManager} from './ModificationsManager.js';
@@ -413,8 +412,6 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
413412
private controller!: TimelineController|null;
414413
private cpuProfiler!: SDK.CPUProfilerModel.CPUProfilerModel|null;
415414
private clearButton!: UI.Toolbar.ToolbarButton;
416-
private brickBreakerToolbarButton: UI.Toolbar.ToolbarButton;
417-
private brickBreakerToolbarButtonAdded = false;
418415
private loadButton!: UI.Toolbar.ToolbarButton;
419416
private saveButton!: UI.Toolbar.ToolbarButton|UI.Toolbar.ToolbarMenuButton;
420417
private homeButton?: UI.Toolbar.ToolbarButton;
@@ -438,7 +435,6 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
438435
#sourceMapsResolver: Utils.SourceMapsResolver.SourceMapsResolver|null = null;
439436
#entityMapper: Utils.EntityMapper.EntityMapper|null = null;
440437
#onSourceMapsNodeNamesResolvedBound = this.#onSourceMapsNodeNamesResolved.bind(this);
441-
readonly #onChartPlayableStateChangeBound: (event: Common.EventTarget.EventTargetEvent<boolean>) => void;
442438
#sidebarToggleButton = this.#splitWidget.createShowHideSidebarButton(
443439
i18nString(UIStrings.showSidebar),
444440
i18nString(UIStrings.hideSidebar),
@@ -507,10 +503,6 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
507503
name: i18nString(UIStrings.fixMe),
508504
content: adornerContent,
509505
};
510-
this.brickBreakerToolbarButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.fixMe), adorner);
511-
this.brickBreakerToolbarButton.addEventListener(
512-
UI.Toolbar.ToolbarButton.Events.CLICK, () => this.#onBrickBreakerEasterEggClick());
513-
514506
this.#traceEngineModel = traceModel || this.#instantiateNewModel();
515507
this.#listenForProcessingProgress();
516508

@@ -591,13 +583,9 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
591583
SDK.ResourceTreeModel.ResourceTreeModel, SDK.ResourceTreeModel.Events.Load, this.loadEventFired, this);
592584

593585
this.flameChart = new TimelineFlameChartView(this);
594-
this.#onChartPlayableStateChangeBound = this.#onChartPlayableStateChange.bind(this);
595586
this.element.addEventListener(
596587
'toggle-popover', event => this.flameChart.togglePopover((event as CustomEvent).detail));
597588

598-
this.flameChart.getMainFlameChart().addEventListener(
599-
PerfUI.FlameChart.Events.CHART_PLAYABLE_STATE_CHANGED, this.#onChartPlayableStateChangeBound, this);
600-
601589
this.#onMainEntryHovered = this.#onEntryHovered.bind(this, this.flameChart.getMainDataProvider());
602590
this.flameChart.getMainFlameChart().addEventListener(
603591
PerfUI.FlameChart.Events.ENTRY_HOVERED, this.#onMainEntryHovered);
@@ -929,10 +917,6 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
929917
// Whilst we don't reset this, we hide it, mainly so the user cannot
930918
// hit Ctrl/Cmd-F and try to search when it isn't visible.
931919
this.searchableViewInternal.hideWidget();
932-
933-
// Hide the brick-breaker easter egg
934-
this.brickBreakerToolbarButtonAdded = false;
935-
this.panelToolbar.removeToolbarItem(this.brickBreakerToolbarButton);
936920
return;
937921
}
938922

@@ -1004,22 +988,6 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
1004988
return data;
1005989
}
1006990

1007-
#onChartPlayableStateChange(event: Common.EventTarget.EventTargetEvent<boolean, unknown>): void {
1008-
if (event.data) {
1009-
const dateObj = new Date();
1010-
const month = dateObj.getUTCMonth() + 1;
1011-
const day = dateObj.getUTCDate();
1012-
const isAprilFools = (month === 4 && (day === 1 || day === 2)); // Show only on April fools and the next day
1013-
if (isAprilFools && !this.brickBreakerToolbarButtonAdded && SHOULD_SHOW_EASTER_EGG) {
1014-
this.brickBreakerToolbarButtonAdded = true;
1015-
this.panelToolbar.appendToolbarItem(this.brickBreakerToolbarButton);
1016-
}
1017-
} else {
1018-
this.brickBreakerToolbarButtonAdded = false;
1019-
this.panelToolbar.removeToolbarItem(this.brickBreakerToolbarButton);
1020-
}
1021-
}
1022-
1023991
#onEntryHovered(dataProvider: TimelineFlameChartDataProvider, event: Common.EventTarget.EventTargetEvent<number>):
1024992
void {
1025993
const entryIndex = event.data;
@@ -1898,13 +1866,6 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
18981866
return this.#viewMode.mode === 'VIEWING_TRACE';
18991867
}
19001868

1901-
#onBrickBreakerEasterEggClick(): void {
1902-
if (!this.#hasActiveTrace()) {
1903-
return;
1904-
}
1905-
this.flameChart.runBrickBreakerGame();
1906-
}
1907-
19081869
#applyActiveFilters(traceIsGeneric: boolean, exclusiveFilter: Trace.Extras.TraceFilter.TraceFilter|null = null):
19091870
void {
19101871
if (traceIsGeneric || Root.Runtime.experiments.isEnabled('timeline-show-all-events')) {

front_end/ui/legacy/Toolbar.ts

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import * as Platform from '../../core/platform/platform.js';
3434
import * as Root from '../../core/root/root.js';
3535
import * as Buttons from '../../ui/components/buttons/buttons.js';
3636
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
37-
import * as Adorners from '../components/adorners/adorners.js';
37+
import type * as Adorners from '../components/adorners/adorners.js';
3838
import * as IconButton from '../components/icon_button/icon_button.js';
3939

4040
import {type Action, Events as ActionEvents} from './ActionRegistration.js';
@@ -590,31 +590,21 @@ export class ToolbarButton extends ToolbarItem<ToolbarButton.EventTypes, Buttons
590590
private text?: string;
591591
private adorner?: HTMLElement;
592592

593-
constructor(
594-
title: string, glyphOrAdorner?: string|Adorners.Adorner.Adorner, text?: string, jslogContext?: string,
595-
button?: Buttons.Button.Button) {
596-
let adorner: Adorners.Adorner.Adorner|null = null;
593+
constructor(title: string, glyph?: string, text?: string, jslogContext?: string, button?: Buttons.Button.Button) {
597594
if (!button) {
598595
button = new Buttons.Button.Button();
599-
if (glyphOrAdorner instanceof Adorners.Adorner.Adorner) {
600-
button.variant = Buttons.Button.Variant.ADORNER_ICON;
601-
adorner = glyphOrAdorner;
602-
} else if (typeof glyphOrAdorner === 'string' && !text) {
603-
button.data = {variant: Buttons.Button.Variant.ICON, iconName: glyphOrAdorner};
596+
if (glyph && !text) {
597+
button.data = {variant: Buttons.Button.Variant.ICON, iconName: glyph};
604598
} else {
605599
button.variant = Buttons.Button.Variant.TEXT;
606600
button.reducedFocusRing = true;
607-
if (glyphOrAdorner) {
608-
button.iconName = glyphOrAdorner;
601+
if (glyph) {
602+
button.iconName = glyph;
609603
}
610604
}
611605
}
612606
super(button);
613607
this.button = button;
614-
if (adorner) {
615-
this.setAdorner(adorner);
616-
this.button.prepend(adorner);
617-
}
618608
button.classList.add('toolbar-button');
619609
this.element.addEventListener('click', this.clicked.bind(this), false);
620610
button.textContent = text || '';

0 commit comments

Comments
 (0)