@@ -20,6 +20,8 @@ import * as Dialogs from '../../../ui/components/dialogs/dialogs.js';
2020import * as Input from '../../../ui/components/input/input.js' ;
2121import type * as Menus from '../../../ui/components/menus/menus.js' ;
2222import * 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' ;
2325import * as Lit from '../../../ui/lit/lit.js' ;
2426import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js' ;
2527import type * as Converters from '../converters/converters.js' ;
@@ -37,6 +39,10 @@ import {
3739 type StepViewData ,
3840} from './StepView.js' ;
3941
42+ // TODO(crbug.com/391381439): Fully migrate off of constructed style sheets.
43+ const inspectorCommonStyles = new CSSStyleSheet ( ) ;
44+ inspectorCommonStyles . replaceSync ( inspectorCommonStylesRaw . cssText ) ;
45+
4046// TODO(crbug.com/391381439): Fully migrate off of constructed style sheets.
4147const recordingViewStyles = new CSSStyleSheet ( ) ;
4248recordingViewStyles . replaceSync ( recordingViewStylesRaw . cssText ) ;
@@ -374,6 +380,7 @@ export class RecordingView extends HTMLElement {
374380
375381 connectedCallback ( ) : void {
376382 this . #shadow. adoptedStyleSheets = [
383+ inspectorCommonStyles ,
377384 recordingViewStyles ,
378385 Input . textInputStyles ,
379386 ] ;
@@ -552,15 +559,18 @@ export class RecordingView extends HTMLElement {
552559 this . #render( ) ;
553560 }
554561
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+ }
564574 }
565575
566576 #onTimeoutInput( event : Event ) : void {
@@ -744,31 +754,20 @@ export class RecordingView extends HTMLElement {
744754 replaySettingsFragments . push ( html `< div class ="editable-setting ">
745755 < label class ="wrapping-label " @click =${ this . #onSelectMenuLabelClick} >
746756 ${ 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 >
772771 </ label >
773772 </ div > ` ) ;
774773 replaySettingsFragments . push ( html `< div class ="editable-setting ">
0 commit comments