mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Move new character measurement to end of full update to avoid reflow
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
@@ -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})
|
||||
|
||||
Reference in New Issue
Block a user