mirror of
https://github.com/Microsoft/vscode
synced 2024-11-05 18:29:38 +00:00
Merge pull request #171539 from microsoft/rebornix/growing-eel
💄 remove more redundant cell layout requests.
This commit is contained in:
commit
817c5fd7f9
6 changed files with 11 additions and 17 deletions
|
@ -488,10 +488,18 @@ export class CellOutputContainer extends CellContentPart {
|
|||
}
|
||||
|
||||
render() {
|
||||
try {
|
||||
this._doRender();
|
||||
} finally {
|
||||
// TODO@rebornix, this is probably not necessary at all as cell layout change would send the update request.
|
||||
this._relayoutCell();
|
||||
}
|
||||
}
|
||||
|
||||
private _doRender() {
|
||||
if (this.viewCell.outputsViewModels.length > 0) {
|
||||
if (this.viewCell.layoutInfo.outputTotalHeight !== 0) {
|
||||
this.viewCell.updateOutputMinHeight(this.viewCell.layoutInfo.outputTotalHeight);
|
||||
this._relayoutCell();
|
||||
}
|
||||
|
||||
DOM.show(this.templateData.outputContainer.domNode);
|
||||
|
@ -507,11 +515,9 @@ export class CellOutputContainer extends CellContentPart {
|
|||
this.viewCell.updateOutputShowMoreContainerHeight(46);
|
||||
}
|
||||
|
||||
this._relayoutCell();
|
||||
this._validateFinalOutputHeight(false);
|
||||
} else {
|
||||
// noop
|
||||
this._relayoutCell();
|
||||
DOM.hide(this.templateData.outputContainer.domNode);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ export class CodeCell extends Disposable {
|
|||
// this.viewCell.layoutInfo.editorHeight or estimation when this.viewCell.layoutInfo.editorHeight === 0
|
||||
const editorHeight = this.calculateInitEditorHeight();
|
||||
this.initializeEditor(editorHeight);
|
||||
this._renderedInputCollapseState = false; // editor is always expanded initially
|
||||
|
||||
this.registerViewCellLayoutChange();
|
||||
this.registerCellEditorEventListeners();
|
||||
|
@ -116,6 +117,7 @@ export class CodeCell extends Disposable {
|
|||
// Render Outputs
|
||||
this.viewCell.editorHeight = editorHeight;
|
||||
this._outputContainerRenderer.render();
|
||||
this._renderedOutputCollapseState = false; // the output is always rendered initially
|
||||
// Need to do this after the intial renderOutput
|
||||
if (this.viewCell.isOutputCollapsed === undefined && this.viewCell.isInputCollapsed === undefined) {
|
||||
this.initialViewUpdateExpanded();
|
||||
|
|
|
@ -67,10 +67,6 @@ export class NotebookCellListDelegate extends Disposable implements IListVirtual
|
|||
return element.getHeight(this.lineHeight);
|
||||
}
|
||||
|
||||
hasDynamicHeight(element: CellViewModel): boolean {
|
||||
return element.hasDynamicHeight();
|
||||
}
|
||||
|
||||
getDynamicHeight(element: CellViewModel): number | null {
|
||||
return element.getDynamicHeight();
|
||||
}
|
||||
|
|
|
@ -200,7 +200,6 @@ export abstract class BaseCellViewModel extends Disposable {
|
|||
|
||||
|
||||
abstract updateOptions(e: NotebookOptionsChangeEvent): void;
|
||||
abstract hasDynamicHeight(): boolean;
|
||||
abstract getHeight(lineHeight: number): number;
|
||||
abstract onDeselect(): void;
|
||||
abstract layoutChange(change: any): void;
|
||||
|
|
|
@ -344,11 +344,6 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod
|
|||
}
|
||||
}
|
||||
|
||||
hasDynamicHeight() {
|
||||
// CodeCellVM always measures itself and controls its cell's height
|
||||
return false;
|
||||
}
|
||||
|
||||
getDynamicHeight() {
|
||||
this._onLayoutInfoRead.fire();
|
||||
return this._layoutInfo.totalHeight;
|
||||
|
|
|
@ -249,10 +249,6 @@ export class MarkupCellViewModel extends BaseCellViewModel implements ICellViewM
|
|||
}
|
||||
}
|
||||
|
||||
hasDynamicHeight() {
|
||||
return false;
|
||||
}
|
||||
|
||||
getDynamicHeight() {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue