chrome-devtools-frontend 1.0.1672388 → 1.0.1672557

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 (103) hide show
  1. package/eslint.config.mjs +3 -3
  2. package/front_end/core/root/Runtime.ts +0 -5
  3. package/front_end/generated/{SupportedCSSProperties.js → SupportedCSSProperties.ts} +16 -0
  4. package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +1 -1
  5. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +4 -3
  6. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +1 -1
  7. package/front_end/models/emulation/EmulatedDevices.ts +1 -1
  8. package/front_end/models/trace/Processor.ts +42 -10
  9. package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +12 -19
  10. package/front_end/models/trace/handlers/MetaHandler.ts +38 -5
  11. package/front_end/models/trace/insights/CLSCulprits.ts +1 -2
  12. package/front_end/models/trace/insights/CharacterSet.ts +1 -1
  13. package/front_end/models/trace/insights/Common.ts +21 -2
  14. package/front_end/models/trace/insights/DocumentLatency.ts +1 -1
  15. package/front_end/models/trace/insights/LCPBreakdown.ts +7 -6
  16. package/front_end/models/trace/insights/LCPDiscovery.ts +1 -1
  17. package/front_end/models/trace/insights/ModernHTTP.ts +7 -3
  18. package/front_end/models/trace/insights/NetworkDependencyTree.ts +1 -1
  19. package/front_end/models/trace/insights/RenderBlocking.ts +1 -1
  20. package/front_end/models/trace/insights/ThirdParties.ts +5 -2
  21. package/front_end/models/trace/insights/types.ts +11 -6
  22. package/front_end/models/trace/types/Configuration.ts +5 -0
  23. package/front_end/panels/elements/ElementsTreeElement.ts +1 -2
  24. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +3 -1
  25. package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +463 -13
  26. package/front_end/panels/timeline/TimelinePanel.ts +2 -0
  27. package/front_end/panels/timeline/components/CWVMetrics.ts +16 -3
  28. package/front_end/panels/timeline/components/cwvMetrics.css +4 -0
  29. package/front_end/panels/timeline/components/liveMetricsView.css +0 -17
  30. package/front_end/panels/timeline/components/metricValueStyles.css +17 -0
  31. package/front_end/third_party/chromium/README.chromium +1 -1
  32. package/front_end/third_party/puppeteer/README.chromium +2 -2
  33. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +64 -15
  34. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +65 -16
  35. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts +50 -7
  36. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts.map +1 -1
  37. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js.map +1 -1
  38. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.d.ts +2 -1
  39. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.d.ts.map +1 -1
  40. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.js +5 -5
  41. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.js.map +1 -1
  42. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.d.ts +2 -1
  43. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.d.ts.map +1 -1
  44. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.js +8 -6
  45. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.js.map +1 -1
  46. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Dialog.d.ts.map +1 -1
  47. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Dialog.js +3 -0
  48. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Dialog.js.map +1 -1
  49. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts.map +1 -1
  50. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js +16 -1
  51. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js.map +1 -1
  52. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.d.ts +5 -1
  53. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.d.ts.map +1 -1
  54. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.js +11 -6
  55. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.js.map +1 -1
  56. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Dialog.d.ts.map +1 -1
  57. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Dialog.js +5 -0
  58. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Dialog.js.map +1 -1
  59. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
  60. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js +10 -0
  61. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js.map +1 -1
  62. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js +4 -3
  63. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js.map +1 -1
  64. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.d.ts +27 -2
  65. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.d.ts.map +1 -1
  66. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.js +12 -1
  67. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.js.map +1 -1
  68. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.d.ts +2 -2
  69. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.d.ts.map +1 -1
  70. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.js +2 -2
  71. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.js.map +1 -1
  72. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  73. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.js +2 -0
  74. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.js.map +1 -1
  75. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.d.ts +2 -1
  76. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.d.ts.map +1 -1
  77. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.js +5 -4
  78. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.js.map +1 -1
  79. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
  80. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
  81. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
  82. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
  83. package/front_end/third_party/puppeteer/package/lib/types.d.ts +64 -15
  84. package/front_end/third_party/puppeteer/package/package.json +2 -2
  85. package/front_end/third_party/puppeteer/package/src/api/Page.ts +50 -7
  86. package/front_end/third_party/puppeteer/package/src/bidi/BidiOverCdp.ts +9 -7
  87. package/front_end/third_party/puppeteer/package/src/bidi/Connection.ts +9 -6
  88. package/front_end/third_party/puppeteer/package/src/bidi/Dialog.ts +4 -0
  89. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +24 -1
  90. package/front_end/third_party/puppeteer/package/src/cdp/Connection.ts +11 -6
  91. package/front_end/third_party/puppeteer/package/src/cdp/Dialog.ts +7 -0
  92. package/front_end/third_party/puppeteer/package/src/cdp/NetworkManager.ts +11 -0
  93. package/front_end/third_party/puppeteer/package/src/common/BrowserConnector.ts +7 -3
  94. package/front_end/third_party/puppeteer/package/src/common/Debug.ts +30 -5
  95. package/front_end/third_party/puppeteer/package/src/common/util.ts +2 -2
  96. package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +2 -0
  97. package/front_end/third_party/puppeteer/package/src/node/ScreenRecorder.ts +6 -4
  98. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  99. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  100. package/front_end/ui/visual_logging/KnownContextValues.ts +16 -0
  101. package/package.json +1 -1
  102. /package/front_end/core/host/{UserMetricsEnums.d.ts → UserMetricsEnums.ts} +0 -0
  103. /package/front_end/generated/{ARIAProperties.js → ARIAProperties.ts} +0 -0
@@ -105,6 +105,108 @@ const UIStrings = {
105
105
  * @example {9999} PH3
106
106
  */
107
107
  safeAreaValueMustBeInRange: '{PH1}: {PH2} must be an integer from 0 to {PH3}.',
108
+ /**
109
+ * @description Error message shown when custom device safe-area left and right insets are too large.
110
+ * @example {Portrait safe area} PH1
111
+ */
112
+ safeAreaHorizontalInsetsExceedWidth: '{PH1}: Left and right insets must not exceed the device width.',
113
+ /**
114
+ * @description Error message shown when custom device safe-area top and bottom insets are too large.
115
+ * @example {Landscape safe area} PH1
116
+ */
117
+ safeAreaVerticalInsetsExceedHeight: '{PH1}: Top and bottom insets must not exceed the device height.',
118
+ /**
119
+ * @description Label for display cutout values on a custom device.
120
+ */
121
+ displayCutout: 'Display cutout',
122
+ /**
123
+ * @description Option shown when a custom device has no display cutout.
124
+ */
125
+ noDisplayCutout: 'No cutout',
126
+ /**
127
+ * @description Option shown for pill-shaped display cutouts such as Dynamic Island.
128
+ */
129
+ pillDisplayCutout: 'Pill',
130
+ /**
131
+ * @description Option shown for classic notch display cutouts.
132
+ */
133
+ notchDisplayCutout: 'Notch',
134
+ /**
135
+ * @description Option shown for circular display cutouts such as hole-punch cameras.
136
+ */
137
+ circleDisplayCutout: 'Circle',
138
+ /**
139
+ * @description Option shown for rectangular display cutouts.
140
+ */
141
+ rectangleDisplayCutout: 'Rectangle',
142
+ /**
143
+ * @description Placeholder text for a custom device display cutout x coordinate field.
144
+ */
145
+ cutoutX: 'Cutout x',
146
+ /**
147
+ * @description Placeholder text for a custom device display cutout y coordinate field.
148
+ */
149
+ cutoutY: 'Cutout y',
150
+ /**
151
+ * @description Placeholder text for a custom device display cutout width field.
152
+ */
153
+ cutoutWidth: 'Cutout width',
154
+ /**
155
+ * @description Placeholder text for a custom device display cutout height field.
156
+ */
157
+ cutoutHeight: 'Cutout height',
158
+ /**
159
+ * @description Placeholder text for a custom device pill-shaped display cutout radius field.
160
+ */
161
+ cutoutBorderRadius: 'Pill radius',
162
+ /**
163
+ * @description Placeholder text for a custom device notch upper radius field.
164
+ */
165
+ cutoutUpperRadius: 'Upper radius',
166
+ /**
167
+ * @description Placeholder text for a custom device notch lower radius field.
168
+ */
169
+ cutoutLowerRadius: 'Lower radius',
170
+ /**
171
+ * @description Placeholder text for a custom device circular display cutout center x coordinate field.
172
+ */
173
+ cutoutCenterX: 'Center x',
174
+ /**
175
+ * @description Placeholder text for a custom device circular display cutout center y coordinate field.
176
+ */
177
+ cutoutCenterY: 'Center y',
178
+ /**
179
+ * @description Placeholder text for a custom device circular display cutout radius field.
180
+ */
181
+ cutoutRadius: 'Radius',
182
+ /**
183
+ * @description Error message shown when a custom display cutout field is required.
184
+ * @example {Cutout width} PH1
185
+ */
186
+ cutoutFieldRequired: '{PH1} is required when display cutout is enabled.',
187
+ /**
188
+ * @description Error message shown when a custom display cutout field is outside its supported integer range.
189
+ * @example {Cutout x} PH1
190
+ * @example {9999} PH2
191
+ */
192
+ cutoutValueMustBeInRange: '{PH1} must be an integer from 0 to {PH2}.',
193
+ /**
194
+ * @description Error message shown when a custom display cutout field must be positive.
195
+ * @example {Cutout width} PH1
196
+ */
197
+ cutoutValueMustBePositiveInteger: '{PH1} must be a positive integer.',
198
+ /**
199
+ * @description Error message shown when a custom display cutout's x coordinate plus its width exceeds the device width.
200
+ */
201
+ cutoutXAndWidthExceedDeviceWidth: 'Cutout x plus width must not exceed the device width.',
202
+ /**
203
+ * @description Error message shown when a custom display cutout's y coordinate plus its height exceeds the device height.
204
+ */
205
+ cutoutYAndHeightExceedDeviceHeight: 'Cutout y plus height must not exceed the device height.',
206
+ /**
207
+ * @description Error message shown when a circular display cutout is outside its cutout bounds.
208
+ */
209
+ circleMustFitCutoutBounds: 'Circle must fit within the cutout bounds.',
108
210
  } as const;
109
211
  const str_ = i18n.i18n.registerUIStrings('panels/settings/emulation/DevicesSettingsTab.ts', UIStrings);
110
212
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -125,6 +227,25 @@ function parseOptionalNonNegativeInteger(value: string): number|null {
125
227
  return parsedValue;
126
228
  }
127
229
 
230
+ const NO_CUSTOM_CUTOUT = 'none';
231
+
232
+ type DeviceEditorValidator = (item: EmulationModel.EmulatedDevices.EmulatedDevice, index: number,
233
+ input: UI.ListWidget.EditorControl) => UI.ListWidget.ValidatorResult;
234
+
235
+ interface CutoutFieldValidators {
236
+ shape: DeviceEditorValidator;
237
+ x: DeviceEditorValidator;
238
+ y: DeviceEditorValidator;
239
+ width: DeviceEditorValidator;
240
+ height: DeviceEditorValidator;
241
+ pillRadius: DeviceEditorValidator;
242
+ notchUpperRadius: DeviceEditorValidator;
243
+ notchLowerRadius: DeviceEditorValidator;
244
+ circleCenterX: DeviceEditorValidator;
245
+ circleCenterY: DeviceEditorValidator;
246
+ circleRadius: DeviceEditorValidator;
247
+ }
248
+
128
249
  export class DevicesSettingsTab extends UI.Widget.VBox implements
129
250
  UI.ListWidget.Delegate<EmulationModel.EmulatedDevices.EmulatedDevice> {
130
251
  containerElement: HTMLElement;
@@ -323,6 +444,10 @@ export class DevicesSettingsTab extends UI.Widget.VBox implements
323
444
  if (safeAreaInsets) {
324
445
  verticalMode.safeAreaInsets = safeAreaInsets;
325
446
  }
447
+ const cutout = this.cutoutFromEditor(editor);
448
+ if (cutout) {
449
+ verticalMode.cutout = cutout;
450
+ }
326
451
  device.modes.push(verticalMode);
327
452
  const horizontalMode: EmulationModel.EmulatedDevices.Mode = {
328
453
  title: '',
@@ -379,6 +504,7 @@ export class DevicesSettingsTab extends UI.Widget.VBox implements
379
504
  editor.control('scale').value = this.toNumericInputValue(device.deviceScaleFactor);
380
505
  editor.control('user-agent').value = device.userAgent;
381
506
  this.populateSafeAreaEditor(editor, device);
507
+ this.populateCutoutEditor(editor, device);
382
508
  let uaType;
383
509
  if (device.mobile()) {
384
510
  uaType =
@@ -406,6 +532,44 @@ export class DevicesSettingsTab extends UI.Widget.VBox implements
406
532
  return new EmulationModel.DeviceModeModel.Insets(left, top, right, bottom);
407
533
  }
408
534
 
535
+ private cutoutFromEditor(editor: UI.ListWidget.Editor<EmulationModel.EmulatedDevices.EmulatedDevice>):
536
+ EmulationModel.EmulatedDevices.Cutout|null {
537
+ const shape = editor.control('cutout-shape').value;
538
+ const baseCutout = {
539
+ x: this.editorIntegerValue(editor, 'cutout-x'),
540
+ y: this.editorIntegerValue(editor, 'cutout-y'),
541
+ width: this.editorIntegerValue(editor, 'cutout-width'),
542
+ height: this.editorIntegerValue(editor, 'cutout-height'),
543
+ };
544
+ switch (shape) {
545
+ case EmulationModel.EmulatedDevices.CutoutShape.PILL:
546
+ return {
547
+ shape,
548
+ ...baseCutout,
549
+ borderRadius: this.editorIntegerValue(editor, 'cutout-border-radius'),
550
+ };
551
+ case EmulationModel.EmulatedDevices.CutoutShape.NOTCH:
552
+ return {
553
+ shape,
554
+ ...baseCutout,
555
+ upperRadius: this.editorIntegerValue(editor, 'cutout-upper-radius'),
556
+ lowerRadius: this.editorIntegerValue(editor, 'cutout-lower-radius'),
557
+ };
558
+ case EmulationModel.EmulatedDevices.CutoutShape.CIRCLE:
559
+ return {
560
+ shape,
561
+ ...baseCutout,
562
+ cx: this.editorIntegerValue(editor, 'cutout-cx'),
563
+ cy: this.editorIntegerValue(editor, 'cutout-cy'),
564
+ radius: this.editorIntegerValue(editor, 'cutout-radius'),
565
+ };
566
+ case EmulationModel.EmulatedDevices.CutoutShape.RECTANGLE:
567
+ return {shape, ...baseCutout};
568
+ default:
569
+ return null;
570
+ }
571
+ }
572
+
409
573
  private populateSafeAreaEditor(editor: UI.ListWidget.Editor<EmulationModel.EmulatedDevices.EmulatedDevice>,
410
574
  device: EmulationModel.EmulatedDevices.EmulatedDevice): void {
411
575
  const safeAreaInsets = this.verticalMode(device)?.safeAreaInsets;
@@ -421,6 +585,53 @@ export class DevicesSettingsTab extends UI.Widget.VBox implements
421
585
  editor.control('landscape-safe-area-bottom').value = this.toNumericInputValue(landscapeSafeAreaInsets?.bottom || 0);
422
586
  }
423
587
 
588
+ private populateCutoutEditor(editor: UI.ListWidget.Editor<EmulationModel.EmulatedDevices.EmulatedDevice>,
589
+ device: EmulationModel.EmulatedDevices.EmulatedDevice): void {
590
+ const cutout = this.verticalMode(device)?.cutout;
591
+ editor.control('cutout-shape').value = cutout?.shape || NO_CUSTOM_CUTOUT;
592
+ editor.control('cutout-x').value = String(cutout?.x ?? '');
593
+ editor.control('cutout-y').value = String(cutout?.y ?? '');
594
+ editor.control('cutout-width').value = String(cutout?.width ?? '');
595
+ editor.control('cutout-height').value = String(cutout?.height ?? '');
596
+ editor.control('cutout-border-radius').value =
597
+ String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.PILL ? cutout.borderRadius : '');
598
+ editor.control('cutout-upper-radius').value =
599
+ String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.NOTCH ? cutout.upperRadius : '');
600
+ editor.control('cutout-lower-radius').value =
601
+ String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.NOTCH ? cutout.lowerRadius : '');
602
+ editor.control('cutout-cx').value =
603
+ String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.CIRCLE ? cutout.cx : '');
604
+ editor.control('cutout-cy').value =
605
+ String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.CIRCLE ? cutout.cy : '');
606
+ editor.control('cutout-radius').value =
607
+ String(cutout?.shape === EmulationModel.EmulatedDevices.CutoutShape.CIRCLE ? cutout.radius : '');
608
+ this.updateCutoutFieldsVisibility(editor);
609
+ }
610
+
611
+ private updateCutoutFieldsVisibility(editor: UI.ListWidget.Editor<EmulationModel.EmulatedDevices.EmulatedDevice>):
612
+ void {
613
+ const shape = editor.control('cutout-shape').value;
614
+ const noCutout = shape === NO_CUSTOM_CUTOUT;
615
+ const isPill = shape === EmulationModel.EmulatedDevices.CutoutShape.PILL;
616
+ const isNotch = shape === EmulationModel.EmulatedDevices.CutoutShape.NOTCH;
617
+ const isCircle = shape === EmulationModel.EmulatedDevices.CutoutShape.CIRCLE;
618
+ const content = editor.contentElement();
619
+ const rectRow = content.querySelector<HTMLElement>('.devices-edit-cutout-rect-row');
620
+ const radiusRow = content.querySelector<HTMLElement>('.devices-edit-cutout-radius-row');
621
+ if (rectRow) {
622
+ rectRow.hidden = noCutout;
623
+ }
624
+ if (radiusRow) {
625
+ radiusRow.hidden = noCutout || !(isPill || isNotch || isCircle);
626
+ }
627
+ (editor.control('cutout-border-radius') as HTMLElement).hidden = !isPill;
628
+ (editor.control('cutout-upper-radius') as HTMLElement).hidden = !isNotch;
629
+ (editor.control('cutout-lower-radius') as HTMLElement).hidden = !isNotch;
630
+ (editor.control('cutout-cx') as HTMLElement).hidden = !isCircle;
631
+ (editor.control('cutout-cy') as HTMLElement).hidden = !isCircle;
632
+ (editor.control('cutout-radius') as HTMLElement).hidden = !isCircle;
633
+ }
634
+
424
635
  private createEditor(): UI.ListWidget.Editor<EmulationModel.EmulatedDevices.EmulatedDevice> {
425
636
  if (this.editor) {
426
637
  return this.editor;
@@ -446,6 +657,19 @@ export class DevicesSettingsTab extends UI.Widget.VBox implements
446
657
  portraitSafeAreaValidator);
447
658
  this.appendSafeAreaFields(editor, deviceFields, i18nString(UIStrings.landscapeSafeArea), 'landscape-',
448
659
  landscapeSafeAreaValidator);
660
+ this.appendCutoutFields(editor, content, {
661
+ shape: cutoutShapeValidator,
662
+ x: cutoutXValidator,
663
+ y: cutoutYValidator,
664
+ width: cutoutWidthValidator,
665
+ height: cutoutHeightValidator,
666
+ pillRadius: cutoutPillRadiusValidator,
667
+ notchUpperRadius: cutoutNotchUpperRadiusValidator,
668
+ notchLowerRadius: cutoutNotchLowerRadiusValidator,
669
+ circleCenterX: cutoutCircleCenterXValidator,
670
+ circleCenterY: cutoutCircleCenterYValidator,
671
+ circleRadius: cutoutCircleRadiusValidator,
672
+ });
449
673
 
450
674
  const uaStringFields = content.createChild('div', 'devices-edit-fields');
451
675
  UI.UIUtils.createTextChild(uaStringFields.createChild('b'), i18nString(UIStrings.userAgentString));
@@ -524,30 +748,206 @@ export class DevicesSettingsTab extends UI.Widget.VBox implements
524
748
  return EmulationModel.DeviceModeModel.DeviceModeModel.scaleValidator(input.value);
525
749
  }
526
750
 
527
- function safeAreaValidator(orientationLabel: string,
751
+ function nonNegativeIntegerValue(controlName: string): number|null {
752
+ return parseOptionalNonNegativeInteger(editor.control(controlName).value);
753
+ }
754
+
755
+ function positiveIntegerValue(controlName: string): number|null {
756
+ const value = nonNegativeIntegerValue(controlName);
757
+ return value && value > 0 ? value : null;
758
+ }
759
+
760
+ function requiredIntegerValue(controlName: string): number|null {
761
+ const value = editor.control(controlName).value.trim();
762
+ return value ? parseOptionalNonNegativeInteger(value) : null;
763
+ }
764
+
765
+ function controlLabel(input: UI.ListWidget.EditorControl): string {
766
+ return input.getAttribute('aria-label') || input.getAttribute('placeholder') || '';
767
+ }
768
+
769
+ function safeAreaValidator(controlPrefix: string, orientationLabel: string, widthControlName: string,
770
+ heightControlName: string,
528
771
  input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
529
- if (parseOptionalNonNegativeInteger(input.value) !== null) {
530
- return {valid: true};
772
+ const ownValue = parseOptionalNonNegativeInteger(input.value);
773
+ if (ownValue === null) {
774
+ return {
775
+ valid: false,
776
+ errorMessage: i18nString(UIStrings.safeAreaValueMustBeInRange, {
777
+ PH1: orientationLabel,
778
+ PH2: input.getAttribute('aria-label') || input.getAttribute('placeholder') || '',
779
+ PH3: EmulationModel.DeviceModeModel.MaxDeviceSize,
780
+ }),
781
+ };
531
782
  }
532
783
 
533
- return {
534
- valid: false,
535
- errorMessage: i18nString(UIStrings.safeAreaValueMustBeInRange, {
536
- PH1: orientationLabel,
537
- PH2: input.getAttribute('aria-label') || input.getAttribute('placeholder') || '',
538
- PH3: EmulationModel.DeviceModeModel.MaxDeviceSize,
539
- }),
540
- };
784
+ const left = nonNegativeIntegerValue(`${controlPrefix}safe-area-left`);
785
+ const top = nonNegativeIntegerValue(`${controlPrefix}safe-area-top`);
786
+ const right = nonNegativeIntegerValue(`${controlPrefix}safe-area-right`);
787
+ const bottom = nonNegativeIntegerValue(`${controlPrefix}safe-area-bottom`);
788
+ const width = positiveIntegerValue(widthControlName);
789
+ const height = positiveIntegerValue(heightControlName);
790
+ if (input === editor.control(`${controlPrefix}safe-area-right`) && left !== null && right !== null &&
791
+ width !== null && left + right > width) {
792
+ return {
793
+ valid: false,
794
+ errorMessage: i18nString(UIStrings.safeAreaHorizontalInsetsExceedWidth, {PH1: orientationLabel}),
795
+ };
796
+ }
797
+ if (input === editor.control(`${controlPrefix}safe-area-bottom`) && top !== null && bottom !== null &&
798
+ height !== null && top + bottom > height) {
799
+ return {
800
+ valid: false,
801
+ errorMessage: i18nString(UIStrings.safeAreaVerticalInsetsExceedHeight, {PH1: orientationLabel}),
802
+ };
803
+ }
804
+ return {valid: true};
541
805
  }
542
806
 
543
807
  function portraitSafeAreaValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
544
808
  input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
545
- return safeAreaValidator(i18nString(UIStrings.portraitSafeArea), input);
809
+ return safeAreaValidator('', i18nString(UIStrings.portraitSafeArea), 'width', 'height', input);
546
810
  }
547
811
 
548
812
  function landscapeSafeAreaValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
549
813
  input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
550
- return safeAreaValidator(i18nString(UIStrings.landscapeSafeArea), input);
814
+ return safeAreaValidator('landscape-', i18nString(UIStrings.landscapeSafeArea), 'height', 'width', input);
815
+ }
816
+
817
+ function cutoutShapeValidator(): UI.ListWidget.ValidatorResult {
818
+ return {valid: true};
819
+ }
820
+
821
+ function cutoutValueValidator(input: UI.ListWidget.EditorControl,
822
+ mustBePositive = false): UI.ListWidget.ValidatorResult {
823
+ const label = controlLabel(input);
824
+ const value = input.value.trim();
825
+ if (!value) {
826
+ return {valid: false, errorMessage: i18nString(UIStrings.cutoutFieldRequired, {PH1: label})};
827
+ }
828
+ const numericValue = parseOptionalNonNegativeInteger(value);
829
+ if (numericValue === null) {
830
+ return {
831
+ valid: false,
832
+ errorMessage: i18nString(UIStrings.cutoutValueMustBeInRange, {
833
+ PH1: label,
834
+ PH2: EmulationModel.DeviceModeModel.MaxDeviceSize,
835
+ }),
836
+ };
837
+ }
838
+ if (mustBePositive && numericValue === 0) {
839
+ return {valid: false, errorMessage: i18nString(UIStrings.cutoutValueMustBePositiveInteger, {PH1: label})};
840
+ }
841
+ return {valid: true};
842
+ }
843
+
844
+ function isCutoutFieldActive(shape?: EmulationModel.EmulatedDevices.CutoutShape): boolean {
845
+ const selectedShape = editor.control('cutout-shape').value;
846
+ return selectedShape !== NO_CUSTOM_CUTOUT && (shape === undefined || selectedShape === shape);
847
+ }
848
+
849
+ function cutoutXValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
850
+ input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
851
+ return isCutoutFieldActive() ? cutoutValueValidator(input) : {valid: true};
852
+ }
853
+
854
+ function cutoutYValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
855
+ input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
856
+ return isCutoutFieldActive() ? cutoutValueValidator(input) : {valid: true};
857
+ }
858
+
859
+ function cutoutWidthValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
860
+ input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
861
+ if (!isCutoutFieldActive()) {
862
+ return {valid: true};
863
+ }
864
+ const validation = cutoutValueValidator(input, true);
865
+ if (!validation.valid) {
866
+ return validation;
867
+ }
868
+
869
+ const cutoutX = requiredIntegerValue('cutout-x');
870
+ const cutoutWidth = positiveIntegerValue('cutout-width');
871
+ const width = positiveIntegerValue('width');
872
+ if (width !== null && cutoutX !== null && cutoutWidth !== null && cutoutX + cutoutWidth > width) {
873
+ return {valid: false, errorMessage: i18nString(UIStrings.cutoutXAndWidthExceedDeviceWidth)};
874
+ }
875
+ return {valid: true};
876
+ }
877
+
878
+ function cutoutHeightValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
879
+ input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
880
+ if (!isCutoutFieldActive()) {
881
+ return {valid: true};
882
+ }
883
+ const validation = cutoutValueValidator(input, true);
884
+ if (!validation.valid) {
885
+ return validation;
886
+ }
887
+
888
+ const cutoutY = requiredIntegerValue('cutout-y');
889
+ const cutoutHeight = positiveIntegerValue('cutout-height');
890
+ const height = positiveIntegerValue('height');
891
+ if (height !== null && cutoutY !== null && cutoutHeight !== null && cutoutY + cutoutHeight > height) {
892
+ return {valid: false, errorMessage: i18nString(UIStrings.cutoutYAndHeightExceedDeviceHeight)};
893
+ }
894
+ return {valid: true};
895
+ }
896
+
897
+ function cutoutPillRadiusValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
898
+ input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
899
+ return isCutoutFieldActive(EmulationModel.EmulatedDevices.CutoutShape.PILL) ? cutoutValueValidator(input) :
900
+ {valid: true};
901
+ }
902
+
903
+ function cutoutNotchUpperRadiusValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
904
+ input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
905
+ return isCutoutFieldActive(EmulationModel.EmulatedDevices.CutoutShape.NOTCH) ? cutoutValueValidator(input) :
906
+ {valid: true};
907
+ }
908
+
909
+ function cutoutNotchLowerRadiusValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
910
+ input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
911
+ return isCutoutFieldActive(EmulationModel.EmulatedDevices.CutoutShape.NOTCH) ? cutoutValueValidator(input) :
912
+ {valid: true};
913
+ }
914
+
915
+ function cutoutCircleCenterXValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
916
+ input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
917
+ return isCutoutFieldActive(EmulationModel.EmulatedDevices.CutoutShape.CIRCLE) ? cutoutValueValidator(input) :
918
+ {valid: true};
919
+ }
920
+
921
+ function cutoutCircleCenterYValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
922
+ input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
923
+ return isCutoutFieldActive(EmulationModel.EmulatedDevices.CutoutShape.CIRCLE) ? cutoutValueValidator(input) :
924
+ {valid: true};
925
+ }
926
+
927
+ function cutoutCircleRadiusValidator(_item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
928
+ input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
929
+ if (!isCutoutFieldActive(EmulationModel.EmulatedDevices.CutoutShape.CIRCLE)) {
930
+ return {valid: true};
931
+ }
932
+ const validation = cutoutValueValidator(input, true);
933
+ if (!validation.valid) {
934
+ return validation;
935
+ }
936
+
937
+ const cutoutX = requiredIntegerValue('cutout-x');
938
+ const cutoutY = requiredIntegerValue('cutout-y');
939
+ const cutoutWidth = positiveIntegerValue('cutout-width');
940
+ const cutoutHeight = positiveIntegerValue('cutout-height');
941
+ const centerX = requiredIntegerValue('cutout-cx');
942
+ const centerY = requiredIntegerValue('cutout-cy');
943
+ const radius = positiveIntegerValue('cutout-radius');
944
+ if (cutoutX !== null && cutoutY !== null && cutoutWidth !== null && cutoutHeight !== null && centerX !== null &&
945
+ centerY !== null && radius !== null &&
946
+ (centerX - radius < cutoutX || centerX + radius > cutoutX + cutoutWidth || centerY - radius < cutoutY ||
947
+ centerY + radius > cutoutY + cutoutHeight)) {
948
+ return {valid: false, errorMessage: i18nString(UIStrings.circleMustFitCutoutBounds)};
949
+ }
950
+ return {valid: true};
551
951
  }
552
952
  }
553
953
 
@@ -572,4 +972,54 @@ export class DevicesSettingsTab extends UI.Widget.VBox implements
572
972
  safeAreaRow.appendChild(editor.createInput(`${controlPrefix}safe-area-bottom`, 'text',
573
973
  i18nString(UIStrings.safeAreaBottom), safeAreaValidator));
574
974
  }
975
+
976
+ private appendCutoutFields(editor: UI.ListWidget.Editor<EmulationModel.EmulatedDevices.EmulatedDevice>,
977
+ content: Element, validators: CutoutFieldValidators): void {
978
+ const cutoutFields = content.createChild('div', 'devices-edit-fields');
979
+ cutoutFields.classList.add('devices-edit-cutout-fields');
980
+ UI.ARIAUtils.markAsGroup(cutoutFields);
981
+ const heading = cutoutFields.createChild('b');
982
+ heading.id = UI.ARIAUtils.nextId('cutout-heading-');
983
+ UI.UIUtils.createTextChild(heading, i18nString(UIStrings.displayCutout));
984
+ cutoutFields.setAttribute('aria-labelledby', heading.id);
985
+ const shapeOptions = [
986
+ NO_CUSTOM_CUTOUT,
987
+ EmulationModel.EmulatedDevices.CutoutShape.PILL,
988
+ EmulationModel.EmulatedDevices.CutoutShape.NOTCH,
989
+ EmulationModel.EmulatedDevices.CutoutShape.CIRCLE,
990
+ EmulationModel.EmulatedDevices.CutoutShape.RECTANGLE,
991
+ ];
992
+ const shapeControl =
993
+ editor.createSelect('cutout-shape', shapeOptions, validators.shape, i18nString(UIStrings.displayCutout));
994
+ shapeControl.options[0].textContent = i18nString(UIStrings.noDisplayCutout);
995
+ shapeControl.options[1].textContent = i18nString(UIStrings.pillDisplayCutout);
996
+ shapeControl.options[2].textContent = i18nString(UIStrings.notchDisplayCutout);
997
+ shapeControl.options[3].textContent = i18nString(UIStrings.circleDisplayCutout);
998
+ shapeControl.options[4].textContent = i18nString(UIStrings.rectangleDisplayCutout);
999
+ cutoutFields.createChild('div', 'hbox').appendChild(shapeControl);
1000
+ shapeControl.addEventListener('input', () => this.updateCutoutFieldsVisibility(editor), false);
1001
+
1002
+ const rectRow = cutoutFields.createChild('div', 'hbox devices-edit-cutout-rect-row');
1003
+ rectRow.appendChild(editor.createInput('cutout-x', 'text', i18nString(UIStrings.cutoutX), validators.x));
1004
+ rectRow.appendChild(editor.createInput('cutout-y', 'text', i18nString(UIStrings.cutoutY), validators.y));
1005
+ rectRow.appendChild(
1006
+ editor.createInput('cutout-width', 'text', i18nString(UIStrings.cutoutWidth), validators.width));
1007
+ rectRow.appendChild(
1008
+ editor.createInput('cutout-height', 'text', i18nString(UIStrings.cutoutHeight), validators.height));
1009
+
1010
+ const radiusRow = cutoutFields.createChild('div', 'hbox devices-edit-cutout-radius-row');
1011
+ radiusRow.appendChild(editor.createInput('cutout-border-radius', 'text', i18nString(UIStrings.cutoutBorderRadius),
1012
+ validators.pillRadius));
1013
+ radiusRow.appendChild(editor.createInput('cutout-upper-radius', 'text', i18nString(UIStrings.cutoutUpperRadius),
1014
+ validators.notchUpperRadius));
1015
+ radiusRow.appendChild(editor.createInput('cutout-lower-radius', 'text', i18nString(UIStrings.cutoutLowerRadius),
1016
+ validators.notchLowerRadius));
1017
+ radiusRow.appendChild(
1018
+ editor.createInput('cutout-cx', 'text', i18nString(UIStrings.cutoutCenterX), validators.circleCenterX));
1019
+ radiusRow.appendChild(
1020
+ editor.createInput('cutout-cy', 'text', i18nString(UIStrings.cutoutCenterY), validators.circleCenterY));
1021
+ radiusRow.appendChild(
1022
+ editor.createInput('cutout-radius', 'text', i18nString(UIStrings.cutoutRadius), validators.circleRadius));
1023
+ this.updateCutoutFieldsVisibility(editor);
1024
+ }
575
1025
  }
@@ -767,6 +767,8 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
767
767
  const config = Trace.Types.Configuration.defaults();
768
768
  config.showAllEvents = Common.Settings.Settings.instance().moduleSetting('timeline-show-all-events').get();
769
769
  config.debugMode = Common.Settings.Settings.instance().moduleSetting('timeline-debug-mode').get() as boolean;
770
+ config.enableSoftNavigation =
771
+ Common.Settings.Settings.instance().moduleSetting('timeline-enable-soft-navigations').get() as boolean;
770
772
 
771
773
  const traceEngineModel = Trace.TraceModel.Model.createWithAllHandlers(config);
772
774
 
@@ -14,6 +14,7 @@ import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
14
14
  import cwvMetricsStyles from './cwvMetrics.css.js';
15
15
  import {md} from './insights/Helpers.js';
16
16
  import * as Insights from './insights/insights.js';
17
+ import metricValueStyles from './metricValueStyles.css.js';
17
18
  import {isFieldWorseThanLocal, NumberWithUnit} from './Utils.js';
18
19
 
19
20
  const {html} = Lit.StaticHtml;
@@ -204,6 +205,16 @@ const CWV_METRICS_VIEW: MetricsView = (input, _output, target) => {
204
205
  const inpEl = renderMetricValue('INP', local?.inp?.value ?? null, local?.inp?.event ?? null);
205
206
  const clsEl = renderMetricValue('CLS', local?.cls?.value ?? null, local?.cls?.worstClusterEvent ?? null);
206
207
 
208
+ const navigation = parsedTrace?.insights?.get(insightSetKey ?? '')?.navigation;
209
+ const isSoftNav = navigation && Trace.Types.Events.isSoftNavigationStart(navigation);
210
+
211
+ const softNavBadgeTemplate = isSoftNav ? html`
212
+ <div class="metrics-row soft-nav-badge-row">
213
+ <span class="badge">SOFT NAV</span>
214
+ </div>
215
+ ` :
216
+ Lit.nothing;
217
+
207
218
  const localMetricsTemplateResult = html`
208
219
  <div class="metrics-row">
209
220
  <span>${lcpEl}</span>
@@ -211,6 +222,7 @@ const CWV_METRICS_VIEW: MetricsView = (input, _output, target) => {
211
222
  <span>${clsEl}</span>
212
223
  <span class="row-label">Local</span>
213
224
  </div>
225
+ ${!field ? softNavBadgeTemplate : Lit.nothing}
214
226
  ${!field && input.skipBottomBorder ? Lit.nothing : html`<span class="row-border"></span>`}
215
227
  `;
216
228
 
@@ -235,6 +247,7 @@ const CWV_METRICS_VIEW: MetricsView = (input, _output, target) => {
235
247
  <span>${clsEl}</span>
236
248
  <span class="row-label">${i18nString(UIStrings.fieldScoreLabel, {PH1: scope})}</span>
237
249
  </div>
250
+ ${softNavBadgeTemplate}
238
251
  ${input.skipBottomBorder ? Lit.nothing : html`<span class="row-border"></span>`}
239
252
  `;
240
253
  // clang-format on
@@ -271,13 +284,13 @@ const CWV_METRICS_VIEW: MetricsView = (input, _output, target) => {
271
284
  ${fieldMetricsTemplateResult}
272
285
  </div>`;
273
286
 
274
- Lit.render(
275
- html`
287
+ Lit.render(html`
276
288
  <style>${cwvMetricsStyles}</style>
289
+ <style>${metricValueStyles}</style>
277
290
  ${metricsTableEl}
278
291
  ${fieldIsDifferentEl}
279
292
  `,
280
- target);
293
+ target);
281
294
  };
282
295
 
283
296
  export interface CWVMetricsData {
@@ -105,3 +105,7 @@
105
105
  cursor: pointer;
106
106
  }
107
107
  }
108
+
109
+ .soft-nav-badge-row {
110
+ display: contents;
111
+ }
@@ -405,20 +405,3 @@ devtools-link {
405
405
  .section-header .section-title {
406
406
  margin-bottom: 0;
407
407
  }
408
-
409
- .section-header .badge {
410
- display: inline-flex;
411
- align-items: center;
412
- width: fit-content;
413
- height: var(--sys-size-8);
414
- line-height: var(--sys-size-8);
415
- border-radius: var(--sys-shape-corner-extra-small);
416
- padding: 0 var(--sys-size-3);
417
- border: var(--sys-size-1) solid var(--sys-color-primary);
418
- color: var(--sys-color-primary);
419
- font-weight: var(--ref-typeface-weight-bold);
420
- font-size: var(--sys-size-5);
421
- text-align: center;
422
- margin-top: var(--sys-size-5);
423
- margin-bottom: var(--sys-size-5);
424
- }
@@ -39,3 +39,20 @@
39
39
  .metric-value.poor.dim {
40
40
  color: var(--app-color-performance-bad-dim);
41
41
  }
42
+
43
+ .badge {
44
+ display: inline-flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ width: fit-content;
48
+ height: var(--sys-size-8);
49
+ border-radius: var(--sys-shape-corner-extra-small);
50
+ padding: 0 var(--sys-size-3);
51
+ border: var(--sys-size-1) solid var(--sys-color-primary);
52
+ color: var(--sys-color-primary);
53
+ font-weight: var(--ref-typeface-weight-bold);
54
+ font-size: var(--sys-size-5);
55
+ text-align: center;
56
+ margin-top: var(--sys-size-5);
57
+ margin-bottom: var(--sys-size-5);
58
+ }
@@ -1,7 +1,7 @@
1
1
  Name: Dependencies sourced from the upstream `chromium` repository
2
2
  URL: Internal
3
3
  Version: N/A
4
- Revision: fe1995d8b7274469cee69789f61558af8582b430
4
+ Revision: c29529e3eb350cb4dd3a0afc7dff0a37b31c7137
5
5
  Update Mechanism: Manual (https://crbug.com/428069060)
6
6
  License: BSD-3-Clause
7
7
  License File: LICENSE