From b38fafc83a7bf54dc634c71c71ff7689e173aa42 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 23 Feb 2017 13:04:14 -0700 Subject: [PATCH] Absolutely position line number tiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Static positioning doesn’t seem to improve layout performance --- src/text-editor-component.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/text-editor-component.js b/src/text-editor-component.js index 1001e2114..58749485b 100644 --- a/src/text-editor-component.js +++ b/src/text-editor-component.js @@ -76,9 +76,10 @@ class TextEditorComponent { if (this.measurements) { props.style = { + contain: 'strict', + overflow: 'hidden', height: this.getScrollHeight() + 'px', - width: this.measurements.lineNumberGutterWidth + 'px', - contain: 'strict' + width: this.measurements.lineNumberGutterWidth + 'px' } const firstTileStartRow = this.getTileStartRow(this.getFirstVisibleRow()) @@ -117,18 +118,17 @@ class TextEditorComponent { const tileIndex = (tileStartRow / ROWS_PER_TILE) % visibleTileCount const tileHeight = ROWS_PER_TILE * this.measurements.lineHeight - const yTranslation = this.topPixelPositionForRow(tileStartRow) - (tileIndex * tileHeight) children[tileIndex] = $.div({ style: { - // position: 'absolute', + contain: 'strict', + overflow: 'hidden', + position: 'absolute', height: tileHeight + 'px', width: this.measurements.lineNumberGutterWidth + 'px', willChange: 'transform', - transform: `translateY(${yTranslation}px)`, - backgroundColor: 'inherit', - contain: 'strict', - overflow: 'hidden' + transform: `translateY(${this.topPixelPositionForRow(tileStartRow)}px)`, + backgroundColor: 'inherit' } }, lineNumberNodes) }