Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aux window - align layout() behaviour with main window #203479

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/vs/base/browser/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2341,9 +2341,11 @@ function camelCaseToHyphenCase(str: string) {
return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
}

export function copyAttributes(from: Element, to: Element): void {
export function copyAttributes(from: Element, to: Element, filter?: string[]): void {
for (const { name, value } of from.attributes) {
to.setAttribute(name, value);
if (!filter || filter.includes(name)) {
to.setAttribute(name, value);
}
}
}

Expand All @@ -2357,7 +2359,7 @@ function copyAttribute(from: Element, to: Element, name: string): void {
}

export function trackAttributes(from: Element, to: Element, filter?: string[]): IDisposable {
copyAttributes(from, to);
copyAttributes(from, to, filter);

const disposables = new DisposableStore();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,7 @@ export class AuxiliaryWindow extends BaseWindow implements IAuxiliaryWindow {
e.preventDefault();
}));

this._register(addDisposableListener(this.window, EventType.RESIZE, () => {
const dimension = getClientArea(this.window.document.body, this.container);
position(this.container, 0, 0, 0, 0, 'relative');
size(this.container, dimension.width, dimension.height);

this._onDidLayout.fire(dimension);
}));
this._register(addDisposableListener(this.window, EventType.RESIZE, () => this.layout()));

this._register(addDisposableListener(this.container, EventType.SCROLL, () => this.container.scrollTop = 0)); // Prevent container from scrolling (#55456)

Expand Down Expand Up @@ -142,7 +136,11 @@ export class AuxiliaryWindow extends BaseWindow implements IAuxiliaryWindow {
}

layout(): void {
this._onDidLayout.fire(getClientArea(this.window.document.body, this.container));
const dimension = getClientArea(this.window.document.body, this.container);
position(this.container, 0, 0, 0, 0, 'relative');
size(this.container, dimension.width, dimension.height);

this._onDidLayout.fire(dimension);
}

override dispose(): void {
Expand Down