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

* aux window - dont forget to apply `filter` when copying attributes

* actually align layouts
This commit is contained in:
Benjamin Pasero 2024-01-25 21:01:02 +01:00 committed by GitHub
parent bc7fc03d6a
commit 4f143e0e28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 11 deletions

View file

@ -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);
}
}
}
@ -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();

View file

@ -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)
@ -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 {