Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 91286d4579c9197e08777780a65486b289f36da1
https://github.com/WebKit/WebKit/commit/91286d4579c9197e08777780a65486b289f36da1
Author: Alan Baradlay <[email protected]>
Date: 2026-04-29 (Wed, 29 Apr 2026)
Changed paths:
A
LayoutTests/fast/scrolling/always-on-scrollbar-dark-appearance-expected.html
A LayoutTests/fast/scrolling/always-on-scrollbar-dark-appearance.html
M Source/WebCore/platform/ScrollableArea.cpp
M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h
M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm
Log Message:
-----------
Always-on scrollbars are invisible when on root element of nested documents
https://bugs.webkit.org/show_bug.cgi?id=313543
Reviewed by Simon Fraser.
<iframe src="data:text/html,
<style>body {
width: 500px;
height: 500px;
background-color: green;
}
</style>
content">
</iframe>
A green page background made WebKit think "dark background, use light-colored
scrollbars".
That's correct for overlay scrollbars as they need to contrast with the page.
But it's wrong for always-on scrollbars (those have their own gray track and
don't need to adapt to the page color).
useDarkAppearanceForScrollbars() has the following logic:
return useDarkAppearance() || scrollbarOverlayStyle() ==
ScrollbarOverlayStyle::Light;
scrollbarOverlayStyle() returns Light for dark/colored backgrounds,
which made useDarkAppearanceForScrollbars() return true.
This switched NSAppearance to DarkAqua, rendering the always-on
scrollbar thumb with a light, translucent style (invisible against colored
backgrounds like green).
The fix: only check scrollbarOverlayStyle when hasOverlayScrollbars() is true.
The overlay style is a color adaptation hint for overlay scrollbars -- always-on
scrollbars have their own opaque track and should use the system appearance.
* LayoutTests/fast/scrolling/always-on-scrollbar-dark-appearance-expected.html:
Added.
* LayoutTests/fast/scrolling/always-on-scrollbar-dark-appearance.html: Added.
* Source/WebCore/platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::useDarkAppearanceForScrollbars const):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm:
(WebKit::PDFPluginBase::useDarkAppearance const):
The PDF plugin relied on scrollbarOverlayStyle(Light) as a backdoor to signal
dark mode, because its ScrollableArea never overrode useDarkAppearance()
(the base class just returns false). With the new hasOverlayScrollbars() gate,
that backdoor stopped working for always-on scrollbars.
The fix: override useDarkAppearance() on PDFPluginBase to delegate to
page->useDarkAppearance(). Now the PDF plugin answers "are you in dark mode?"
directly instead of smuggling it through the overlay style.
Canonical link: https://commits.webkit.org/312300@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications