chrome-devtools-frontend 1.0.1739869 → 1.0.1742811

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/.agents/rules/ui-and-widgets/ui-accessibility-and-semantic-html.md +1 -1
  2. package/.agents/rules/ui-and-widgets/ui-css-scoping-and-flex-layout.md +44 -7
  3. package/.agents/rules/ui-and-widgets/ui-lit-declarative-templates-and-directives.md +1 -1
  4. package/.agents/rules/ui-and-widgets/ui-view-output-and-callback-contracts.md +2 -2
  5. package/.agents/rules/ui-and-widgets/ui-widget-dom-and-listener-lifecycle.md +1 -1
  6. package/.agents/skills/code-review/SKILL.md +23 -6
  7. package/.agents/skills/devtools-verification/SKILL.md +2 -1
  8. package/.agents/skills/migrate-chromium-test/SKILL.md +1 -0
  9. package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +27 -11
  10. package/.agents/skills/ui-eng-vision-orchestrator/SKILL.md +41 -23
  11. package/.agents/skills/ui-eng-vision-test-scaffolder/SKILL.md +12 -7
  12. package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +3 -0
  13. package/.agents/skills/ui-widgets/SKILL.md +22 -7
  14. package/.agents/skills/version-control/SKILL.md +10 -1
  15. package/.agents/skills/visual-regression-audit/SKILL.md +88 -0
  16. package/.gitallowed +2 -1
  17. package/.stylelintignore +1 -0
  18. package/.stylelintrc.json +2 -0
  19. package/AUTHORS +1 -0
  20. package/DIR_METADATA +2 -1
  21. package/PRESUBMIT_test.py +143 -0
  22. package/config/owner/INFRA_OWNERS +0 -1
  23. package/docs/contributing/infrastructure.md +2 -2
  24. package/docs/ui_engineering.md +14 -4
  25. package/eslint.config.mjs +1 -18
  26. package/front_end/application_tokens.css +0 -35
  27. package/front_end/core/host/AidaClient.ts +1 -1
  28. package/front_end/core/host/AidaClientTypes.ts +2 -0
  29. package/front_end/core/host/AidaErrors.ts +3 -3
  30. package/front_end/core/host/AidaGcaTranslation.ts +39 -0
  31. package/front_end/core/host/GcaClient.ts +32 -20
  32. package/front_end/core/host/GcaTypes.ts +4 -2
  33. package/front_end/core/host/InspectorFrontendHostAPI.ts +2 -0
  34. package/front_end/core/i18n/DevToolsLocale.ts +0 -1
  35. package/front_end/core/sdk/DebuggerModel.ts +25 -13
  36. package/front_end/core/sdk/PreloadingModel.ts +2 -2
  37. package/front_end/core/sdk/RehydratingConnection.ts +59 -30
  38. package/front_end/core/sdk/StorageKeyManager.ts +0 -1
  39. package/front_end/core/sdk/Target.ts +6 -0
  40. package/front_end/core/sdk/TargetManager.ts +10 -4
  41. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +12 -2
  42. package/front_end/entrypoints/inspector_main/OutermostTargetSelector.ts +159 -52
  43. package/front_end/entrypoints/inspector_main/outermostTargetSelector.css +77 -25
  44. package/front_end/entrypoints/main/MainImpl.ts +32 -15
  45. package/front_end/models/ai_assistance/AiAgent2.ts +95 -46
  46. package/front_end/models/ai_assistance/AiConversation.ts +1 -1
  47. package/front_end/models/ai_assistance/agents/AiAgent.ts +9 -2
  48. package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +3 -2
  49. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +1 -1
  50. package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +1 -1
  51. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +5 -4
  52. package/front_end/models/ai_assistance/performance/AICallTree.ts +7 -9
  53. package/front_end/models/ai_assistance/performance/AIQueries.ts +4 -8
  54. package/front_end/models/ai_assistance/skills/SkillRegistry.ts +11 -1
  55. package/front_end/models/ai_assistance/skills/lighthouse.md +1 -0
  56. package/front_end/models/ai_assistance/skills/network.md +3 -4
  57. package/front_end/models/ai_assistance/skills/sources.md +1 -2
  58. package/front_end/models/ai_assistance/skills/styling.md +3 -4
  59. package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +11 -3
  60. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +84 -23
  61. package/front_end/models/ai_assistance/tools/ListSources.ts +41 -13
  62. package/front_end/models/badges/Badge.ts +0 -1
  63. package/front_end/models/bindings/ResourceMapping.ts +1 -1
  64. package/front_end/models/bindings/ResourceScriptMapping.ts +1 -1
  65. package/front_end/models/breakpoints/BreakpointManager.ts +2 -4
  66. package/front_end/models/breakpoints/RecurringPauseDetector.ts +140 -0
  67. package/front_end/models/breakpoints/breakpoints.ts +2 -1
  68. package/front_end/models/heap_snapshot/HeapSnapshotModel.ts +2 -2
  69. package/front_end/models/persistence/Automapping.ts +0 -1
  70. package/front_end/models/trace/Processor.ts +16 -7
  71. package/front_end/models/trace/README.md +17 -1
  72. package/front_end/models/trace/extras/ThirdParties.ts +4 -6
  73. package/front_end/models/trace/extras/TraceTree.ts +69 -72
  74. package/front_end/models/trace/handlers/MetaHandler.ts +3 -0
  75. package/front_end/models/trace/handlers/types.ts +15 -0
  76. package/front_end/models/trace/helpers/Trace.ts +5 -3
  77. package/front_end/models/trace/lantern/simulation/Simulator.ts +4 -1
  78. package/front_end/models/web_mcp/WebMCPModel.ts +19 -9
  79. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +30 -3
  80. package/front_end/panels/ai_assistance/components/ChatMessage.ts +2 -4
  81. package/front_end/panels/ai_assistance/components/chatMessage.css +1 -22
  82. package/front_end/panels/ai_assistance/components/exploreWidget.css +1 -19
  83. package/front_end/panels/ai_assistance/components/optInChangeDialog.css +1 -1
  84. package/front_end/panels/ai_assistance/components/walkthroughView.css +0 -13
  85. package/front_end/panels/animation/AnimationGroupPreviewUI.ts +3 -2
  86. package/front_end/panels/animation/AnimationTimeline.ts +5 -3
  87. package/front_end/panels/animation/animationTimeline.css +10 -8
  88. package/front_end/panels/application/ApplicationPanelSidebar.ts +14 -11
  89. package/front_end/panels/application/ReportingApiView.ts +0 -1
  90. package/front_end/panels/application/SubAppsView.ts +0 -1
  91. package/front_end/panels/application/WebMCPTreeElement.ts +3 -6
  92. package/front_end/panels/application/WebMCPView.ts +30 -0
  93. package/front_end/panels/application/components/ReportsGrid.ts +0 -1
  94. package/front_end/panels/application/components/backForwardCacheView.css +0 -7
  95. package/front_end/panels/application/components/permissionsPolicySection.css +2 -2
  96. package/front_end/panels/application/components/protocolHandlersView.css +46 -39
  97. package/front_end/panels/application/components/trustTokensView.css +0 -4
  98. package/front_end/panels/application/cookieItemsView.css +0 -7
  99. package/front_end/panels/application/indexedDBViews.css +0 -6
  100. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +0 -2
  101. package/front_end/panels/application/preloading/components/PreloadingString.ts +0 -1
  102. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +4 -5
  103. package/front_end/panels/application/preloading/components/preloadingGrid.css +0 -9
  104. package/front_end/panels/application/serviceWorkerUpdateCycleView.css +2 -9
  105. package/front_end/panels/application/serviceWorkersView.css +5 -4
  106. package/front_end/panels/application/storageView.css +0 -5
  107. package/front_end/panels/application/webMCPView.css +17 -0
  108. package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +15 -20
  109. package/front_end/panels/changes/changesView.css +0 -5
  110. package/front_end/panels/common/ExtensionServer.ts +80 -10
  111. package/front_end/panels/console/ConsolePanel.ts +92 -18
  112. package/front_end/panels/console/consoleContextSelector.css +1 -8
  113. package/front_end/panels/console/consoleInsightTeaser.css +10 -17
  114. package/front_end/panels/console/consolePinPane.css +3 -1
  115. package/front_end/panels/console/consoleView.css +13 -17
  116. package/front_end/panels/coverage/coverageListView.css +0 -4
  117. package/front_end/panels/css_overview/cssOverviewCompletedView.css +0 -22
  118. package/front_end/panels/css_overview/cssOverviewStartView.css +0 -43
  119. package/front_end/panels/developer_resources/developerResourcesListView.css +0 -4
  120. package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +52 -45
  121. package/front_end/panels/elements/LayoutPane.ts +1 -3
  122. package/front_end/panels/elements/PropertiesWidget.ts +26 -8
  123. package/front_end/panels/elements/PropertyRenderer.ts +45 -21
  124. package/front_end/panels/elements/StandaloneStylesContainer.ts +6 -7
  125. package/front_end/panels/elements/StyleEditorWidget.ts +110 -63
  126. package/front_end/panels/elements/StylePropertiesSection.ts +14 -5
  127. package/front_end/panels/elements/StylePropertyTreeElement.ts +529 -518
  128. package/front_end/panels/elements/StylesContainer.ts +5 -6
  129. package/front_end/panels/elements/StylesSidebarPane.ts +12 -15
  130. package/front_end/panels/elements/components/CSSVariableValueView.ts +17 -4
  131. package/front_end/panels/elements/components/StylePropertyEditor.ts +178 -140
  132. package/front_end/panels/elements/components/cssQuery.css +1 -1
  133. package/front_end/panels/elements/components/stylePropertyEditor.css +60 -56
  134. package/front_end/panels/elements/layoutPane.css +2 -2
  135. package/front_end/panels/elements/metricsSidebarPane.css +6 -7
  136. package/front_end/panels/elements/platformFontsWidget.css +1 -1
  137. package/front_end/panels/elements/stylePropertiesTreeOutline.css +1 -6
  138. package/front_end/panels/elements/stylesSidebarPane.css +3 -4
  139. package/front_end/panels/emulation/deviceModeView.css +1 -1
  140. package/front_end/panels/event_listeners/EventListenersView.ts +9 -2
  141. package/front_end/panels/event_listeners/eventListenersView.css +1 -1
  142. package/front_end/panels/explain/components/consoleInsight.css +1 -2
  143. package/front_end/panels/issues/issuesTree.css +6 -43
  144. package/front_end/panels/layer_viewer/PaintProfilerView.ts +1 -1
  145. package/front_end/panels/layer_viewer/paintProfiler.css +4 -3
  146. package/front_end/panels/lighthouse/LighthouseReportSelector.ts +1 -6
  147. package/front_end/panels/lighthouse/lighthouseStartView.css +5 -16
  148. package/front_end/panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts +0 -1
  149. package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +2 -2
  150. package/front_end/panels/linear_memory_inspector/components/linearMemoryViewer.css +2 -2
  151. package/front_end/panels/linear_memory_inspector/components/valueInterpreterSettings.css +1 -1
  152. package/front_end/panels/media/playerListView.css +1 -2
  153. package/front_end/panels/media/playerPropertiesView.css +1 -1
  154. package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +2 -2
  155. package/front_end/panels/network/NetworkLogView.ts +594 -580
  156. package/front_end/panels/network/RequestCookiesView.ts +0 -1
  157. package/front_end/panels/network/networkConfigView.css +1 -2
  158. package/front_end/panels/network/networkLogView.css +363 -364
  159. package/front_end/panels/network/networkPanel.css +1 -5
  160. package/front_end/panels/network/networkTimingTable.css +1 -1
  161. package/front_end/panels/network/networkWaterfallColumn.css +1 -1
  162. package/front_end/panels/network/requestConditionsDrawer.css +0 -4
  163. package/front_end/panels/network/requestCookiesView.css +7 -1
  164. package/front_end/panels/network/requestPayloadTree.css +0 -4
  165. package/front_end/panels/profiler/HeapProfileView.ts +1 -3
  166. package/front_end/panels/profiler/HeapSnapshotView.ts +0 -7
  167. package/front_end/panels/recorder/RecorderPanel.ts +1 -1
  168. package/front_end/panels/recorder/RecordingView.ts +10 -10
  169. package/front_end/panels/recorder/StepView.ts +5 -4
  170. package/front_end/panels/recorder/createRecordingView.css +1 -1
  171. package/front_end/panels/recorder/recorderPanel.css +0 -8
  172. package/front_end/panels/recorder/recordingListView.css +4 -4
  173. package/front_end/panels/recorder/recordingView.css +12 -20
  174. package/front_end/panels/recorder/stepEditor.css +4 -4
  175. package/front_end/panels/recorder/stepView.css +31 -9
  176. package/front_end/panels/recorder/timelineSection.css +4 -0
  177. package/front_end/panels/screencast/ScreencastApp.ts +0 -1
  178. package/front_end/panels/security/mainView.css +1 -1
  179. package/front_end/panels/security/originView.css +2 -2
  180. package/front_end/panels/sensors/SensorsView.ts +273 -346
  181. package/front_end/panels/settings/BackendLinkingSettingsTab.ts +0 -1
  182. package/front_end/panels/settings/backendLinkingSettingsTab.css +7 -7
  183. package/front_end/panels/settings/components/syncSection.css +0 -1
  184. package/front_end/panels/settings/workspaceSettingsTab.css +0 -5
  185. package/front_end/panels/sources/CSSPlugin.ts +177 -98
  186. package/front_end/panels/sources/DebuggerPausedMessage.ts +100 -27
  187. package/front_end/panels/sources/NavigatorView.ts +926 -946
  188. package/front_end/panels/sources/SourcesPanel.ts +9 -2
  189. package/front_end/panels/sources/breakpointsView.css +6 -29
  190. package/front_end/panels/sources/components/HeadersView.css +2 -2
  191. package/front_end/panels/sources/debuggerPausedMessage.css +7 -0
  192. package/front_end/panels/sources/navigatorTree.css +7 -2
  193. package/front_end/panels/sources/sourcesNavigator.css +0 -9
  194. package/front_end/panels/sources/watchExpressionsSidebarPane.css +0 -10
  195. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +3 -0
  196. package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +0 -10
  197. package/front_end/panels/timeline/ModificationsManager.ts +0 -1
  198. package/front_end/panels/timeline/ThreadAppender.ts +2 -6
  199. package/front_end/panels/timeline/TimelinePanel.ts +2 -2
  200. package/front_end/panels/timeline/TimelineTreeView.ts +38 -41
  201. package/front_end/panels/timeline/TimelineUIUtils.ts +8 -10
  202. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +0 -2
  203. package/front_end/panels/timeline/components/fieldSettingsDialog.css +1 -6
  204. package/front_end/panels/timeline/components/insights/baseInsightComponent.css +0 -12
  205. package/front_end/panels/timeline/components/interactionBreakdown.css +1 -2
  206. package/front_end/panels/timeline/components/layoutShiftDetails.css +2 -9
  207. package/front_end/panels/timeline/components/liveMetricsView.css +0 -16
  208. package/front_end/panels/timeline/components/metricCard.css +1 -5
  209. package/front_end/panels/timeline/components/networkRequestDetails.css +3 -4
  210. package/front_end/panels/timeline/components/networkRequestTooltip.css +6 -4
  211. package/front_end/panels/timeline/components/sidebarAnnotationsTab.css +1 -1
  212. package/front_end/panels/timeline/components/sidebarInsightsTab.css +1 -2
  213. package/front_end/panels/timeline/timelineDetailsView.css +1 -12
  214. package/front_end/panels/timeline/timelineFlamechartPopover.css +0 -4
  215. package/front_end/panels/timeline/timelineMiniMap.css +1 -4
  216. package/front_end/panels/timeline/timelinePanel.css +0 -4
  217. package/front_end/panels/timeline/timelineStatusDialog.css +1 -1
  218. package/front_end/panels/timeline/timelineTreeView.css +0 -12
  219. package/front_end/panels/timeline/utils/EntryNodes.ts +1 -1
  220. package/front_end/panels/webauthn/webauthnPane.css +1 -7
  221. package/front_end/panels/whats_new/ReleaseNoteText.ts +1 -1
  222. package/front_end/third_party/chromium/README.chromium +1 -1
  223. package/front_end/ui/components/adorners/adorner.css +1 -1
  224. package/front_end/ui/components/buttons/button.css +0 -28
  225. package/front_end/ui/components/buttons/textButton.css +1 -45
  226. package/front_end/ui/components/input/checkbox.css +3 -3
  227. package/front_end/ui/components/issue_counter/issueLinkIcon.css +2 -2
  228. package/front_end/ui/components/menus/Menu.ts +14 -0
  229. package/front_end/ui/components/menus/menu.css +2 -14
  230. package/front_end/ui/components/menus/menuItem.css +0 -4
  231. package/front_end/ui/components/request_link_icon/requestLinkIcon.css +2 -2
  232. package/front_end/ui/components/survey_link/SurveyLink.ts +1 -1
  233. package/front_end/ui/components/survey_link/surveyLink.css +3 -3
  234. package/front_end/ui/components/switch/switch.css +3 -2
  235. package/front_end/ui/components/text_editor/theme.ts +1 -1
  236. package/front_end/ui/components/tooltips/Tooltip.ts +3 -3
  237. package/front_end/ui/components/tree_outline/treeOutline.css +0 -23
  238. package/front_end/ui/legacy/ContextMenu.ts +5 -5
  239. package/front_end/ui/legacy/SoftContextMenu.ts +24 -8
  240. package/front_end/ui/legacy/Toolbar.ts +1 -1
  241. package/front_end/ui/legacy/Treeoutline.ts +31 -78
  242. package/front_end/ui/legacy/UIUtils.ts +9 -17
  243. package/front_end/ui/legacy/checkboxTextLabel.css +2 -44
  244. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +39 -27
  245. package/front_end/ui/legacy/components/color_picker/spectrum.css +2 -10
  246. package/front_end/ui/legacy/components/data_grid/dataGrid.css +2 -6
  247. package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +34 -26
  248. package/front_end/ui/legacy/components/inline_editor/SwatchPopoverHelper.ts +1 -0
  249. package/front_end/ui/legacy/components/inline_editor/cssShadowEditor.css +1 -1
  250. package/front_end/ui/legacy/components/inline_editor/swatchPopover.css +1 -1
  251. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +49 -1
  252. package/front_end/ui/legacy/components/object_ui/objectPopover.css +0 -4
  253. package/front_end/ui/legacy/components/perf_ui/chartViewport.css +1 -9
  254. package/front_end/ui/legacy/components/perf_ui/filmStripView.css +1 -1
  255. package/front_end/ui/legacy/components/perf_ui/overviewGrid.css +2 -1
  256. package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +0 -5
  257. package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +6 -3
  258. package/front_end/ui/legacy/components/source_frame/JSONView.ts +95 -1
  259. package/front_end/ui/legacy/filter.css +1 -1
  260. package/front_end/ui/legacy/inspectorCommon.css +6 -28
  261. package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +1 -1
  262. package/front_end/ui/legacy/listWidget.css +1 -1
  263. package/front_end/ui/legacy/progressIndicator.css +1 -1
  264. package/front_end/ui/legacy/tabbedPane.css +6 -2
  265. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
  266. package/front_end/ui/visual_logging/LoggingDriver.ts +4 -0
  267. package/front_end/ui/visual_logging/visual_logging.ts +1 -1
  268. package/inspector_overlay/common.ts +0 -3
  269. package/inspector_overlay/main.ts +1 -3
  270. package/inspector_overlay/tool_source_order.css +0 -4
  271. package/package.json +1 -1
  272. package/front_end/generated/SupportedCSSProperties.ts +0 -9705
@@ -11,7 +11,7 @@ import * as Buttons from '../../ui/components/buttons/buttons.js';
11
11
  import * as Geometry from '../../ui/geometry/geometry.js';
12
12
  import * as SettingsUI from '../../ui/legacy/components/settings_ui/settings_ui.js';
13
13
  import * as UI from '../../ui/legacy/legacy.js';
14
- import {Directives, html, render} from '../../ui/lit/lit.js';
14
+ import {Directives, html, render, type TemplateResult} from '../../ui/lit/lit.js';
15
15
  import * as SettingUIRegistration from '../../ui/settings/settings.js';
16
16
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
17
17
  import * as MobileThrottling from '../mobile_throttling/mobile_throttling.js';
@@ -187,44 +187,116 @@ const UIStrings = {
187
187
  } as const;
188
188
  const str_ = i18n.i18n.registerUIStrings('panels/sensors/SensorsView.ts', UIStrings);
189
189
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
190
- const {live} = Directives;
190
+ const {classMap, live, styleMap} = Directives;
191
+
192
+ function selectInputContent(event: Event): void {
193
+ (event.currentTarget as HTMLInputElement).select();
194
+ }
195
+
196
+ interface LocationViewInput {
197
+ location: SDK.EmulationModel.Location;
198
+ locationOverrideEnabled: boolean;
199
+ customLocations: LocationDescription[];
200
+ selectedLocationIndex: number;
201
+ timezoneError: string;
202
+ localeError: string;
203
+ onManageLocations: () => void;
204
+ onLocationSelectChange: (event: Event) => void;
205
+ onLocationChange: (event: Event) => void;
206
+ onLocationKeyDown: (event: KeyboardEvent) => void;
207
+ }
208
+
209
+ interface OrientationViewInput {
210
+ orientation: SDK.EmulationModel.DeviceOrientation;
211
+ orientationOverrideEnabled: boolean;
212
+ selectedOrientation: string;
213
+ animateOrientation: boolean;
214
+ }
215
+
216
+ interface ViewInput extends LocationViewInput, OrientationViewInput {
217
+ locationSection: TemplateResult;
218
+ orientationSection: TemplateResult;
219
+ touchSetting: Common.Settings.Setting<unknown>;
220
+ idleDetectionSetting: Common.Settings.Setting<unknown>;
221
+ hardwareConcurrencyCheckbox: HTMLElement;
222
+ hardwareConcurrencyDetails: HTMLElement[];
223
+ cpuPressureSetting: Common.Settings.Setting<unknown>;
224
+ cpuPerformanceSetting: Common.Settings.Setting<unknown>;
225
+ cpuPerformanceNoOverrideLabel: string;
226
+ }
227
+
228
+ // clang-format off
229
+ const DEFAULT_VIEW = (input: ViewInput, _output: undefined, target: HTMLElement): void => {
230
+ render(html`
231
+ <section class="sensors-group" jslog=${VisualLogging.section('location')}>
232
+ ${input.locationSection}
233
+ </section>
234
+ <div class="panel-section-separator"></div>
235
+ <section class="sensors-group" jslog=${VisualLogging.section('device-orientation')}>
236
+ ${input.orientationSection}
237
+ </section>
238
+ <div class="panel-section-separator"></div>
239
+ <div class="touch-section">
240
+ ${SettingsUI.SettingsUI.renderControlForSetting(
241
+ input.touchSetting, i18nString(UIStrings.forcesTouchInsteadOfClick))}
242
+ </div>
243
+ <div class="panel-section-separator"></div>
244
+ <div class="idle-section">
245
+ ${SettingsUI.SettingsUI.renderControlForSetting(
246
+ input.idleDetectionSetting, i18nString(UIStrings.forcesSelectedIdleStateEmulation))}
247
+ </div>
248
+ <div class="panel-section-separator"></div>
249
+ <div class="concurrency-section">
250
+ ${input.hardwareConcurrencyCheckbox}
251
+ <div class="concurrency-details">${input.hardwareConcurrencyDetails}</div>
252
+ </div>
253
+ <div class="panel-section-separator"></div>
254
+ <div class="pressure-section">
255
+ ${SettingsUI.SettingsUI.renderControlForSetting(
256
+ input.cpuPressureSetting, i18nString(UIStrings.forcesSelectedPressureStateEmulation))}
257
+ </div>
258
+ <div class="panel-section-separator"></div>
259
+ <div class="cpu-performance-section">
260
+ ${SettingsUI.SettingsUI.renderSettingSelect(
261
+ input.cpuPerformanceSetting, i18nString(UIStrings.forcesSelectedCpuPerformanceTierEmulation), false,
262
+ new Map([['no-override', input.cpuPerformanceNoOverrideLabel]]))}
263
+ </div>
264
+ <div class="panel-section-separator"></div>`, target, {
265
+ container: {attributes: {jslog: `${VisualLogging.panel('sensors').track({resize: true})}`}},
266
+ });
267
+ };
268
+ // clang-format on
269
+
270
+ type View = typeof DEFAULT_VIEW;
191
271
 
192
272
  export class SensorsView extends UI.Widget.VBox {
273
+ readonly #view: View;
193
274
  readonly #locationSetting: Common.Settings.Setting<string>;
194
275
  #location: SDK.EmulationModel.Location;
195
276
  #locationOverrideEnabled: boolean;
196
- readonly #locationSectionElement: HTMLElement;
197
- private fieldsetElement!: HTMLFieldSetElement;
198
- private timezoneError!: HTMLElement;
199
- private locationSelectElement!: HTMLSelectElement;
277
+ // Whether "Other…" is selected, even if the location matches one of the custom locations.
278
+ #customLocationSelected = false;
279
+ readonly #customLocationsSetting: Common.Settings.Setting<LocationDescription[]>;
280
+ #timezoneError = '';
281
+ #localeError = '';
200
282
  private latitudeInput!: HTMLInputElement;
201
- private longitudeInput!: HTMLInputElement;
202
- private timezoneInput!: HTMLInputElement;
203
- private localeInput!: HTMLInputElement;
204
- private accuracyInput!: HTMLInputElement;
205
- private localeError!: HTMLElement;
206
- private accuracyError!: HTMLElement;
207
283
  private readonly deviceOrientationSetting: Common.Settings.Setting<string>;
208
284
  private deviceOrientation: SDK.EmulationModel.DeviceOrientation;
209
285
  private deviceOrientationOverrideEnabled: boolean;
210
- private deviceOrientationFieldset!: HTMLFieldSetElement;
211
286
  private stageElement!: HTMLElement;
212
- private orientationSelectElement!: HTMLSelectElement;
287
+ #selectedOrientation: string = NonPresetOptions.NoOverride;
213
288
  private alphaElement!: HTMLInputElement;
214
- private betaElement!: HTMLInputElement;
215
- private gammaElement!: HTMLInputElement;
216
- private orientationLayer!: HTMLDivElement;
289
+ #animateOrientation = false;
217
290
  private boxMatrix?: DOMMatrix;
218
291
  private mouseDownVector?: Geometry.Vector|null;
219
292
  private originalBoxMatrix?: DOMMatrix;
220
293
  readonly #cpuThrottlingManager: SDK.CPUThrottlingManager.CPUThrottlingManager;
221
- #cpuPerformanceNoOverrideOptionElement?: HTMLOptionElement;
294
+ readonly #hardwareConcurrencyCheckbox: HTMLElement;
295
+ readonly #hardwareConcurrencyDetails: HTMLElement[];
222
296
 
223
- constructor() {
224
- super({
225
- jslog: `${VisualLogging.panel('sensors').track({resize: true})}`,
226
- useShadowDom: true,
227
- });
297
+ constructor(element?: HTMLElement, view: View = DEFAULT_VIEW) {
298
+ super(element, {useShadowDom: true});
299
+ this.#view = view;
228
300
  this.registerRequiredCSS(sensorsStyles);
229
301
  this.contentElement.classList.add('sensors-view');
230
302
 
@@ -234,56 +306,70 @@ export class SensorsView extends UI.Widget.VBox {
234
306
  this.#location = SDK.EmulationModel.Location.parseSetting(this.#locationSetting.get());
235
307
  this.#locationOverrideEnabled = false;
236
308
 
237
- this.#locationSectionElement = this.contentElement.createChild('section', 'sensors-group');
238
- const customLocationsSetting = Common.Settings.Settings.instance().resolve(
309
+ this.#customLocationsSetting = Common.Settings.Settings.instance().resolve(
239
310
  SettingUIRegistration.EmulationSettings.emulationLocationsSettingDescriptor);
240
- this.renderLocationSection(this.#location, customLocationsSetting);
241
- customLocationsSetting.addChangeListener(() => this.renderLocationSection(this.#location, customLocationsSetting));
242
-
243
- this.createPanelSeparator();
311
+ this.#customLocationsSetting.addChangeListener(() => this.performUpdate());
244
312
 
245
313
  this.deviceOrientationSetting =
246
314
  Common.Settings.Settings.instance().createSetting('emulation.device-orientation-override', '');
247
315
  this.deviceOrientation = SDK.EmulationModel.DeviceOrientation.parseSetting(this.deviceOrientationSetting.get());
248
316
  this.deviceOrientationOverrideEnabled = false;
249
317
 
250
- this.createDeviceOrientationSection();
251
-
252
- this.createPanelSeparator();
253
-
254
- this.appendTouchControl();
255
-
256
- this.createPanelSeparator();
257
-
258
- this.appendIdleEmulator();
259
-
260
- this.createPanelSeparator();
261
-
262
- this.createHardwareConcurrencySection();
263
-
264
- this.createPanelSeparator();
265
-
266
- this.createPressureSection();
267
-
268
- this.createPanelSeparator();
269
-
270
- this.createCPUPerformanceSection();
318
+ const {checkbox, numericInput, reset, warning} =
319
+ MobileThrottling.ThrottlingManager.throttlingManager().createHardwareConcurrencySelector();
320
+ this.#hardwareConcurrencyCheckbox = checkbox;
321
+ this.#hardwareConcurrencyDetails = [numericInput.element, reset.element, warning.element];
271
322
 
272
- this.createPanelSeparator();
323
+ this.setBoxOrientation(false);
324
+ this.performUpdate();
273
325
  }
274
326
 
275
- private createPanelSeparator(): void {
276
- this.contentElement.createChild('div').classList.add('panel-section-separator');
327
+ override performUpdate(): void {
328
+ const customLocations = this.#customLocationsSetting.get();
329
+ const locationInput: LocationViewInput = {
330
+ location: this.#location,
331
+ locationOverrideEnabled: this.#locationOverrideEnabled,
332
+ customLocations,
333
+ selectedLocationIndex: this.#selectedLocationIndex(customLocations),
334
+ timezoneError: this.#timezoneError,
335
+ localeError: this.#localeError,
336
+ onManageLocations: () => Common.Revealer.reveal(this.#customLocationsSetting),
337
+ onLocationSelectChange: this.#locationSelectChanged.bind(this),
338
+ onLocationChange: this.#onLocationChange.bind(this),
339
+ onLocationKeyDown: this.#onLocationKeyDown.bind(this),
340
+ };
341
+ const orientationInput: OrientationViewInput = {
342
+ orientation: this.deviceOrientation,
343
+ orientationOverrideEnabled: this.deviceOrientationOverrideEnabled,
344
+ selectedOrientation: this.#selectedOrientation,
345
+ animateOrientation: this.#animateOrientation,
346
+ };
347
+ const input: ViewInput = {
348
+ ...locationInput,
349
+ ...orientationInput,
350
+ locationSection: this.#renderLocationSection(locationInput),
351
+ orientationSection: this.#renderDeviceOrientationSection(orientationInput),
352
+ touchSetting: Common.Settings.Settings.instance().resolve(SDK.SDKSettings.touchSettingDescriptor),
353
+ idleDetectionSetting: Common.Settings.Settings.instance().resolve(SDK.SDKSettings.idleDetectionSettingDescriptor),
354
+ hardwareConcurrencyCheckbox: this.#hardwareConcurrencyCheckbox,
355
+ hardwareConcurrencyDetails: this.#hardwareConcurrencyDetails,
356
+ cpuPressureSetting: Common.Settings.Settings.instance().resolve(SDK.SDKSettings.cpuPressureSettingDescriptor),
357
+ cpuPerformanceSetting:
358
+ Common.Settings.Settings.instance().resolve(SDK.SDKSettings.cpuPerformanceSettingDescriptor),
359
+ cpuPerformanceNoOverrideLabel: this.#cpuPerformanceNoOverrideLabel(),
360
+ };
361
+ this.#view(input, undefined, this.contentElement);
277
362
  }
278
363
 
279
- private renderLocationSection(
280
- location: SDK.EmulationModel.Location,
281
- customLocationsSetting: Common.Settings.Setting<LocationDescription[]>): void {
282
- const customLocations = customLocationsSetting.get();
364
+ /** @returns the index of the selected option of the location select. */
365
+ #selectedLocationIndex(customLocations: LocationDescription[]): number {
366
+ const location = this.#location;
283
367
  let selectedIndex = 0;
284
368
  if (this.#locationOverrideEnabled) {
285
369
  if (location.unavailable) {
286
370
  selectedIndex = customLocations.length + 2;
371
+ } else if (this.#customLocationSelected) {
372
+ selectedIndex = customLocations.length + 1;
287
373
  } else {
288
374
  selectedIndex = customLocations.length + 1;
289
375
  for (const [i, customLocation] of customLocations.entries()) {
@@ -295,43 +381,37 @@ export class SensorsView extends UI.Widget.VBox {
295
381
  }
296
382
  }
297
383
  }
384
+ return selectedIndex;
385
+ }
298
386
 
387
+ #renderLocationSection(input: LocationViewInput): TemplateResult {
299
388
  const cmdOrCtrl = Host.Platform.isMac() ? '\u2318' : 'Ctrl';
300
389
  const modifierKeyMessage = i18nString(UIStrings.adjustWithMousewheelOrUpdownKeys, {PH1: cmdOrCtrl});
301
390
 
302
- this.#locationSectionElement.setAttribute('jslog', `${VisualLogging.section('location')}`);
303
-
304
391
  // clang-format off
305
- // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
306
- render(
307
- html`
392
+ return html`
308
393
  <label class="sensors-group-title" id="location-select-label" for="location-select">${i18nString(UIStrings.location)}</label>
309
394
  <div class="geo-fields">
310
395
  <select
311
396
  id="location-select"
312
- ${Directives.ref((el: Element | undefined) => {
313
- if (el) {
314
- this.locationSelectElement = el as HTMLSelectElement;
315
- }
316
- })}
317
- @change=${this.#locationSelectChanged.bind(this)}
397
+ @change=${input.onLocationSelectChange}
318
398
  jslog=${VisualLogging.dropDown().track({change: true})}
319
399
  >
320
- <option value=${NonPresetOptions.NoOverride} .selected=${live(selectedIndex === 0)} jslog=${VisualLogging.item('no-override')}>${i18nString(UIStrings.noOverride)}</option>
400
+ <option value=${NonPresetOptions.NoOverride} .selected=${live(input.selectedLocationIndex === 0)} jslog=${VisualLogging.item('no-override')}>${i18nString(UIStrings.noOverride)}</option>
321
401
  <optgroup label=${i18nString(UIStrings.overrides)}>
322
- ${customLocations.map((customLocation, i) => html`
323
- <option value=${JSON.stringify(customLocation)} .selected=${live(selectedIndex === i + 1)} jslog=${VisualLogging.item('custom')}>${customLocation.title}</option>
402
+ ${input.customLocations.map((customLocation, i) => html`
403
+ <option value=${JSON.stringify(customLocation)} .selected=${live(input.selectedLocationIndex === i + 1)} jslog=${VisualLogging.item('custom')}>${customLocation.title}</option>
324
404
  `)}
325
405
  </optgroup>
326
- <option value=${NonPresetOptions.Custom} .selected=${live(selectedIndex === customLocations.length + 1)} jslog=${VisualLogging.item('other')}>${i18nString(UIStrings.other)}</option>
406
+ <option value=${NonPresetOptions.Custom} .selected=${live(input.selectedLocationIndex === input.customLocations.length + 1)} jslog=${VisualLogging.item('other')}>${i18nString(UIStrings.other)}</option>
327
407
  <optgroup label=${i18nString(UIStrings.error)}>
328
- <option value=${NonPresetOptions.Unavailable} .selected=${live(selectedIndex === customLocations.length + 2)} jslog=${VisualLogging.item('unavailable')}>${i18nString(UIStrings.locationUnavailable)}</option>
408
+ <option value=${NonPresetOptions.Unavailable} .selected=${live(input.selectedLocationIndex === input.customLocations.length + 2)} jslog=${VisualLogging.item('unavailable')}>${i18nString(UIStrings.locationUnavailable)}</option>
329
409
  </optgroup>
330
410
  </select>
331
411
  <devtools-button
332
412
  .variant=${Buttons.Button.Variant.OUTLINED}
333
413
  class="manage-locations"
334
- @click=${() => Common.Revealer.reveal(customLocationsSetting)}
414
+ @click=${input.onManageLocations}
335
415
  aria-label=${i18nString(UIStrings.manageTheListOfLocations)}
336
416
  jslog=${VisualLogging.action('sensors.manage-locations').track({click: true})}
337
417
  >
@@ -339,12 +419,7 @@ export class SensorsView extends UI.Widget.VBox {
339
419
  </devtools-button>
340
420
  <fieldset
341
421
  id="location-override-section"
342
- ?disabled=${!this.#locationOverrideEnabled}
343
- ${Directives.ref((el: Element | undefined) => {
344
- if (el) {
345
- this.fieldsetElement = el as HTMLFieldSetElement;
346
- }
347
- })}
422
+ ?disabled=${!input.locationOverrideEnabled}
348
423
  >
349
424
  <div class="latlong-group">
350
425
  <!-- @ts-ignore -->
@@ -355,14 +430,14 @@ export class SensorsView extends UI.Widget.VBox {
355
430
  max="90"
356
431
  step="any"
357
432
  required
358
- .value=${String(location.latitude)}
433
+ .value=${String(input.location.latitude)}
359
434
  name="latitude"
360
435
  title=${modifierKeyMessage}
361
436
  jslog=${VisualLogging.textField('latitude').track({change: true})}
362
437
  ${Directives.ref((el: Element | undefined) => { if (el) { this.latitudeInput = el as HTMLInputElement; } })}
363
- @change=${this.#onLocationChange.bind(this)}
364
- @keydown=${this.#onLocationKeyDown.bind(this)}
365
- @focus=${this.#onLocationFocus.bind(this)}
438
+ @change=${input.onLocationChange}
439
+ @keydown=${input.onLocationKeyDown}
440
+ @focus=${selectInputContent}
366
441
  >
367
442
  <label class="latlong-title" for="latitude-input">${i18nString(UIStrings.latitude)}</label>
368
443
  </div>
@@ -375,14 +450,13 @@ export class SensorsView extends UI.Widget.VBox {
375
450
  max="180"
376
451
  step="any"
377
452
  required
378
- .value=${String(location.longitude)}
453
+ .value=${String(input.location.longitude)}
379
454
  name="longitude"
380
455
  title=${modifierKeyMessage}
381
456
  jslog=${VisualLogging.textField('longitude').track({change: true})}
382
- ${Directives.ref((el: Element | undefined) => { if (el) { this.longitudeInput = el as HTMLInputElement; } })}
383
- @change=${this.#onLocationChange.bind(this)}
384
- @keydown=${this.#onLocationKeyDown.bind(this)}
385
- @focus=${this.#onLocationFocus.bind(this)}
457
+ @change=${input.onLocationChange}
458
+ @keydown=${input.onLocationKeyDown}
459
+ @focus=${selectInputContent}
386
460
  >
387
461
  <label class="latlong-title" for="longitude-input">${i18nString(UIStrings.longitude)}</label>
388
462
  </div>
@@ -391,32 +465,30 @@ export class SensorsView extends UI.Widget.VBox {
391
465
  id="timezone-input"
392
466
  type="text"
393
467
  pattern=".*[a-zA-Z].*"
394
- .value=${location.timezoneId}
468
+ .value=${input.location.timezoneId}
395
469
  name="timezone"
396
470
  jslog=${VisualLogging.textField('timezone').track({change: true})}
397
- ${Directives.ref((el: Element | undefined) => { if (el) { this.timezoneInput = el as HTMLInputElement; } })}
398
- @change=${this.#onLocationChange.bind(this)}
399
- @keydown=${this.#onLocationKeyDown.bind(this)}
400
- @focus=${this.#onLocationFocus.bind(this)}
471
+ @change=${input.onLocationChange}
472
+ @keydown=${input.onLocationKeyDown}
473
+ @focus=${selectInputContent}
401
474
  >
402
475
  <label class="timezone-title" for="timezone-input">${i18nString(UIStrings.timezoneId)}</label>
403
- <div class="timezone-error" ${Directives.ref((el: Element | undefined) => { if (el) { this.timezoneError = el as HTMLElement; } })}></div>
476
+ <div class="timezone-error">${input.timezoneError}</div>
404
477
  </div>
405
478
  <div class="latlong-group">
406
479
  <input
407
480
  id="locale-input"
408
481
  type="text"
409
482
  pattern=".*[a-zA-Z]{2}.*"
410
- .value=${location.locale}
483
+ .value=${input.location.locale}
411
484
  name="locale"
412
485
  jslog=${VisualLogging.textField('locale').track({change: true})}
413
- ${Directives.ref((el: Element | undefined) => { if (el) { this.localeInput = el as HTMLInputElement; } })}
414
- @change=${this.#onLocationChange.bind(this)}
415
- @keydown=${this.#onLocationKeyDown.bind(this)}
416
- @focus=${this.#onLocationFocus.bind(this)}
486
+ @change=${input.onLocationChange}
487
+ @keydown=${input.onLocationKeyDown}
488
+ @focus=${selectInputContent}
417
489
  >
418
490
  <label class="locale-title" for="locale-input">${i18nString(UIStrings.locale)}</label>
419
- <div class="locale-error" ${Directives.ref((el: Element | undefined) => { if (el) { this.localeError = el as HTMLElement; } })}></div>
491
+ <div class="locale-error">${input.localeError}</div>
420
492
  </div>
421
493
  <div class="latlong-group">
422
494
  <!-- @ts-ignore -->
@@ -425,59 +497,45 @@ export class SensorsView extends UI.Widget.VBox {
425
497
  type="number"
426
498
  min="0"
427
499
  step="any"
428
- .value=${String(location.accuracy || SDK.EmulationModel.Location.DEFAULT_ACCURACY)}
500
+ .value=${String(input.location.accuracy || SDK.EmulationModel.Location.DEFAULT_ACCURACY)}
429
501
  name="accuracy"
430
502
  jslog=${VisualLogging.textField('accuracy').track({change: true})}
431
- ${Directives.ref((el: Element | undefined) => { if (el) { this.accuracyInput = el as HTMLInputElement; } })}
432
- @change=${this.#onLocationChange.bind(this)}
433
- @keydown=${this.#onLocationKeyDown.bind(this)}
434
- @focus=${this.#onLocationFocus.bind(this)}
503
+ @change=${input.onLocationChange}
504
+ @keydown=${input.onLocationKeyDown}
505
+ @focus=${selectInputContent}
435
506
  >
436
507
  <label class="accuracy-title" for="accuracy-input">${i18nString(UIStrings.accuracy)}</label>
437
- <div class="accuracy-error" ${Directives.ref((el: Element | undefined) => { if (el) { this.accuracyError = el as HTMLElement; } })}></div>
438
508
  </div>
439
509
  </fieldset>
440
510
  </div>
441
- `, this.#locationSectionElement);
511
+ `;
442
512
  // clang-format on
443
513
  }
444
514
 
445
- #locationSelectChanged(): void {
446
- this.fieldsetElement.disabled = false;
447
- this.timezoneError.textContent = '';
448
- this.accuracyError.textContent = '';
449
- const value = this.locationSelectElement.options[this.locationSelectElement.selectedIndex].value;
515
+ #locationSelectChanged(event: Event): void {
516
+ this.#timezoneError = '';
517
+ this.#localeError = '';
518
+ const value = (event.currentTarget as HTMLSelectElement).value;
519
+ this.#customLocationSelected = value === NonPresetOptions.Custom;
450
520
  if (value === NonPresetOptions.NoOverride) {
451
521
  this.#locationOverrideEnabled = false;
452
- this.clearFieldsetElementInputs();
453
- this.fieldsetElement.disabled = true;
454
- } else if (value === NonPresetOptions.Custom) {
522
+ this.#location = SDK.EmulationModel.Location.parseSetting('');
523
+ } else if (value === NonPresetOptions.Custom || value === NonPresetOptions.Unavailable) {
455
524
  this.#locationOverrideEnabled = true;
456
- const location = SDK.EmulationModel.Location.parseUserInput(
457
- this.latitudeInput.value.trim(), this.longitudeInput.value.trim(), this.timezoneInput.value.trim(),
458
- this.localeInput.value.trim(), this.accuracyInput.value.trim());
459
- if (!location) {
460
- return;
461
- }
462
- this.#location = location;
463
- } else if (value === NonPresetOptions.Unavailable) {
464
- this.#locationOverrideEnabled = true;
465
- this.#location =
466
- new SDK.EmulationModel.Location(0, 0, '', '', SDK.EmulationModel.Location.DEFAULT_ACCURACY, true);
525
+ // Keep the values that are shown in the inputs.
526
+ const {latitude, longitude, timezoneId, locale, accuracy} = this.#location;
527
+ this.#location = new SDK.EmulationModel.Location(latitude, longitude, timezoneId, locale, accuracy,
528
+ value === NonPresetOptions.Unavailable);
467
529
  } else {
468
530
  this.#locationOverrideEnabled = true;
469
531
  const coordinates = JSON.parse(value);
470
532
  this.#location = new SDK.EmulationModel.Location(
471
533
  coordinates.lat, coordinates.long, coordinates.timezoneId, coordinates.locale,
472
534
  coordinates.accuracy || SDK.EmulationModel.Location.DEFAULT_ACCURACY, false);
473
- this.latitudeInput.value = coordinates.lat;
474
- this.longitudeInput.value = coordinates.long;
475
- this.timezoneInput.value = coordinates.timezoneId;
476
- this.localeInput.value = coordinates.locale;
477
- this.accuracyInput.value = String(coordinates.accuracy || SDK.EmulationModel.Location.DEFAULT_ACCURACY);
478
535
  }
479
536
 
480
537
  this.applyLocation();
538
+ this.performUpdate();
481
539
  if (value === NonPresetOptions.Custom) {
482
540
  this.latitudeInput.focus();
483
541
  }
@@ -486,7 +544,7 @@ export class SensorsView extends UI.Widget.VBox {
486
544
  #onLocationChange(event: Event): void {
487
545
  const input = event.currentTarget as HTMLInputElement;
488
546
  if (input.checkValidity()) {
489
- this.applyLocationUserInput();
547
+ this.applyLocationUserInput(input);
490
548
  }
491
549
  }
492
550
 
@@ -494,18 +552,17 @@ export class SensorsView extends UI.Widget.VBox {
494
552
  const input = event.currentTarget as HTMLInputElement;
495
553
  if (event.key === 'Enter') {
496
554
  if (input.checkValidity()) {
497
- this.applyLocationUserInput();
555
+ this.applyLocationUserInput(input);
498
556
  }
499
557
  event.preventDefault();
500
558
  return;
501
559
  }
502
560
 
503
- const isNumeric = input === this.latitudeInput || input === this.longitudeInput || input === this.accuracyInput;
504
- if (!isNumeric) {
561
+ if (input.type !== 'number') {
505
562
  return;
506
563
  }
507
564
 
508
- const multiplier = input === this.accuracyInput ? 1 : 0.1;
565
+ const multiplier = input.name === 'accuracy' ? 1 : 0.1;
509
566
  const value = UI.UIUtils.modifiedFloatNumber(parseFloat(input.value), event, multiplier);
510
567
  if (value === null) {
511
568
  return;
@@ -513,7 +570,7 @@ export class SensorsView extends UI.Widget.VBox {
513
570
  const prevValue = input.value;
514
571
  input.value = String(value);
515
572
  if (input.checkValidity()) {
516
- this.applyLocationUserInput();
573
+ this.applyLocationUserInput(input);
517
574
  } else {
518
575
  // If ArrowUp/ArrowDown adjusts the value out of bounds, we reset it.
519
576
  input.value = prevValue;
@@ -521,25 +578,30 @@ export class SensorsView extends UI.Widget.VBox {
521
578
  event.preventDefault();
522
579
  }
523
580
 
524
- #onLocationFocus(event: Event): void {
525
- const input = event.currentTarget as HTMLInputElement;
526
- input.select();
527
- }
528
-
529
- private applyLocationUserInput(): void {
530
- const location = SDK.EmulationModel.Location.parseUserInput(
531
- this.latitudeInput.value.trim(), this.longitudeInput.value.trim(), this.timezoneInput.value.trim(),
532
- this.localeInput.value.trim(), this.accuracyInput.value.trim());
581
+ private applyLocationUserInput(input: HTMLInputElement): void {
582
+ // Only the changed input is read, the other values are taken from the current location.
583
+ const {latitude, longitude, timezoneId: timezone, locale, accuracy} = this.#location;
584
+ const values = {
585
+ latitude: String(latitude),
586
+ longitude: String(longitude),
587
+ timezone,
588
+ locale,
589
+ accuracy: String(accuracy),
590
+ [input.name]: input.value.trim(),
591
+ };
592
+ const location = SDK.EmulationModel.Location.parseUserInput(values.latitude, values.longitude, values.timezone,
593
+ values.locale, values.accuracy);
533
594
  if (!location) {
534
595
  return;
535
596
  }
536
597
 
537
- this.timezoneError.textContent = '';
538
- this.accuracyError.textContent = '';
598
+ this.#timezoneError = '';
599
+ this.#localeError = '';
539
600
 
540
- this.setSelectElementLabel(this.locationSelectElement, NonPresetOptions.Custom);
601
+ this.#customLocationSelected = true;
541
602
  this.#location = location;
542
603
  this.applyLocation();
604
+ this.performUpdate();
543
605
  }
544
606
 
545
607
  private applyLocation(): void {
@@ -552,34 +614,20 @@ export class SensorsView extends UI.Widget.VBox {
552
614
  emulationModel.emulateLocation(this.#locationOverrideEnabled ? this.#location : null).catch(err => {
553
615
  switch (err.type) {
554
616
  case 'emulation-set-timezone': {
555
- this.timezoneError.textContent = err.message;
617
+ this.#timezoneError = err.message;
556
618
  break;
557
619
  }
558
620
  case 'emulation-set-locale': {
559
- this.localeError.textContent = err.message;
560
- break;
561
- }
562
- case 'emulation-set-accuracy': {
563
- this.accuracyError.textContent = err.message;
621
+ this.#localeError = err.message;
564
622
  break;
565
623
  }
566
624
  }
625
+ this.performUpdate();
567
626
  });
568
627
  }
569
628
  }
570
629
 
571
- private clearFieldsetElementInputs(): void {
572
- this.latitudeInput.value = '0';
573
- this.longitudeInput.value = '0';
574
- this.timezoneInput.value = '';
575
- this.localeInput.value = '';
576
- this.accuracyInput.value = SDK.EmulationModel.Location.DEFAULT_ACCURACY.toString();
577
- }
578
-
579
- private createDeviceOrientationSection(): void {
580
- const orientationGroup = this.contentElement.createChild('section', 'sensors-group');
581
- orientationGroup.setAttribute('jslog', `${VisualLogging.section('device-orientation')}`);
582
-
630
+ #renderDeviceOrientationSection(input: OrientationViewInput): TemplateResult {
583
631
  const orientationOffOption = {
584
632
  title: i18nString(UIStrings.off),
585
633
  orientation: NonPresetOptions.NoOverride,
@@ -604,41 +652,32 @@ export class SensorsView extends UI.Widget.VBox {
604
652
  {title: i18nString(UIStrings.displayDown), orientation: '[0, -180, 0]', jslogContext: 'displayUp-down'},
605
653
  ],
606
654
  }];
655
+ // The angles are not rounded in the state, only when they are shown in the inputs.
656
+ const roundAngle = (angle: number): string => String(Math.round(angle * 10000) / 10000);
607
657
 
608
658
  // clang-format off
609
- // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
610
- render(
611
- html`
659
+ return html`
612
660
  <label class="sensors-group-title" for="orientation-select">${i18nString(UIStrings.orientation)}</label>
613
661
  <div class="orientation-content">
614
662
  <div class="orientation-fields">
615
663
  <select
616
664
  id="orientation-select"
617
- ${Directives.ref((el: Element | undefined) => {
618
- if (el) {
619
- this.orientationSelectElement = el as HTMLSelectElement;
620
- }
621
- })}
622
665
  @change=${this.orientationSelectChanged.bind(this)}
623
666
  jslog=${VisualLogging.dropDown().track({change: true})}
624
667
  >
625
- <option value=${orientationOffOption.orientation} jslog=${VisualLogging.item(orientationOffOption.jslogContext)}>${orientationOffOption.title}</option>
626
- <option value=${customOrientationOption.orientation} jslog=${VisualLogging.item('custom')}>${customOrientationOption.title}</option>
668
+ <option value=${orientationOffOption.orientation} .selected=${live(input.selectedOrientation === orientationOffOption.orientation)} jslog=${VisualLogging.item(orientationOffOption.jslogContext)}>${orientationOffOption.title}</option>
669
+ <option value=${customOrientationOption.orientation} .selected=${live(input.selectedOrientation === customOrientationOption.orientation)} jslog=${VisualLogging.item('custom')}>${customOrientationOption.title}</option>
627
670
  ${orientationGroups.map(group => html`
628
671
  <optgroup label=${group.title}>
629
672
  ${group.value.map(preset => html`
630
- <option value=${preset.orientation} jslog=${VisualLogging.item(preset.jslogContext)}>${preset.title}</option>
673
+ <option value=${preset.orientation} .selected=${live(input.selectedOrientation === preset.orientation)} jslog=${VisualLogging.item(preset.jslogContext)}>${preset.title}</option>
631
674
  `)}
632
675
  </optgroup>
633
676
  `)}
634
677
  </select>
635
678
  <fieldset
636
679
  class="device-orientation-override-section"
637
- ${Directives.ref((el: Element | undefined) => {
638
- if (el) {
639
- this.deviceOrientationFieldset = el as HTMLFieldSetElement;
640
- }
641
- })}
680
+ ?disabled=${!input.orientationOverrideEnabled}
642
681
  >
643
682
  <div class="orientation-inputs-cell">
644
683
  <div class="orientation-axis-input-container">
@@ -650,10 +689,12 @@ export class SensorsView extends UI.Widget.VBox {
650
689
  max="359.9999"
651
690
  step="any"
652
691
  required
692
+ .value=${roundAngle(input.orientation.alpha)}
693
+ name="alpha"
653
694
  ${Directives.ref((el: Element | undefined) => { if (el) { this.alphaElement = el as HTMLInputElement; } })}
654
695
  @change=${this.#onOrientationChange.bind(this)}
655
696
  @keydown=${this.#onOrientationKeyDown.bind(this)}
656
- @focus=${this.#onOrientationFocus.bind(this)}
697
+ @focus=${selectInputContent}
657
698
  >
658
699
  <label for="alpha-input">${i18nString(UIStrings.alpha)}</label>
659
700
  </div>
@@ -666,10 +707,11 @@ export class SensorsView extends UI.Widget.VBox {
666
707
  max="179.9999"
667
708
  step="any"
668
709
  required
669
- ${Directives.ref((el: Element | undefined) => { if (el) { this.betaElement = el as HTMLInputElement; } })}
710
+ .value=${roundAngle(input.orientation.beta)}
711
+ name="beta"
670
712
  @change=${this.#onOrientationChange.bind(this)}
671
713
  @keydown=${this.#onOrientationKeyDown.bind(this)}
672
- @focus=${this.#onOrientationFocus.bind(this)}
714
+ @focus=${selectInputContent}
673
715
  >
674
716
  <label for="beta-input">${i18nString(UIStrings.beta)}</label>
675
717
  </div>
@@ -682,10 +724,11 @@ export class SensorsView extends UI.Widget.VBox {
682
724
  max="89.9999"
683
725
  step="any"
684
726
  required
685
- ${Directives.ref((el: Element | undefined) => { if (el) { this.gammaElement = el as HTMLInputElement; } })}
727
+ .value=${roundAngle(input.orientation.gamma)}
728
+ name="gamma"
686
729
  @change=${this.#onOrientationChange.bind(this)}
687
730
  @keydown=${this.#onOrientationKeyDown.bind(this)}
688
- @focus=${this.#onOrientationFocus.bind(this)}
731
+ @focus=${selectInputContent}
689
732
  >
690
733
  <label for="gamma-input">${i18nString(UIStrings.gamma)}</label>
691
734
  </div>
@@ -703,7 +746,9 @@ export class SensorsView extends UI.Widget.VBox {
703
746
  </fieldset>
704
747
  </div>
705
748
  <div
706
- class="orientation-stage"
749
+ class="orientation-stage ${classMap({disabled: !input.orientationOverrideEnabled, 'is-animating': input.animateOrientation})}"
750
+ title=${input.orientationOverrideEnabled ? i18nString(UIStrings.shiftdragHorizontallyToRotate) :
751
+ i18nString(UIStrings.enableOrientationToRotate)}
707
752
  jslog=${VisualLogging.preview().track({drag: true})}
708
753
  ${Directives.ref((el: Element | undefined) => {
709
754
  if (el && !this.stageElement) {
@@ -714,7 +759,7 @@ export class SensorsView extends UI.Widget.VBox {
714
759
  }
715
760
  })}
716
761
  >
717
- <div class="orientation-layer" ${Directives.ref((el: Element | undefined) => { if (el) { this.orientationLayer = el as HTMLDivElement; } })}>
762
+ <div class="orientation-layer" style=${styleMap({transform: `rotateY(${input.orientation.alpha}deg) rotateX(${- input.orientation.beta}deg) rotateZ(${input.orientation.gamma}deg)`})}>
718
763
  <section
719
764
  class="orientation-box orientation-element"
720
765
  >
@@ -728,74 +773,32 @@ export class SensorsView extends UI.Widget.VBox {
728
773
  </div>
729
774
  </div>
730
775
  </div>
731
- `,
732
- orientationGroup,
733
- );
776
+ `;
734
777
  // clang-format on
735
-
736
- this.enableOrientationFields(true);
737
- this.setBoxOrientation(this.deviceOrientation, false);
738
-
739
- this.alphaElement.value = String(this.deviceOrientation.alpha);
740
- this.betaElement.value = String(this.deviceOrientation.beta);
741
- this.gammaElement.value = String(this.deviceOrientation.gamma);
742
- }
743
-
744
- private createPressureSection(): void {
745
- const container = this.contentElement.createChild('div', 'pressure-section');
746
- const control = SettingsUI.SettingsUI.createControlForSetting(
747
- Common.Settings.Settings.instance().resolve(SDK.SDKSettings.cpuPressureSettingDescriptor),
748
- i18nString(UIStrings.forcesSelectedPressureStateEmulation));
749
-
750
- if (control) {
751
- container.appendChild(control);
752
- }
753
- }
754
-
755
- private createCPUPerformanceSection(): void {
756
- const container = this.contentElement.createChild('div', 'cpu-performance-section');
757
- const control = SettingsUI.SettingsUI.createControlForSetting(
758
- Common.Settings.Settings.instance().resolve(SDK.SDKSettings.cpuPerformanceSettingDescriptor),
759
- i18nString(UIStrings.forcesSelectedCpuPerformanceTierEmulation));
760
-
761
- if (control) {
762
- container.appendChild(control);
763
- // The text of the "no override" option element needs to be updated dynamically.
764
- const noOverrideOption = control.querySelector<HTMLOptionElement>('select option[value="no-override"]');
765
- if (noOverrideOption) {
766
- this.#cpuPerformanceNoOverrideOptionElement = noOverrideOption;
767
- this.#updateCPUPerformanceNoOverrideLabel();
768
- } else {
769
- this.#cpuPerformanceNoOverrideOptionElement = undefined;
770
- }
771
- }
772
778
  }
773
779
 
774
780
  override wasShown(): void {
775
781
  super.wasShown();
776
- if (this.#cpuPerformanceNoOverrideOptionElement) {
777
- this.#cpuThrottlingManager.addEventListener(SDK.CPUThrottlingManager.Events.CPU_PERFORMANCE_TIER_CHANGED,
778
- this.#updateCPUPerformanceNoOverrideLabel, this);
779
- this.#cpuThrottlingManager.addEventListener(SDK.CPUThrottlingManager.Events.RATE_CHANGED,
780
- this.#updateCPUPerformanceNoOverrideLabel, this);
781
- this.#updateCPUPerformanceNoOverrideLabel();
782
- }
782
+ this.#cpuThrottlingManager.addEventListener(SDK.CPUThrottlingManager.Events.CPU_PERFORMANCE_TIER_CHANGED,
783
+ this.#updateCPUPerformanceNoOverrideLabel, this);
784
+ this.#cpuThrottlingManager.addEventListener(SDK.CPUThrottlingManager.Events.RATE_CHANGED,
785
+ this.#updateCPUPerformanceNoOverrideLabel, this);
786
+ this.#updateCPUPerformanceNoOverrideLabel();
783
787
  }
784
788
 
785
789
  override willHide(): void {
786
790
  super.willHide();
787
- if (this.#cpuPerformanceNoOverrideOptionElement) {
788
- this.#cpuThrottlingManager.removeEventListener(SDK.CPUThrottlingManager.Events.CPU_PERFORMANCE_TIER_CHANGED,
789
- this.#updateCPUPerformanceNoOverrideLabel, this);
790
- this.#cpuThrottlingManager.removeEventListener(SDK.CPUThrottlingManager.Events.RATE_CHANGED,
791
- this.#updateCPUPerformanceNoOverrideLabel, this);
792
- }
791
+ this.#cpuThrottlingManager.removeEventListener(SDK.CPUThrottlingManager.Events.CPU_PERFORMANCE_TIER_CHANGED,
792
+ this.#updateCPUPerformanceNoOverrideLabel, this);
793
+ this.#cpuThrottlingManager.removeEventListener(SDK.CPUThrottlingManager.Events.RATE_CHANGED,
794
+ this.#updateCPUPerformanceNoOverrideLabel, this);
793
795
  }
794
796
 
795
797
  #updateCPUPerformanceNoOverrideLabel(): void {
796
- if (!this.#cpuPerformanceNoOverrideOptionElement) {
797
- return;
798
- }
798
+ this.performUpdate();
799
+ }
800
+
801
+ #cpuPerformanceNoOverrideLabel(): string {
799
802
  // Helper function to retrieve the tier labels (i18n) from the settings.
800
803
  const options =
801
804
  SettingUIRegistration.SettingUIRegistration.resolve(SDK.SDKSettings.cpuPerformanceSettingDescriptor).options;
@@ -810,44 +813,28 @@ export class SensorsView extends UI.Widget.VBox {
810
813
  const getFallbackTitle = (tier: SDK.CPUThrottlingManager.CPUPerformanceTier): string => {
811
814
  return `Tier ${SDK.CPUThrottlingManager.tierToNumber(tier)}: ${tier.toUpperCase()}`;
812
815
  };
813
- // Update the text of the "no-override" element using the calculated tier.
816
+ // Compute the text of the "no-override" option using the calculated tier.
814
817
  const calculatedTier = this.#cpuThrottlingManager.calculatedCPUPerformanceTier();
815
818
  if (calculatedTier !== undefined) {
816
819
  const tierTitle = getOptionTitle(calculatedTier) || getFallbackTitle(calculatedTier);
817
- this.#cpuPerformanceNoOverrideOptionElement.text =
818
- i18nString(UIStrings.cpuPerformanceNoOverrideWithDefault, {PH1: tierTitle});
819
- } else {
820
- this.#cpuPerformanceNoOverrideOptionElement.text = getOptionTitle('no-override') || 'No override';
820
+ return i18nString(UIStrings.cpuPerformanceNoOverrideWithDefault, {PH1: tierTitle});
821
821
  }
822
+ return getOptionTitle('no-override') || 'No override';
822
823
  }
823
824
 
824
- private enableOrientationFields(disable: boolean|null): void {
825
- if (disable) {
826
- this.deviceOrientationFieldset.disabled = true;
827
- this.stageElement.classList.add('disabled');
828
- UI.Tooltip.Tooltip.install(this.stageElement, i18nString(UIStrings.enableOrientationToRotate));
829
- } else {
830
- this.deviceOrientationFieldset.disabled = false;
831
- this.stageElement.classList.remove('disabled');
832
- UI.Tooltip.Tooltip.install(this.stageElement, i18nString(UIStrings.shiftdragHorizontallyToRotate));
833
- }
834
- }
835
-
836
- private orientationSelectChanged(): void {
837
- const value = this.orientationSelectElement.options[this.orientationSelectElement.selectedIndex].value;
838
- this.enableOrientationFields(false);
825
+ private orientationSelectChanged(event: Event): void {
826
+ const value = (event.currentTarget as HTMLSelectElement).value;
827
+ this.#selectedOrientation = value;
828
+ this.deviceOrientationOverrideEnabled = value !== NonPresetOptions.NoOverride;
829
+ this.performUpdate();
839
830
 
840
831
  if (value === NonPresetOptions.NoOverride) {
841
- this.deviceOrientationOverrideEnabled = false;
842
- this.enableOrientationFields(true);
843
832
  this.applyDeviceOrientation();
844
833
  } else if (value === NonPresetOptions.Custom) {
845
- this.deviceOrientationOverrideEnabled = true;
846
834
  this.resetDeviceOrientation();
847
835
  this.alphaElement.focus();
848
836
  } else {
849
837
  const parsedValue = JSON.parse(value);
850
- this.deviceOrientationOverrideEnabled = true;
851
838
  this.deviceOrientation = new SDK.EmulationModel.DeviceOrientation(parsedValue[0], parsedValue[1], parsedValue[2]);
852
839
  this.setDeviceOrientation(this.deviceOrientation, DeviceOrientationModificationSource.SELECT_PRESET);
853
840
  }
@@ -863,23 +850,19 @@ export class SensorsView extends UI.Widget.VBox {
863
850
  }
864
851
  }
865
852
 
866
- private setSelectElementLabel(selectElement: HTMLSelectElement, labelValue: string): void {
867
- const optionValues = Array.prototype.map.call(selectElement.options, x => x.value);
868
- selectElement.selectedIndex = optionValues.indexOf(labelValue);
869
- }
870
-
871
- private applyDeviceOrientationUserInput(): void {
853
+ private applyDeviceOrientationUserInput(input: HTMLInputElement): void {
854
+ const {alpha, beta, gamma} = this.deviceOrientation;
855
+ const values = {alpha: String(alpha), beta: String(beta), gamma: String(gamma), [input.name]: input.value.trim()};
856
+ this.#selectedOrientation = NonPresetOptions.Custom;
872
857
  this.setDeviceOrientation(
873
- SDK.EmulationModel.DeviceOrientation.parseUserInput(
874
- this.alphaElement.value.trim(), this.betaElement.value.trim(), this.gammaElement.value.trim()),
858
+ SDK.EmulationModel.DeviceOrientation.parseUserInput(values.alpha, values.beta, values.gamma),
875
859
  DeviceOrientationModificationSource.USER_INPUT);
876
- this.setSelectElementLabel(this.orientationSelectElement, NonPresetOptions.Custom);
877
860
  }
878
861
 
879
862
  private resetDeviceOrientation(): void {
863
+ this.#selectedOrientation = '[0, 90, 0]';
880
864
  this.setDeviceOrientation(
881
865
  new SDK.EmulationModel.DeviceOrientation(0, 90, 0), DeviceOrientationModificationSource.RESET_BUTTON);
882
- this.setSelectElementLabel(this.orientationSelectElement, '[0, 90, 0]');
883
866
  }
884
867
 
885
868
  private setDeviceOrientation(
@@ -889,24 +872,11 @@ export class SensorsView extends UI.Widget.VBox {
889
872
  return;
890
873
  }
891
874
 
892
- function roundAngle(angle: number): number {
893
- return Math.round(angle * 10000) / 10000;
894
- }
895
-
896
- if (modificationSource !== DeviceOrientationModificationSource.USER_INPUT) {
897
- // Even though the angles in |deviceOrientation| will not be rounded
898
- // here, their precision will be rounded by CSS when we change
899
- // |this.orientationLayer.style| in setBoxOrientation().
900
- this.alphaElement.value = String(roundAngle(deviceOrientation.alpha));
901
- this.betaElement.value = String(roundAngle(deviceOrientation.beta));
902
- this.gammaElement.value = String(roundAngle(deviceOrientation.gamma));
903
- }
904
-
905
875
  const animate = modificationSource !== DeviceOrientationModificationSource.USER_DRAG;
906
- this.setBoxOrientation(deviceOrientation, animate);
907
-
908
876
  this.deviceOrientation = deviceOrientation;
877
+ this.setBoxOrientation(animate);
909
878
  this.applyDeviceOrientation();
879
+ this.performUpdate();
910
880
 
911
881
  UI.ARIAUtils.LiveAnnouncer.alert(i18nString(
912
882
  UIStrings.deviceOrientationSetToAlphaSBeta,
@@ -916,7 +886,7 @@ export class SensorsView extends UI.Widget.VBox {
916
886
  #onOrientationChange(event: Event): void {
917
887
  const input = event.currentTarget as HTMLInputElement;
918
888
  if (input.checkValidity()) {
919
- this.applyDeviceOrientationUserInput();
889
+ this.applyDeviceOrientationUserInput(input);
920
890
  }
921
891
  }
922
892
 
@@ -924,7 +894,7 @@ export class SensorsView extends UI.Widget.VBox {
924
894
  const input = event.currentTarget as HTMLInputElement;
925
895
  if (event.key === 'Enter') {
926
896
  if (input.checkValidity()) {
927
- this.applyDeviceOrientationUserInput();
897
+ this.applyDeviceOrientationUserInput(input);
928
898
  }
929
899
  event.preventDefault();
930
900
  return;
@@ -937,7 +907,7 @@ export class SensorsView extends UI.Widget.VBox {
937
907
  const prevValue = input.value;
938
908
  input.value = String(value);
939
909
  if (input.checkValidity()) {
940
- this.applyDeviceOrientationUserInput();
910
+ this.applyDeviceOrientationUserInput(input);
941
911
  } else {
942
912
  // If ArrowUp/ArrowDown adjusts the value out of bounds, we reset it.
943
913
  input.value = prevValue;
@@ -945,17 +915,8 @@ export class SensorsView extends UI.Widget.VBox {
945
915
  event.preventDefault();
946
916
  }
947
917
 
948
- #onOrientationFocus(event: Event): void {
949
- const input = event.currentTarget as HTMLInputElement;
950
- input.select();
951
- }
952
-
953
- private setBoxOrientation(deviceOrientation: SDK.EmulationModel.DeviceOrientation, animate: boolean): void {
954
- if (animate) {
955
- this.stageElement.classList.add('is-animating');
956
- } else {
957
- this.stageElement.classList.remove('is-animating');
958
- }
918
+ private setBoxOrientation(animate: boolean): void {
919
+ this.#animateOrientation = animate;
959
920
 
960
921
  // It is important to explain the multiple conversions happening here. A
961
922
  // few notes on coordinate spaces first:
@@ -981,9 +942,8 @@ export class SensorsView extends UI.Widget.VBox {
981
942
  // The CSS transforms, on the other hand, are done in the CSS coordinate
982
943
  // space, so we need to convert 2) to 1) while keeping 3) in mind. We can
983
944
  // cover 3) by swapping the Y and Z axes, and 2) by inverting the X axis.
984
- const {alpha, beta, gamma} = deviceOrientation;
945
+ const {alpha, beta, gamma} = this.deviceOrientation;
985
946
  this.boxMatrix = new DOMMatrixReadOnly().rotate(0, 0, alpha).rotate(beta, 0, 0).rotate(0, gamma, 0);
986
- this.orientationLayer.style.transform = `rotateY(${alpha}deg) rotateX(${- beta}deg) rotateZ(${gamma}deg)`;
987
947
  }
988
948
 
989
949
  private onBoxDrag(event: MouseEvent): boolean {
@@ -1017,8 +977,8 @@ export class SensorsView extends UI.Widget.VBox {
1017
977
  const eulerAngles = Geometry.EulerAngles.fromDeviceOrientationRotationMatrix(currentMatrix);
1018
978
  const newOrientation =
1019
979
  new SDK.EmulationModel.DeviceOrientation(eulerAngles.alpha, eulerAngles.beta, eulerAngles.gamma);
980
+ this.#selectedOrientation = NonPresetOptions.Custom;
1020
981
  this.setDeviceOrientation(newOrientation, DeviceOrientationModificationSource.USER_DRAG);
1021
- this.setSelectElementLabel(this.orientationSelectElement, NonPresetOptions.Custom);
1022
982
  return false;
1023
983
  }
1024
984
 
@@ -1050,39 +1010,6 @@ export class SensorsView extends UI.Widget.VBox {
1050
1010
 
1051
1011
  return new Geometry.Vector(sphereX, sphereY, Math.sqrt(1 - sqrSum));
1052
1012
  }
1053
-
1054
- private appendTouchControl(): void {
1055
- const container = this.contentElement.createChild('div', 'touch-section');
1056
- const control = SettingsUI.SettingsUI.createControlForSetting(
1057
- Common.Settings.Settings.instance().resolve(SDK.SDKSettings.touchSettingDescriptor),
1058
- i18nString(UIStrings.forcesTouchInsteadOfClick));
1059
-
1060
- if (control) {
1061
- container.appendChild(control);
1062
- }
1063
- }
1064
-
1065
- private appendIdleEmulator(): void {
1066
- const container = this.contentElement.createChild('div', 'idle-section');
1067
- const control = SettingsUI.SettingsUI.createControlForSetting(
1068
- Common.Settings.Settings.instance().resolve(SDK.SDKSettings.idleDetectionSettingDescriptor),
1069
- i18nString(UIStrings.forcesSelectedIdleStateEmulation));
1070
-
1071
- if (control) {
1072
- container.appendChild(control);
1073
- }
1074
- }
1075
-
1076
- private createHardwareConcurrencySection(): void {
1077
- const container = this.contentElement.createChild('div', 'concurrency-section');
1078
-
1079
- const {checkbox, numericInput, reset, warning} =
1080
- MobileThrottling.ThrottlingManager.throttlingManager().createHardwareConcurrencySelector();
1081
- const div = document.createElement('div');
1082
- div.classList.add('concurrency-details');
1083
- div.append(numericInput.element, reset.element, warning.element);
1084
- container.append(checkbox, div);
1085
- }
1086
1013
  }
1087
1014
 
1088
1015
  export const enum DeviceOrientationModificationSource {