@@ -20,6 +20,8 @@ import * as Dialogs from '../../../ui/components/dialogs/dialogs.js';
20
20
import * as Input from '../../../ui/components/input/input.js' ;
21
21
import type * as Menus from '../../../ui/components/menus/menus.js' ;
22
22
import * as TextEditor from '../../../ui/components/text_editor/text_editor.js' ;
23
+ // eslint-disable-next-line rulesdir/es-modules-import
24
+ import inspectorCommonStylesRaw from '../../../ui/legacy/inspectorCommon.css.js' ;
23
25
import * as Lit from '../../../ui/lit/lit.js' ;
24
26
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js' ;
25
27
import type * as Converters from '../converters/converters.js' ;
@@ -37,6 +39,10 @@ import {
37
39
type StepViewData ,
38
40
} from './StepView.js' ;
39
41
42
+ // TODO(crbug.com/391381439): Fully migrate off of constructed style sheets.
43
+ const inspectorCommonStyles = new CSSStyleSheet ( ) ;
44
+ inspectorCommonStyles . replaceSync ( inspectorCommonStylesRaw . cssText ) ;
45
+
40
46
// TODO(crbug.com/391381439): Fully migrate off of constructed style sheets.
41
47
const recordingViewStyles = new CSSStyleSheet ( ) ;
42
48
recordingViewStyles . replaceSync ( recordingViewStylesRaw . cssText ) ;
@@ -374,6 +380,7 @@ export class RecordingView extends HTMLElement {
374
380
375
381
connectedCallback ( ) : void {
376
382
this . #shadow. adoptedStyleSheets = [
383
+ inspectorCommonStyles ,
377
384
recordingViewStyles ,
378
385
Input . textInputStyles ,
379
386
] ;
@@ -552,15 +559,18 @@ export class RecordingView extends HTMLElement {
552
559
this . #render( ) ;
553
560
}
554
561
555
- #onNetworkConditionsChange( event : Menus . SelectMenu . SelectMenuItemSelectedEvent ) : void {
556
- const preset = networkConditionPresets . find (
557
- preset => preset . i18nTitleKey === event . itemValue ,
558
- ) ;
559
- this . dispatchEvent (
560
- new NetworkConditionsChanged (
561
- preset ?. i18nTitleKey === SDK . NetworkManager . NoThrottlingConditions . i18nTitleKey ? undefined : preset ,
562
- ) ,
563
- ) ;
562
+ #onNetworkConditionsChange( event : Event ) : void {
563
+ const throttlingMenu = event . target ;
564
+ if ( throttlingMenu instanceof HTMLSelectElement ) {
565
+ const preset = networkConditionPresets . find (
566
+ preset => preset . i18nTitleKey === throttlingMenu . value ,
567
+ ) ;
568
+ this . dispatchEvent (
569
+ new NetworkConditionsChanged (
570
+ preset ?. i18nTitleKey === SDK . NetworkManager . NoThrottlingConditions . i18nTitleKey ? undefined : preset ,
571
+ ) ,
572
+ ) ;
573
+ }
564
574
}
565
575
566
576
#onTimeoutInput( event : Event ) : void {
@@ -744,31 +754,20 @@ export class RecordingView extends HTMLElement {
744
754
replaySettingsFragments . push ( html `< div class ="editable-setting ">
745
755
< label class ="wrapping-label " @click =${ this . #onSelectMenuLabelClick} >
746
756
${ i18nString ( UIStrings . network ) }
747
- < devtools-select-menu
748
- @selectmenuselected =${ this . #onNetworkConditionsChange}
749
- .disabled =${ ! this . #steps. find ( step => step . type === 'navigate' ) }
750
- .showDivider=${ true }
751
- .showArrow=${ true }
752
- .sideButton=${ false }
753
- .showSelectedItem=${ true }
754
- .jslogContext=${ 'network-conditions' }
755
- .position=${ Dialogs . Dialog . DialogVerticalPosition . BOTTOM }
756
- .buttonTitle=${ menuButtonTitle }
757
- >
758
- ${ networkConditionPresets . map ( condition => {
759
- return html `< devtools-menu-item
760
- .value =${ condition . i18nTitleKey || '' }
761
- .selected =${ selectedOption === condition . i18nTitleKey }
762
- jslog=${ VisualLogging . item ( Platform . StringUtilities . toKebabCase ( condition . i18nTitleKey || '' ) ) }
763
- >
764
- ${
765
- condition . title instanceof Function
766
- ? condition . title ( )
767
- : condition . title
768
- }
769
- </ devtools-menu-item > ` ;
770
- } ) }
771
- </ devtools-select-menu >
757
+ < select
758
+ title =${ menuButtonTitle }
759
+ jslog =${ VisualLogging . dropDown ( 'network-conditions' ) . track ( { change : true } ) }
760
+ @change=${ this . #onNetworkConditionsChange} >
761
+ ${ networkConditionPresets . map ( condition => html `
762
+ < option jslog =${ VisualLogging . item ( Platform . StringUtilities . toKebabCase ( condition . i18nTitleKey || '' ) ) }
763
+ value =${ condition . i18nTitleKey || '' } ?selected=${ selectedOption === condition . i18nTitleKey } >
764
+ ${
765
+ condition . title instanceof Function
766
+ ? condition . title ( )
767
+ : condition . title
768
+ }
769
+ </ option > ` ) }
770
+ </ select >
772
771
</ label >
773
772
</ div > ` ) ;
774
773
replaySettingsFragments . push ( html `< div class ="editable-setting ">
0 commit comments