From 20a0c0f910470656795150af06371d7be1587145 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 27 Nov 2017 17:35:36 -0500 Subject: [PATCH] Bug 1421071 - Don't use fallback for invisible overlay scrollbar tracks on Mac with WebRender. r=jrmuizel MozReview-Commit-ID: 5PJVqgGi8uD --HG-- extra : rebase_source : bc238065ee46d009120dde7ee8de56f640facb24 --- widget/cocoa/nsNativeThemeCocoa.mm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/widget/cocoa/nsNativeThemeCocoa.mm b/widget/cocoa/nsNativeThemeCocoa.mm index 927cd7176f91..760279b3a972 100644 --- a/widget/cocoa/nsNativeThemeCocoa.mm +++ b/widget/cocoa/nsNativeThemeCocoa.mm @@ -3080,10 +3080,19 @@ nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(mozilla::wr::DisplayListBui case NS_THEME_RANGE: case NS_THEME_SCROLLBARTHUMB_VERTICAL: case NS_THEME_SCROLLBARTHUMB_HORIZONTAL: - case NS_THEME_SCROLLBARTRACK_HORIZONTAL: - case NS_THEME_SCROLLBARTRACK_VERTICAL: return false; + case NS_THEME_SCROLLBARTRACK_HORIZONTAL: + case NS_THEME_SCROLLBARTRACK_VERTICAL: { + BOOL isOverlay = nsLookAndFeel::UseOverlayScrollbars(); + if (isOverlay && !IsParentScrollbarRolledOver(aFrame)) { + // There is no scrollbar track, draw nothing and return true. + return true; + } + // There is a scrollbar track and it needs to be drawn using fallback. + return false; + } + case NS_THEME_TEXTFIELD_MULTILINE: { if (eventState.HasState(NS_EVENT_STATE_FOCUS)) { // We can't draw the focus ring using webrender, so fall back to regular