diff --git a/src/cursor-component.coffee b/src/cursor-component.coffee index b0aed6dd0..a2a752999 100644 --- a/src/cursor-component.coffee +++ b/src/cursor-component.coffee @@ -15,15 +15,15 @@ CursorComponent = React.createClass div className: 'cursor', style: {height, width, WebkitTransform} getTransform: -> - {pixelRect, scrollTop, scrollLeft, gpuDisabled} = @props + {pixelRect, scrollTop, scrollLeft, useHardwareAcceleration} = @props {top, left} = pixelRect top -= scrollTop left -= scrollLeft - if gpuDisabled - "translate(#{left}px, #{top}px)" - else + if useHardwareAcceleration "translate3d(#{left}px, #{top}px, 0px)" + else + "translate(#{left}px, #{top}px)" shouldComponentUpdate: (newProps) -> not isEqualForProperties(newProps, @props, 'pixelRect', 'scrollTop', 'scrollLeft', 'defaultCharWidth') diff --git a/src/cursors-component.coffee b/src/cursors-component.coffee index 6fd179cd9..a87f59830 100644 --- a/src/cursors-component.coffee +++ b/src/cursors-component.coffee @@ -12,7 +12,7 @@ CursorsComponent = React.createClass cursorBlinkIntervalHandle: null render: -> - {cursorPixelRects, scrollTop, scrollLeft, defaultCharWidth, gpuDisabled} = @props + {cursorPixelRects, scrollTop, scrollLeft, defaultCharWidth, useHardwareAcceleration} = @props {blinkOff} = @state className = 'cursors' @@ -34,7 +34,7 @@ CursorsComponent = React.createClass shouldComponentUpdate: (newProps, newState) -> not newState.blinkOff is @state.blinkOff or - not isEqualForProperties(newProps, @props, 'cursorPixelRects', 'scrollTop', 'scrollLeft', 'defaultCharWidth', 'gpuDisabled') + not isEqualForProperties(newProps, @props, 'cursorPixelRects', 'scrollTop', 'scrollLeft', 'defaultCharWidth', 'useHardwareAcceleration') componentWillUpdate: (newProps) -> cursorsMoved = @props.cursorPixelRects? and diff --git a/src/editor-component.coffee b/src/editor-component.coffee index b146795b2..a4b5772b0 100644 --- a/src/editor-component.coffee +++ b/src/editor-component.coffee @@ -74,7 +74,7 @@ EditorComponent = React.createClass verticallyScrollable = editor.verticallyScrollable() horizontallyScrollable = editor.horizontallyScrollable() hiddenInputStyle = @getHiddenInputPosition() - hiddenInputStyle.WebkitTransform = 'translateZ(0)' unless @gpuDisabled + hiddenInputStyle.WebkitTransform = 'translateZ(0)' if @useHardwareAcceleration if @mouseWheelScreenRow? and not (renderedStartRow <= @mouseWheelScreenRow < renderedEndRow) mouseWheelScreenRow = @mouseWheelScreenRow @@ -87,7 +87,7 @@ EditorComponent = React.createClass GutterComponent { ref: 'gutter', onMouseDown: @onGutterMouseDown, onWidthChanged: @onGutterWidthChanged, lineDecorations, defaultCharWidth, editor, renderedRowRange, maxLineNumberDigits, scrollViewHeight, - scrollTop, scrollHeight, lineHeightInPixels, @pendingChanges, mouseWheelScreenRow, @gpuDisabled + scrollTop, scrollHeight, lineHeightInPixels, @pendingChanges, mouseWheelScreenRow, @useHardwareAcceleration } div ref: 'scrollView', className: 'scroll-view', onMouseDown: @onMouseDown, @@ -100,14 +100,14 @@ EditorComponent = React.createClass CursorsComponent { scrollTop, scrollLeft, cursorPixelRects, cursorBlinkPeriod, cursorBlinkResumeDelay, - lineHeightInPixels, defaultCharWidth, @scopedCharacterWidthsChangeCount, @gpuDisabled + lineHeightInPixels, defaultCharWidth, @scopedCharacterWidthsChangeCount, @useHardwareAcceleration } LinesComponent { ref: 'lines', editor, lineHeightInPixels, defaultCharWidth, lineDecorations, highlightDecorations, showIndentGuide, renderedRowRange, @pendingChanges, scrollTop, scrollLeft, @scrollingVertically, scrollHeight, scrollWidth, mouseWheelScreenRow, invisibles, - visible, scrollViewHeight, @scopedCharacterWidthsChangeCount, lineWidth, @gpuDisabled + visible, scrollViewHeight, @scopedCharacterWidthsChangeCount, lineWidth, @useHardwareAcceleration } ScrollbarComponent @@ -481,7 +481,7 @@ EditorComponent = React.createClass @subscribe atom.config.observe 'editor.showInvisibles', @setShowInvisibles @subscribe atom.config.observe 'editor.showLineNumbers', @setShowLineNumbers @subscribe atom.config.observe 'editor.scrollSensitivity', @setScrollSensitivity - @subscribe atom.config.observe 'editor.gpuDisabled', @setGPUDisabled + @subscribe atom.config.observe 'editor.useHardwareAcceleration', @setuseHardwareAcceleration onFocus: -> @refs.input.focus() @@ -874,9 +874,9 @@ EditorComponent = React.createClass if scrollSensitivity = parseInt(scrollSensitivity) @scrollSensitivity = Math.abs(scrollSensitivity) / 100 - setGPUDisabled: (gpuDisabled) -> - unless @gpuDisabled is gpuDisabled - @gpuDisabled = gpuDisabled + setuseHardwareAcceleration: (useHardwareAcceleration) -> + unless @useHardwareAcceleration is useHardwareAcceleration + @useHardwareAcceleration = useHardwareAcceleration @requestUpdate() screenPositionForMouseEvent: (event) -> diff --git a/src/editor-view.coffee b/src/editor-view.coffee index 0c4ded5c6..848097404 100644 --- a/src/editor-view.coffee +++ b/src/editor-view.coffee @@ -57,7 +57,7 @@ class EditorView extends View softTabs: true softWrapAtPreferredLineLength: false scrollSensitivity: 40 - gpuDisabled: false + useHardwareAcceleration: true @nextEditorId: 1 diff --git a/src/gutter-component.coffee b/src/gutter-component.coffee index 8ad08877e..ba6c07988 100644 --- a/src/gutter-component.coffee +++ b/src/gutter-component.coffee @@ -25,12 +25,12 @@ GutterComponent = React.createClass WebkitTransform: @getTransform() getTransform: -> - {scrollTop, gpuDisabled} = @props + {scrollTop, useHardwareAcceleration} = @props - if gpuDisabled - "translate(0px, #{-scrollTop}px)" - else + if useHardwareAcceleration "translate3d(0px, #{-scrollTop}px, 0px)" + else + "translate(0px, #{-scrollTop}px)" componentWillMount: -> @lineNumberNodesById = {} @@ -47,7 +47,7 @@ GutterComponent = React.createClass shouldComponentUpdate: (newProps) -> return true unless isEqualForProperties(newProps, @props, 'renderedRowRange', 'scrollTop', 'lineHeightInPixels', 'mouseWheelScreenRow', 'lineDecorations', - 'scrollViewHeight', 'gpuDisabled' + 'scrollViewHeight', 'useHardwareAcceleration' ) {renderedRowRange, pendingChanges, lineDecorations} = newProps diff --git a/src/lines-component.coffee b/src/lines-component.coffee index 592f289b1..2458b06f8 100644 --- a/src/lines-component.coffee +++ b/src/lines-component.coffee @@ -29,12 +29,12 @@ LinesComponent = React.createClass HighlightsComponent({editor, highlightDecorations, lineHeightInPixels, defaultCharWidth, scopedCharacterWidthsChangeCount}) getTransform: -> - {scrollTop, scrollLeft, gpuDisabled} = @props + {scrollTop, scrollLeft, useHardwareAcceleration} = @props - if gpuDisabled - "translate(#{-scrollLeft}px, #{-scrollTop}px)" - else + if useHardwareAcceleration "translate3d(#{-scrollLeft}px, #{-scrollTop}px, 0px)" + else + "translate(#{-scrollLeft}px, #{-scrollTop}px)" componentWillMount: -> @measuredLines = new WeakSet @@ -47,7 +47,7 @@ LinesComponent = React.createClass return true unless isEqualForProperties(newProps, @props, 'renderedRowRange', 'lineDecorations', 'highlightDecorations', 'lineHeightInPixels', 'defaultCharWidth', 'scrollTop', 'scrollLeft', 'showIndentGuide', 'scrollingVertically', 'invisibles', 'visible', - 'scrollViewHeight', 'mouseWheelScreenRow', 'scopedCharacterWidthsChangeCount', 'lineWidth', 'gpuDisabled' + 'scrollViewHeight', 'mouseWheelScreenRow', 'scopedCharacterWidthsChangeCount', 'lineWidth', 'useHardwareAcceleration' ) {renderedRowRange, pendingChanges} = newProps