Skip to content

Commit 0908f5b

Browse files
bmeurerDevtools-frontend LUCI CQ
authored andcommitted
[sources] Fix resize handler for vertical debugger sidebar.
The resizer logic has to act directly on the `<devtools-toolbar>`, otherwise the pointer events aren't caught, and the only interesting toolbar element within the toolbar container is the script view toolbar, since the other toolbar only contains a single button. Fixed: 408383933 Change-Id: Ic34b01d115e8168ea0ac07382f68b1271bf9759c Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6441161 Commit-Queue: Benedikt Meurer <[email protected]> Reviewed-by: Simon Zünd <[email protected]> Commit-Queue: Simon Zünd <[email protected]> Auto-Submit: Benedikt Meurer <[email protected]>
1 parent 31675fa commit 0908f5b

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

front_end/panels/sources/SourcesPanel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,9 @@ export class SourcesPanel extends UI.Panel.Panel implements
341341
const isInWrapper = UI.Context.Context.instance().flavor(QuickSourceView) &&
342342
!UI.InspectorView.InspectorView.instance().isDrawerMinimized();
343343
if (panel.splitWidget.isVertical() || isInWrapper) {
344-
panel.splitWidget.uninstallResizer(panel.sourcesViewInternal.toolbarContainerElement());
344+
panel.splitWidget.uninstallResizer(panel.sourcesViewInternal.scriptViewToolbar());
345345
} else {
346-
panel.splitWidget.installResizer(panel.sourcesViewInternal.toolbarContainerElement());
346+
panel.splitWidget.installResizer(panel.sourcesViewInternal.scriptViewToolbar());
347347
}
348348
if (!isInWrapper) {
349349
panel.sourcesViewInternal.leftToolbar().appendToolbarItem(panel.toggleNavigatorSidebarButton);

front_end/panels/sources/SourcesView.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ export class SourcesView extends Common.ObjectWrapper.eventMixin<EventTypes, typ
6363
private readonly sourceViewByUISourceCode: Map<Workspace.UISourceCode.UISourceCode, UI.Widget.Widget>;
6464
editorContainer: TabbedEditorContainer;
6565
private readonly historyManager: EditingLocationHistoryManager;
66-
private readonly toolbarContainerElementInternal: HTMLElement;
67-
private readonly scriptViewToolbar: UI.Toolbar.Toolbar;
66+
readonly #scriptViewToolbar: UI.Toolbar.Toolbar;
6867
private readonly bottomToolbarInternal: UI.Toolbar.Toolbar;
6968
private toolbarChangedListener: Common.EventTarget.EventDescriptor|null;
7069
private readonly focusedPlaceholderElement?: HTMLElement;
@@ -98,11 +97,11 @@ export class SourcesView extends Common.ObjectWrapper.eventMixin<EventTypes, typ
9897

9998
this.historyManager = new EditingLocationHistoryManager(this);
10099

101-
this.toolbarContainerElementInternal = this.element.createChild('div', 'sources-toolbar');
102-
this.toolbarContainerElementInternal.setAttribute('jslog', `${VisualLogging.toolbar('bottom')}`);
103-
this.scriptViewToolbar = this.toolbarContainerElementInternal.createChild('devtools-toolbar');
104-
this.scriptViewToolbar.style.flex = 'auto';
105-
this.bottomToolbarInternal = this.toolbarContainerElementInternal.createChild('devtools-toolbar');
100+
const toolbarContainerElementInternal = this.element.createChild('div', 'sources-toolbar');
101+
toolbarContainerElementInternal.setAttribute('jslog', `${VisualLogging.toolbar('bottom')}`);
102+
this.#scriptViewToolbar = toolbarContainerElementInternal.createChild('devtools-toolbar');
103+
this.#scriptViewToolbar.style.flex = 'auto';
104+
this.bottomToolbarInternal = toolbarContainerElementInternal.createChild('devtools-toolbar');
106105

107106
this.toolbarChangedListener = null;
108107

@@ -232,6 +231,10 @@ export class SourcesView extends Common.ObjectWrapper.eventMixin<EventTypes, typ
232231
return this.bottomToolbarInternal;
233232
}
234233

234+
scriptViewToolbar(): UI.Toolbar.Toolbar {
235+
return this.#scriptViewToolbar;
236+
}
237+
235238
override wasShown(): void {
236239
super.wasShown();
237240
UI.Context.Context.instance().setFlavor(SourcesView, this);
@@ -242,10 +245,6 @@ export class SourcesView extends Common.ObjectWrapper.eventMixin<EventTypes, typ
242245
super.willHide();
243246
}
244247

245-
toolbarContainerElement(): Element {
246-
return this.toolbarContainerElementInternal;
247-
}
248-
249248
searchableView(): UI.SearchableView.SearchableView {
250249
return this.searchableViewInternal;
251250
}
@@ -348,11 +347,11 @@ export class SourcesView extends Common.ObjectWrapper.eventMixin<EventTypes, typ
348347
const view = this.visibleView();
349348
if (view instanceof UI.View.SimpleView) {
350349
void view.toolbarItems().then(items => {
351-
this.scriptViewToolbar.removeToolbarItems();
350+
this.#scriptViewToolbar.removeToolbarItems();
352351
for (const action of getRegisteredEditorActions()) {
353-
this.scriptViewToolbar.appendToolbarItem(action.getOrCreateButton(this));
352+
this.#scriptViewToolbar.appendToolbarItem(action.getOrCreateButton(this));
354353
}
355-
items.map(item => this.scriptViewToolbar.appendToolbarItem(item));
354+
items.map(item => this.#scriptViewToolbar.appendToolbarItem(item));
356355
});
357356
}
358357
}

0 commit comments

Comments
 (0)