From d839ea9aa534d3ec947e230c4998ca2f4faa9956 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 20 Jun 2014 16:07:19 -0600 Subject: [PATCH] Don't render an opaque background behind line numbers It doesn't help subpixel anti-aliasing like I thought, so screw it. --- spec/editor-component-spec.coffee | 6 ------ src/editor-component.coffee | 4 ++-- src/gutter-component.coffee | 10 +++------- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/spec/editor-component-spec.coffee b/spec/editor-component-spec.coffee index d47abdb00..6382a1474 100644 --- a/spec/editor-component-spec.coffee +++ b/spec/editor-component-spec.coffee @@ -462,12 +462,6 @@ describe "EditorComponent", -> expect(component.lineNumberNodeForScreenRow(9).textContent).toBe "10" expect(gutterNode.offsetWidth).toBe initialGutterWidth - it "renders the .line-numbers div at the full height of the editor even if it's taller than its content", -> - node.style.height = node.offsetHeight + 100 + 'px' - component.measureScrollView() - nextTick() - expect(node.querySelector('.line-numbers').offsetHeight).toBe node.offsetHeight - describe "fold decorations", -> describe "rendering fold decorations", -> it "adds the foldable class to line numbers when the line is foldable", -> diff --git a/src/editor-component.coffee b/src/editor-component.coffee index 7cdcbf713..4aa79bafc 100644 --- a/src/editor-component.coffee +++ b/src/editor-component.coffee @@ -83,8 +83,8 @@ EditorComponent = React.createClass div className: className, style: {fontSize, lineHeight, fontFamily}, tabIndex: -1, GutterComponent { ref: 'gutter', onMouseDown: @onGutterMouseDown, onWidthChanged: @onGutterWidthChanged, - lineDecorations, defaultCharWidth, editor, renderedRowRange, maxLineNumberDigits, scrollViewHeight, - scrollTop, scrollHeight, lineHeightInPixels, @pendingChanges, mouseWheelScreenRow + lineDecorations, defaultCharWidth, editor, renderedRowRange, maxLineNumberDigits, + scrollTop, lineHeightInPixels, @pendingChanges, mouseWheelScreenRow } div ref: 'scrollView', className: 'scroll-view', onMouseDown: @onMouseDown, diff --git a/src/gutter-component.coffee b/src/gutter-component.coffee index 2555c7ebd..a7e82180d 100644 --- a/src/gutter-component.coffee +++ b/src/gutter-component.coffee @@ -15,13 +15,10 @@ GutterComponent = React.createClass measuredWidth: null render: -> - {scrollHeight, scrollViewHeight, scrollTop, onMouseDown} = @props + {scrollTop, onMouseDown} = @props div className: 'gutter', onClick: @onClick, onMouseDown: onMouseDown, - # The line-numbers div must have the 'editor-colors' class so it has an - # opaque background to avoid sub-pixel anti-aliasing problems on the GPU - div className: 'gutter line-numbers editor-colors', ref: 'lineNumbers', style: - height: Math.max(scrollHeight, scrollViewHeight) + div className: 'line-numbers', ref: 'lineNumbers', style: WebkitTransform: "translate3d(0px, #{-scrollTop}px, 0px)" componentWillMount: -> @@ -38,8 +35,7 @@ GutterComponent = React.createClass # visible row range. shouldComponentUpdate: (newProps) -> return true unless isEqualForProperties(newProps, @props, - 'renderedRowRange', 'scrollTop', 'lineHeightInPixels', 'mouseWheelScreenRow', 'lineDecorations', - 'scrollViewHeight' + 'renderedRowRange', 'scrollTop', 'lineHeightInPixels', 'mouseWheelScreenRow', 'lineDecorations' ) {renderedRowRange, pendingChanges, lineDecorations} = newProps