Move new character measurement to end of full update to avoid reflow

This commit is contained in:
Nathan Sobo
2015-02-14 09:33:03 -07:00
parent bf29a020e1
commit fd603a0cbc
2 changed files with 5 additions and 5 deletions

View File

@@ -49,7 +49,7 @@ class LinesComponent
@updateSync(visible)
updateSync: (visible) ->
updateSync: ->
@newState = @presenter.state.content
@oldState ?= {lines: {}}
@@ -81,8 +81,6 @@ class LinesComponent
@domNode.style.width = @newState.scrollWidth + 'px'
@oldState.scrollWidth = @newState.scrollWidth
@measureCharactersInNewLines() if visible and not @newState.scrollingVertically
@cursorsComponent.updateSync()
@highlightsComponent.updateSync()

View File

@@ -101,7 +101,7 @@ TextEditorComponent = React.createClass
@hiddenInputComponent = new InputComponent(@presenter)
scrollViewNode.appendChild(@hiddenInputComponent.domNode)
@linesComponent = new LinesComponent({@presenter, hostElement, useShadowDOM, visible: @isVisible()})
@linesComponent = new LinesComponent({@presenter, hostElement, useShadowDOM})
scrollViewNode.appendChild(@linesComponent.domNode)
@horizontalScrollbarComponent = new ScrollbarComponent({@presenter, orientation: 'horizontal', onScroll: @onHorizontalScroll})
@@ -153,7 +153,7 @@ TextEditorComponent = React.createClass
@gutterComponent = null
@hiddenInputComponent.updateSync()
@linesComponent.updateSync(@isVisible())
@linesComponent.updateSync()
@horizontalScrollbarComponent.updateSync()
@verticalScrollbarComponent.updateSync()
@scrollbarCornerComponent.updateSync()
@@ -165,6 +165,8 @@ TextEditorComponent = React.createClass
@props.hostElement.__spacePenView.trigger 'selection:changed' if selectionChanged
@props.hostElement.__spacePenView.trigger 'editor:display-updated'
@linesComponent.measureCharactersInNewLines() if @isVisible() and not @newState.content.scrollingVertically
mountGutterComponent: ->
{editor} = @props
@gutterComponent = new GutterComponent({@presenter, editor, onMouseDown: @onGutterMouseDown})