@@ -45,7 +45,7 @@ export class TimelineOverviewPane extends Common.ObjectWrapper.eventMixin<EventT
4545 private readonly cursorArea : HTMLElement ;
4646 private cursorElement : HTMLElement ;
4747 private overviewControls : TimelineOverview [ ] ;
48- private markers : Map < number , Element > ;
48+ private markers : Map < number , HTMLDivElement > ;
4949 private readonly overviewInfo : OverviewInfo ;
5050 private readonly updateThrottler : Common . Throttler . Throttler ;
5151 private cursorEnabled : boolean ;
@@ -209,14 +209,33 @@ export class TimelineOverviewPane extends Common.ObjectWrapper.eventMixin<EventT
209209 this . updateWindow ( ) ;
210210 }
211211
212- setMarkers ( markers : Map < number , Element > ) : void {
212+ setMarkers ( markers : Map < number , HTMLDivElement > ) : void {
213213 this . markers = markers ;
214214 }
215215
216- getMarkers ( ) : Map < number , Element > {
216+ getMarkers ( ) : Map < number , HTMLDivElement > {
217217 return this . markers ;
218218 }
219219
220+ /**
221+ * Dim the time marker outside the highlight time bounds.
222+ *
223+ * @param highlightBounds the time bounds to highlight, if it is empty, it means to highlight everything.
224+ */
225+ #dimMarkers( highlightBounds ?: Trace . Types . Timing . TraceWindowMicroSeconds ) : void {
226+ for ( const time of this . markers . keys ( ) ) {
227+ const marker = this . markers . get ( time ) ;
228+ if ( ! marker ) {
229+ continue ;
230+ }
231+ const timeInMicroSeconds = Trace . Helpers . Timing . millisecondsToMicroseconds ( Trace . Types . Timing . MilliSeconds ( time ) ) ;
232+ const dim = highlightBounds && ! Trace . Helpers . Timing . timestampIsInBounds ( highlightBounds , timeInMicroSeconds ) ;
233+
234+ // `filter: grayscale(1)` will make the element fully completely grayscale.
235+ marker . style . filter = `grayscale(${ dim ? 1 : 0 } )` ;
236+ }
237+ }
238+
220239 private updateMarkers ( ) : void {
221240 const filteredMarkers = new Map < number , Element > ( ) ;
222241 for ( const time of this . markers . keys ( ) ) {
@@ -383,7 +402,7 @@ export class TimelineOverviewPane extends Common.ObjectWrapper.eventMixin<EventT
383402 highlightBounds ( bounds : Trace . Types . Timing . TraceWindowMicroSeconds , withBracket : boolean ) : void {
384403 const left = this . overviewCalculator . computePosition ( Trace . Helpers . Timing . microSecondsToMilliseconds ( bounds . min ) ) ;
385404 const right = this . overviewCalculator . computePosition ( Trace . Helpers . Timing . microSecondsToMilliseconds ( bounds . max ) ) ;
386-
405+ this . #dimMarkers ( bounds ) ;
387406 // Update the punch out rectangle to the not-to-desaturate time range.
388407 const punchRect = this . #dimHighlightSVG. querySelector ( 'rect.punch' ) ;
389408 punchRect ?. setAttribute ( 'x' , left . toString ( ) ) ;
@@ -399,6 +418,7 @@ export class TimelineOverviewPane extends Common.ObjectWrapper.eventMixin<EventT
399418 }
400419
401420 clearBoundsHighlight ( ) : void {
421+ this . #dimMarkers( ) ;
402422 this . #dimHighlightSVG. classList . add ( 'hidden' ) ;
403423 }
404424}
0 commit comments