From bac99222f312a672d854fdf4b3f5ddc0c7211048 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 19 Sep 2014 15:09:43 -0600 Subject: [PATCH] Force scrollbars to be GPU layers when acceleration is enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #3559 For some reason, Chromium 37 is not compositing scrollbars correctly on secondary monitors in OS X. They’re invisible when the lines layer extends beneath the scrollbars unless we apply this style. --- src/editor-component.coffee | 2 ++ src/scrollbar-component.coffee | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/editor-component.coffee b/src/editor-component.coffee index fb9d7216e..90de158d5 100644 --- a/src/editor-component.coffee +++ b/src/editor-component.coffee @@ -128,6 +128,7 @@ EditorComponent = React.createClass scrollableInOppositeDirection: verticallyScrollable verticalScrollbarWidth: verticalScrollbarWidth horizontalScrollbarHeight: horizontalScrollbarHeight + useHardwareAcceleration: @useHardwareAcceleration ScrollbarComponent ref: 'verticalScrollbar' @@ -140,6 +141,7 @@ EditorComponent = React.createClass scrollableInOppositeDirection: horizontallyScrollable verticalScrollbarWidth: verticalScrollbarWidth horizontalScrollbarHeight: horizontalScrollbarHeight + useHardwareAcceleration: @useHardwareAcceleration # Also used to measure the height/width of scrollbars after the initial render ScrollbarCornerComponent diff --git a/src/scrollbar-component.coffee b/src/scrollbar-component.coffee index 4a494da5e..1e23d686c 100644 --- a/src/scrollbar-component.coffee +++ b/src/scrollbar-component.coffee @@ -9,9 +9,11 @@ ScrollbarComponent = React.createClass render: -> {orientation, className, scrollHeight, scrollWidth, visible} = @props {scrollableInOppositeDirection, horizontalScrollbarHeight, verticalScrollbarWidth} = @props + {useHardwareAcceleration} = @props style = {} style.display = 'none' unless visible + style.transform = 'translateZ(0)' if useHardwareAcceleration # See atom/atom#3559 switch orientation when 'vertical' style.width = verticalScrollbarWidth