Skip to content

Commit 9d7493e

Browse files
bmeurerDevtools-frontend LUCI CQ
authored andcommitted
Put the jslog passed to Widget onto its contentElement.
In case `useShadowDom` isn't set to `true`, the `contentElement` property of the `Widget` is set to `element` anyways, and then it doesn't matter. In the presence of a shadow DOM however, we do actually want to instrument the root element inside the shadow DOM (rather than the shadow host). Bug: 407750483, 301364727 Change-Id: I8a2cade7bd2e7cc4475a0f87480d3eb42ae63a32 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6822156 Commit-Queue: Benedikt Meurer <[email protected]> Reviewed-by: Danil Somsikov <[email protected]> Auto-Submit: Benedikt Meurer <[email protected]>
1 parent a68fd5f commit 9d7493e

File tree

16 files changed

+89
-33
lines changed

16 files changed

+89
-33
lines changed

front_end/panels/application/AppManifestView.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,13 @@ export class AppManifestView extends Common.ObjectWrapper.eventMixin<EventTypes,
486486
constructor(
487487
emptyView: UI.EmptyWidget.EmptyWidget, reportView: UI.ReportView.ReportView,
488488
throttler: Common.Throttler.Throttler) {
489-
super({useShadowDom: true});
489+
super({
490+
jslog: `${VisualLogging.pane('manifest')}`,
491+
useShadowDom: true,
492+
});
490493
this.registerRequiredCSS(appManifestViewStyles);
491494

492495
this.contentElement.classList.add('manifest-container');
493-
this.contentElement.setAttribute('jslog', `${VisualLogging.pane('manifest')}`);
494496

495497
this.emptyView = emptyView;
496498
this.emptyView.link = 'https://web.dev/add-manifest/' as Platform.DevToolsPath.UrlString;

front_end/panels/application/ServiceWorkersView.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,16 @@ export class ServiceWorkersView extends UI.Widget.VBox implements
197197
Map<SDK.ServiceWorkerManager.ServiceWorkerManager, Common.EventTarget.EventDescriptor[]>;
198198

199199
constructor() {
200-
super({useShadowDom: true});
200+
super({
201+
jslog: `${VisualLogging.pane('service-workers')}`,
202+
useShadowDom: true,
203+
});
201204
this.registerRequiredCSS(serviceWorkersViewStyles);
202205

203206
// TODO(crbug.com/1156978): Replace UI.ReportView.ReportView with ReportView.ts web component.
204207
this.currentWorkersView = new UI.ReportView.ReportView(i18n.i18n.lockedString('Service workers'));
205208
this.currentWorkersView.setBodyScrollable(false);
206209
this.contentElement.classList.add('service-worker-list');
207-
this.contentElement.setAttribute('jslog', `${VisualLogging.pane('service-workers')}`);
208210
this.currentWorkersView.show(this.contentElement);
209211
this.currentWorkersView.element.classList.add('service-workers-this-origin');
210212
this.currentWorkersView.element.setAttribute('jslog', `${VisualLogging.section('this-origin')}`);

front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,14 @@ export class XHRBreakpointsSidebarPane extends UI.Widget.VBox implements UI.Cont
8080
#hitBreakpoint?: any;
8181

8282
private constructor() {
83-
super({useShadowDom: true});
83+
super({
84+
jslog: `${VisualLogging.section('source.xhr-breakpoints')}`,
85+
useShadowDom: true,
86+
});
8487
this.registerRequiredCSS(xhrBreakpointsSidebarPaneStyles);
8588

8689
this.#breakpoints = new UI.ListModel.ListModel();
8790
this.#list = new UI.ListControl.ListControl(this.#breakpoints, this, UI.ListControl.ListMode.NonViewport);
88-
this.contentElement.setAttribute('jslog', `${VisualLogging.section('source.xhr-breakpoints')}`);
8991
this.contentElement.appendChild(this.#list.element);
9092
this.#list.element.classList.add('breakpoint-list', 'hidden');
9193
UI.ARIAUtils.markAsList(this.#list.element);

front_end/panels/console/ConsoleSidebar.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,17 @@ export class ConsoleSidebar extends Common.ObjectWrapper.eventMixin<EventTypes,
5959
private readonly treeElements: FilterTreeElement[];
6060

6161
constructor() {
62-
super({useShadowDom: true});
62+
super({
63+
jslog: `${VisualLogging.pane('sidebar').track({resize: true})}`,
64+
useShadowDom: true,
65+
});
6366
this.setMinimumSize(125, 0);
6467

6568
this.tree = new UI.TreeOutline.TreeOutlineInShadow(UI.TreeOutline.TreeVariant.NAVIGATION_TREE);
6669
this.tree.addEventListener(UI.TreeOutline.Events.ElementSelected, this.selectionChanged.bind(this));
6770
this.tree.registerRequiredCSS(consoleSidebarStyles);
6871
this.tree.hideOverflow();
6972

70-
this.contentElement.setAttribute('jslog', `${VisualLogging.pane('sidebar').track({resize: true})}`);
7173
this.contentElement.appendChild(this.tree.element);
7274
this.selectedTreeElement = null;
7375
this.treeElements = [];

front_end/panels/elements/ClassesPaneWidget.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@ export class ClassesPaneWidget extends UI.Widget.Widget {
4747
private previousTarget: SDK.DOMModel.DOMNode|null;
4848

4949
constructor() {
50-
super({useShadowDom: true});
50+
super({
51+
jslog: `${VisualLogging.pane('elements-classes')}`,
52+
useShadowDom: true,
53+
});
5154
this.registerRequiredCSS(classesPaneWidgetStyles);
5255
this.contentElement.className = 'styles-element-classes-pane';
53-
this.contentElement.setAttribute('jslog', `${VisualLogging.pane('elements-classes')}`);
5456
const container = this.contentElement.createChild('div', 'title-container');
5557
this.input = container.createChild('div', 'new-class-input monospace');
5658
this.setDefaultFocusedElement(this.input);

front_end/panels/elements/LayersWidget.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ export class LayersWidget extends UI.Widget.Widget {
3535
private layerTreeComponent = new TreeOutline.TreeOutline.TreeOutline<string>();
3636

3737
constructor() {
38-
super({useShadowDom: true});
38+
super({
39+
jslog: `${VisualLogging.pane('css-layers')}`,
40+
useShadowDom: true,
41+
});
3942
this.registerRequiredCSS(layersWidgetStyles);
4043

4144
this.contentElement.className = 'styles-layers-pane';
42-
this.contentElement.setAttribute('jslog', `${VisualLogging.pane('css-layers')}`);
4345
UI.UIUtils.createTextChild(this.contentElement.createChild('div'), i18nString(UIStrings.cssLayersTitle));
4446

4547
this.contentElement.appendChild(this.layerTreeComponent);

front_end/panels/emulation/MediaQueryInspector.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ export class MediaQueryInspector extends UI.Widget.Widget implements
3737
constructor(
3838
getWidthCallback: () => number, setWidthCallback: (arg0: number) => void,
3939
mediaThrottler: Common.Throttler.Throttler) {
40-
super({useShadowDom: true});
40+
super({
41+
jslog: `${VisualLogging.mediaInspectorView().track({click: true})}`,
42+
useShadowDom: true,
43+
});
4144
this.registerRequiredCSS(mediaQueryInspectorStyles);
4245
this.contentElement.classList.add('media-inspector-view');
43-
this.contentElement.setAttribute('jslog', `${VisualLogging.mediaInspectorView().track({click: true})}`);
4446
this.contentElement.addEventListener('click', this.onMediaQueryClicked.bind(this), false);
4547
this.contentElement.addEventListener('contextmenu', this.onContextMenu.bind(this), false);
4648
this.mediaThrottler = mediaThrottler;

front_end/panels/search/SearchView.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ export class SearchView extends UI.Widget.VBox {
156156
#emptyStartView: UI.EmptyWidget.EmptyWidget;
157157

158158
constructor(settingKey: string, throttler: Common.Throttler.Throttler) {
159-
super({useShadowDom: true});
159+
super({
160+
jslog: `${VisualLogging.panel('search').track({resize: true})}`,
161+
useShadowDom: true,
162+
});
160163
this.setMinimumSize(0, 40);
161164
this.registerRequiredCSS(searchViewStyles);
162165

@@ -175,8 +178,6 @@ export class SearchView extends UI.Widget.VBox {
175178
this.visiblePane = null;
176179
this.#throttler = throttler;
177180

178-
this.contentElement.setAttribute('jslog', `${VisualLogging.panel('search').track({resize: true})}`);
179-
180181
this.contentElement.classList.add('search-view');
181182
this.contentElement.addEventListener('keydown', event => {
182183
this.onKeyDownOnPanel((event));

front_end/panels/sources/CallStackSidebarPane.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ export class CallStackSidebarPane extends UI.View.SimpleView implements UI.Conte
110110

111111
private constructor() {
112112
super({
113+
jslog: `${VisualLogging.section('sources.callstack')}`,
113114
title: i18nString(UIStrings.callStack),
114115
viewId: 'sources.callstack',
115116
useShadowDom: true,
116117
});
117118
this.registerRequiredCSS(callStackSidebarPaneStyles);
118119

119-
this.contentElement.setAttribute('jslog', `${VisualLogging.section('sources.callstack')}`);
120120
({element: this.ignoreListMessageElement, checkbox: this.ignoreListCheckboxElement} =
121121
this.createIgnoreListMessageElementAndCheckbox());
122122
this.contentElement.appendChild(this.ignoreListMessageElement);

front_end/panels/sources/NavigatorView.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,10 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
212212
private groupByDomain?: boolean;
213213
private groupByFolder?: boolean;
214214
constructor(jslogContext: string, enableAuthoredGrouping?: boolean) {
215-
super({useShadowDom: true});
215+
super({
216+
jslog: `${VisualLogging.pane(jslogContext).track({resize: true})}`,
217+
useShadowDom: true,
218+
});
216219
this.registerRequiredCSS(navigatorViewStyles);
217220

218221
this.placeholder = null;
@@ -222,7 +225,6 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
222225
this.scriptsTree.hideOverflow();
223226
this.scriptsTree.setComparator(NavigatorView.treeElementsCompare);
224227
this.scriptsTree.setFocusable(false);
225-
this.contentElement.setAttribute('jslog', `${VisualLogging.pane(jslogContext).track({resize: true})}`);
226228
this.contentElement.appendChild(this.scriptsTree.element);
227229
this.setDefaultFocusedElement(this.scriptsTree.element);
228230

0 commit comments

Comments
 (0)