[Windows] Add API to enable inverted color drawing on a WebView
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Feb 2012 21:59:17 +0000 (21:59 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Feb 2012 21:59:17 +0000 (21:59 +0000)
commit671c747301f0f07227a98efbb66e51443cfea328
treea4782d21ffdcc1a1ff1d4a5b4418c4dc416ad968
parent9d9b173d60bf5f336365303aba620b2466b28f2c
[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
19 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/win-wk2/platform/win/inverted-colors/non-composited-expected.png [new file with mode: 0755]
LayoutTests/platform/win-wk2/platform/win/inverted-colors/non-composited-expected.txt [new file with mode: 0644]
LayoutTests/platform/win/inverted-colors/non-composited-expected.png [new file with mode: 0755]
LayoutTests/platform/win/inverted-colors/non-composited-expected.txt [new file with mode: 0644]
LayoutTests/platform/win/inverted-colors/non-composited.html [new file with mode: 0644]
LayoutTests/platform/win/inverted-colors/resources/gradient.png [new file with mode: 0755]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp
Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h
Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp
Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h
Source/WebKit/win/ChangeLog
Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
Source/WebKit/win/WebPreferenceKeysPrivate.h
Source/WebKit/win/WebPreferences.cpp
Source/WebKit/win/WebPreferences.h
Source/WebKit/win/WebView.cpp
Source/WebKit/win/WebView.h