Skip to content

Commit

Permalink
cache layout calls to grid views
Browse files Browse the repository at this point in the history
related to #112630
  • Loading branch information
joaomoreno committed May 10, 2021
1 parent e0bf136 commit 0449a18
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/vs/base/browser/ui/grid/gridview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,25 @@ class LeafNode implements ISplitView<ILayoutContext>, IDisposable {
this._orthogonalSize = ctx.orthogonalSize;
this.absoluteOffset = ctx.absoluteOffset + offset;
this.absoluteOrthogonalOffset = ctx.absoluteOrthogonalOffset;
this.view.layout(this.width, this.height, this.top, this.left);

this._layout(this.width, this.height, this.top, this.left);
}

private cachedWidth: number = 0;
private cachedHeight: number = 0;
private cachedTop: number = 0;
private cachedLeft: number = 0;

private _layout(width: number, height: number, top: number, left: number): void {
if (this.cachedWidth === width && this.cachedHeight === height && this.cachedTop === top && this.cachedLeft === left) {
return;
}

this.cachedWidth = width;
this.cachedHeight = height;
this.cachedTop = top;
this.cachedLeft = left;
this.view.layout(width, height, top, left);
}

setVisible(visible: boolean): void {
Expand Down

0 comments on commit 0449a18

Please sign in to comment.