@@ -17,6 +17,7 @@ import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
1717
1818import { getAnnotationEntries , getAnnotationWindow } from './AnnotationHelpers.js' ;
1919import type * as TimelineComponents from './components/components.js' ;
20+ import * as TimelineInsights from './components/insights/insights.js' ;
2021import { CountersGraph } from './CountersGraph.js' ;
2122import { SHOULD_SHOW_EASTER_EGG } from './EasterEgg.js' ;
2223import { ModificationsManager } from './ModificationsManager.js' ;
@@ -410,12 +411,19 @@ export class TimelineFlameChartView extends Common.ObjectWrapper.eventMixin<Even
410411 this . updateLinkSelectionAnnotationWithToEntry ( this . networkDataProvider , event . data ) ;
411412 } , this ) ;
412413
414+ // This listener is used for timings marker, when they are clicked, open the details view for them. They are
415+ // rendered in the overlays system, not in flame chart (canvas), so need this extra handling.
413416 this . #overlays. addEventListener ( Overlays . Overlays . EventReferenceClick . eventName , event => {
414417 const eventRef = ( event as Overlays . Overlays . EventReferenceClick ) ;
415418 const fromTraceEvent = selectionFromEvent ( eventRef . event ) ;
416419 this . openSelectionDetailsView ( fromTraceEvent ) ;
417420 } ) ;
418421
422+ // This is for the detail view of layout shift.
423+ this . element . addEventListener ( TimelineInsights . EventRef . EventReferenceClick . eventName , event => {
424+ this . setSelectionAndReveal ( selectionFromEvent ( event . event ) ) ;
425+ } ) ;
426+
419427 this . element . addEventListener ( 'keydown' , this . #keydownHandler. bind ( this ) ) ;
420428 this . element . addEventListener ( 'pointerdown' , this . #pointerDownHandler. bind ( this ) ) ;
421429 this . #boundRefreshAfterIgnoreList = this . #refreshAfterIgnoreList. bind ( this ) ;
@@ -1361,10 +1369,6 @@ export class TimelineFlameChartView extends Common.ObjectWrapper.eventMixin<Even
13611369
13621370 setSelectionAndReveal ( selection : TimelineSelection | null ) : void {
13631371 this . #currentSelection = selection ;
1364- const mainIndex = this . mainDataProvider . entryIndexForSelection ( selection ) ;
1365- const networkIndex = this . networkDataProvider . entryIndexForSelection ( selection ) ;
1366- this . mainFlameChart . setSelectedEntry ( mainIndex ) ;
1367- this . networkFlameChart . setSelectedEntry ( networkIndex ) ;
13681372
13691373 // Clear any existing entry selection.
13701374 this . #overlays. removeOverlaysOfType ( 'ENTRY_SELECTED' ) ;
@@ -1379,10 +1383,17 @@ export class TimelineFlameChartView extends Common.ObjectWrapper.eventMixin<Even
13791383 this . #timeRangeSelectionAnnotation = null ;
13801384 }
13811385
1382- let index = this . mainDataProvider . entryIndexForSelection ( selection ) ;
1383- this . mainFlameChart . setSelectedEntry ( index ) ;
1384- index = this . networkDataProvider . entryIndexForSelection ( selection ) ;
1385- this . networkFlameChart . setSelectedEntry ( index ) ;
1386+ // Check if this is an entry from main flame chart or network flame chart.
1387+ // If so build the initiators and select the entry.
1388+ // Otherwise clear the initiators and the selection.
1389+ // - This is done by the same functions, when the index is -1, it will clear everything.
1390+ const mainIndex = this . mainDataProvider . entryIndexForSelection ( selection ) ;
1391+ this . mainDataProvider . buildFlowForInitiator ( mainIndex ) ;
1392+ this . mainFlameChart . setSelectedEntry ( mainIndex ) ;
1393+ const networkIndex = this . networkDataProvider . entryIndexForSelection ( selection ) ;
1394+ this . networkDataProvider . buildFlowForInitiator ( networkIndex ) ;
1395+ this . networkFlameChart . setSelectedEntry ( networkIndex ) ;
1396+
13861397 if ( this . detailsView ) {
13871398 // TODO(crbug.com/1459265): Change to await after migration work.
13881399 void this . detailsView . setSelection ( selection ) ;
0 commit comments