[Windows] Add API to enable inverted color drawing on a WebView
https://bugs.webkit.org/show_bug.cgi?id=77382
Reviewed by Adam Roben.
Source/WebCore:
Implement CACFLayerTreeHost::setShouldInvertColors(), which instructs
the layer tree host to render composited content with inverted colors.
Test: platform/win/inverted-colors/non-composited.html
* platform/graphics/ca/win/CACFLayerTreeHost.cpp:
(WebCore::CACFLayerTreeHost::setShouldInvertColors):
(WebCore):
* platform/graphics/ca/win/CACFLayerTreeHost.h:
(CACFLayerTreeHost):
* platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp: Use
SOFT_LINK_OPTIONAL since WKCACFViewSetShouldInvertColors might not
exist in older versions of WebKitQuartzCoreAdditions.
(WebCore::WKCACFViewLayerTreeHost::setShouldInvertColors):
(WebCore):
* platform/graphics/ca/win/WKCACFViewLayerTreeHost.h:
(WKCACFViewLayerTreeHost):
Source/WebKit/win:
Add a new private WebPreference key called "WebKitShouldInvertColors"
and add private cover methods to get and set the preference. When this
preference changes on a WebPreference object, all WebViews listening to
that object will repaint to reflect the new value.
* Interfaces/IWebPreferencesPrivate.idl: Add [setS|s]houldInvertColors()
cover methods for WebKitShouldInvertColorsPreferenceKey.
* WebPreferenceKeysPrivate.h: Add WebKitShouldInvertColorsPreferenceKey.
* WebPreferences.cpp:
(WebPreferences::shouldInvertColors):
(WebPreferences::setShouldInvertColors):
* WebPreferences.h:
(WebPreferences):
* WebView.cpp:
(WebView::setShouldInvertColors): If m_shouldInvertColors changes,
update the value on the WebView and in m_layerTreeHost, then repaint
the view.
(WebView::notifyPreferencesChanged):
(WebView::setAcceleratedCompositing): When creating a new layer tree
host, tell it whether it should be inverting colors.
* WebView.h:
LayoutTests:
Add a test for non-composited inverted drawing. Testing the composited
path is blocked on <https://bugs.webkit.org/show_bug.cgi?id=78439>.
* platform/win-wk2/platform/win/inverted-colors/non-composited-expected.png: Added.
* platform/win-wk2/platform/win/inverted-colors/non-composited-expected.txt: Added.
* platform/win/inverted-colors/non-composited-expected.png: Added.
* platform/win/inverted-colors/non-composited-expected.txt: Added.
* platform/win/inverted-colors/non-composited.html: Added.
* platform/win/inverted-colors/resources/gradient.png: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107603
268f45cc-cd09-0410-ab3c-
d52691b4dbfc