Make it easier for non-Apple ports to enable dark mode CSS support.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Jan 2019 01:51:03 +0000 (01:51 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Jan 2019 01:51:03 +0000 (01:51 +0000)
commitf90be602223917fba72cfa3d20ec8ba9603a79e6
treee5bef8072edc8be693011cf8362f5fbf9d693be1
parent3e6f721808b6588f56f11173ca840353b81128d4
Make it easier for non-Apple ports to enable dark mode CSS support.
https://bugs.webkit.org/show_bug.cgi?id=193882

Reviewed by Megan Gardner.

Source/WebCore:

* page/FrameView.cpp:
(WebCore::FrameView::updateBackgroundRecursively): Limit use of system
background color to the Mac platform.
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::purgeCaches): Purge m_darkColorCache.
(WebCore::RenderTheme::platformColorsDidChange): Reset m_darkColorCache.
(WebCore::RenderTheme::colorCache const): Added m_darkColorCache.
* rendering/RenderTheme.h:
(WebCore::RenderTheme::colorCache const): Deleted.
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::purgeCaches): Removed m_darkColorCache.
(WebCore::RenderThemeMac::platformColorsDidChange): Deleted.
(WebCore::RenderThemeMac::colorCache const): Deleted.

Source/WebKit:

Make modern WebKit code for dark mode usable by other ports, to match
the WebCore parts that have been cross-platform all along.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/PageClient.h:
(WebKit::PageClient::effectiveAppearanceIsDark const):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
(WebKit::WebPageProxy::useDarkAppearance const):
(WebKit::WebPageProxy::effectiveAppearanceDidChange):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_shouldAttachDrawingAreaOnPageTransition):
(WebKit::WebPage::setUseDarkAppearance):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Source/WebKitLegacy/mac:

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]): Fix some defines.
(-[WebView _effectiveAppearanceIsDark]): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240628 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderTheme.h
Source/WebCore/rendering/RenderThemeMac.h
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPageCreationParameters.cpp
Source/WebKit/Shared/WebPageCreationParameters.h
Source/WebKit/UIProcess/PageClient.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebView.mm