Force scrollbars to be GPU layers when acceleration is enabled

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.
This commit is contained in:
Nathan Sobo
2014-09-19 15:09:43 -06:00
parent d6842dc8a2
commit bac99222f3
2 changed files with 4 additions and 0 deletions

View File

@@ -128,6 +128,7 @@ EditorComponent = React.createClass
scrollableInOppositeDirection: verticallyScrollable scrollableInOppositeDirection: verticallyScrollable
verticalScrollbarWidth: verticalScrollbarWidth verticalScrollbarWidth: verticalScrollbarWidth
horizontalScrollbarHeight: horizontalScrollbarHeight horizontalScrollbarHeight: horizontalScrollbarHeight
useHardwareAcceleration: @useHardwareAcceleration
ScrollbarComponent ScrollbarComponent
ref: 'verticalScrollbar' ref: 'verticalScrollbar'
@@ -140,6 +141,7 @@ EditorComponent = React.createClass
scrollableInOppositeDirection: horizontallyScrollable scrollableInOppositeDirection: horizontallyScrollable
verticalScrollbarWidth: verticalScrollbarWidth verticalScrollbarWidth: verticalScrollbarWidth
horizontalScrollbarHeight: horizontalScrollbarHeight horizontalScrollbarHeight: horizontalScrollbarHeight
useHardwareAcceleration: @useHardwareAcceleration
# Also used to measure the height/width of scrollbars after the initial render # Also used to measure the height/width of scrollbars after the initial render
ScrollbarCornerComponent ScrollbarCornerComponent

View File

@@ -9,9 +9,11 @@ ScrollbarComponent = React.createClass
render: -> render: ->
{orientation, className, scrollHeight, scrollWidth, visible} = @props {orientation, className, scrollHeight, scrollWidth, visible} = @props
{scrollableInOppositeDirection, horizontalScrollbarHeight, verticalScrollbarWidth} = @props {scrollableInOppositeDirection, horizontalScrollbarHeight, verticalScrollbarWidth} = @props
{useHardwareAcceleration} = @props
style = {} style = {}
style.display = 'none' unless visible style.display = 'none' unless visible
style.transform = 'translateZ(0)' if useHardwareAcceleration # See atom/atom#3559
switch orientation switch orientation
when 'vertical' when 'vertical'
style.width = verticalScrollbarWidth style.width = verticalScrollbarWidth