Text selection color is hard to see in dark mode web views.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Aug 2018 20:12:40 +0000 (20:12 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Aug 2018 20:12:40 +0000 (20:12 +0000)
commit8ff09982d67ae5179628ddcffca5b5892e051ebe
treeb13a47fe93ae08977410ceb63e8e2e26c0b871e2
parent1279aa86fc944e59c4b5cf1b86fb0ab7e8b30ea4
Text selection color is hard to see in dark mode web views.
https://bugs.webkit.org/show_bug.cgi?id=188260
rdar://problem/42721294

Reviewed by Simon Fraser.

Stop using blendWithWhite() to transform the AppKit selection color in dark mode.
Using an alpha of 80% gives good contrast, and still works good for selections over images.

* platform/graphics/Color.cpp:
(WebCore::Color::blendWithWhite const): Mark new colors as semantic if the original is.
(WebCore::Color::colorWithAlpha const): Ditto.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::selectionBackgroundColor const): Use transformSelectionBackgroundColor.
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::activeSelectionBackgroundColor const): Use transformSelectionBackgroundColor.
(WebCore::RenderTheme::inactiveSelectionBackgroundColor const): Ditto.
(WebCore::RenderTheme::transformSelectionBackgroundColor const): Added. Just blend with white.
* rendering/RenderTheme.h:
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::transformSelectionBackgroundColor const): Added. Use an alpha with the color
in dark mode, otherwise fallback to RenderTheme.
(WebCore::RenderThemeMac::systemColor const): Use activeListBoxSelectionBackgroundColor()
and activeSelectionBackgroundColor() instead of caching the colors again. Update hardcoded color.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234512 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/Color.cpp
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderTheme.h
Source/WebCore/rendering/RenderThemeMac.h
Source/WebCore/rendering/RenderThemeMac.mm