[CSS Shaders] Make CSS Shaders compile on Chromium
authorachicu@adobe.com <achicu@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Mar 2012 22:28:53 +0000 (22:28 +0000)
committerachicu@adobe.com <achicu@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Mar 2012 22:28:53 +0000 (22:28 +0000)
commita27490b11137c3a91f66b8366e83c6d1bac54c3f
tree519a774085ef7e0474f41a491940ba7105c73875
parent9017de19bc37780e3f4b586b080153e4c4daae8f
[CSS Shaders] Make CSS Shaders compile on Chromium
https://bugs.webkit.org/show_bug.cgi?id=81435

Source/WebCore:

Reviewed by Stephen White.

This patch enables the CSS Shaders compile time flag, but keeps the runtime flag disabled.
The only way to test the functionality now is to use the overridePreference from dump render tree.

Also part of this patch I fix a layering violation: I removed the "Document" reference from the FECustomFilter.cpp and passed the
HostWindow directly. There should be no problem when the HostWindow changes, because the RenderLayer and the FECustomFilter
get recreated anyway.

No new tests. I've updated the existing custom filter tests to run under Chromium and added the expected results.
I've just added window.layoutTestController.overridePreference("WebKitCSSCustomFilterEnabled", "1") to force
enable the feature at runtime.

* loader/cache/CachedResource.cpp: Made CachedResource::ShaderResource report as ResourceRequest::TargetIsSubresource for Chromium.
(WebCore::cachedResourceTypeToTargetType):

* platform/graphics/filters/FECustomFilter.cpp:
(WebCore::FECustomFilter::FECustomFilter): Removed Document and just used the HostWindow directly.
(WebCore::FECustomFilter::create):
(WebCore::FECustomFilter::initializeContext):
(WebCore::FECustomFilter::bindVertexAttribute): There was a typo and instead of using the "size" parameter it always used 4 component attribute.
Other drivers didn't complain about it, but it was clearly a bug.
(WebCore::FECustomFilter::bindProgramAndBuffers): Reading the image back from GPU will flip vertically the framebuffer in Chromium. I've flipped the
projection matrix only on Chromium, so that we get the correct result.

* rendering/FilterEffectRenderer.cpp:
(WebCore::FilterEffectRenderer::build): Passing the HostWindow instead of the Document.

Source/WebKit/chromium:

Reviewed by Stephen White.

I've added the ENABLE_CSS_SHADERS flag by default, but kept CSS Shaders disabled using the runtime flag.

This change adds a new public API to WebSettings with syntax void setExperimentalCSSCustomFilterEnabled(bool).

* features.gypi:
* public/WebSettings.h:
* src/WebSettingsImpl.cpp:
(WebKit::WebSettingsImpl::setExperimentalCSSCustomFilterEnabled):
(WebKit):
* src/WebSettingsImpl.h:
(WebSettingsImpl):

Tools:

Reviewed by Stephen White.

I've added WebKitCSSCustomFilterEnabled support for the layoutTestController.overridePreference function.

* DumpRenderTree/chromium/LayoutTestController.cpp:
(LayoutTestController::overridePreference):
* DumpRenderTree/chromium/WebPreferences.cpp:
(WebPreferences::reset):
(WebPreferences::applyTo):
* DumpRenderTree/chromium/WebPreferences.h:
(WebPreferences):

LayoutTests:

Reviewed by Stephen White.

I've added window.layoutTestController.overridePreference("WebKitCSSCustomFilterEnabled", "1") to force
enable the feature at runtime.

I've rebased the expected results for chromium. It seems like the result is a little bit lighter then the old ones.
Also, some tests are failing and seem to be related to differences between V8 and JSC: jsWrapperClass returns "Object" and
"Function", for "__proto__" and "constructor" properties of the CSSValueList objects.
I've let the results keep the "FAIL" status for those particular cases.

* css3/filters/custom/custom-filter-shader-cache.html:
* css3/filters/custom/effect-custom-combined-missing.html:
* css3/filters/custom/effect-custom-parameters.html:
* css3/filters/custom/effect-custom.html:
* css3/filters/custom/missing-custom-filter-shader.html:
* css3/filters/script-tests/custom-filter-property-computed-style.js:
* css3/filters/script-tests/custom-filter-property-parsing-invalid.js:
* css3/filters/script-tests/custom-filter-property-parsing.js:
* platform/chromium-linux/css3/filters/custom/custom-filter-property-computed-style-expected.txt: Added.
* platform/chromium-linux/css3/filters/custom/custom-filter-property-parsing-expected.txt: Added.
* platform/chromium-linux/css3/filters/custom/custom-filter-property-parsing-invalid-expected.txt: Added.
* platform/chromium-linux/css3/filters/custom/custom-filter-shader-cache-expected.png: Added.
* platform/chromium-linux/css3/filters/custom/custom-filter-shader-cache-expected.txt: Added.
* platform/chromium-linux/css3/filters/custom/effect-custom-combined-missing-expected.png: Added.
* platform/chromium-linux/css3/filters/custom/effect-custom-combined-missing-expected.txt: Added.
* platform/chromium-linux/css3/filters/custom/effect-custom-disabled-expected.txt: Added.
* platform/chromium-linux/css3/filters/custom/effect-custom-expected.png: Added.
* platform/chromium-linux/css3/filters/custom/effect-custom-expected.txt: Added.
* platform/chromium-linux/css3/filters/custom/effect-custom-parameters-expected.png: Added.
* platform/chromium-linux/css3/filters/custom/effect-custom-parameters-expected.txt: Added.
* platform/chromium-linux/css3/filters/custom/missing-custom-filter-shader-expected.png: Added.
* platform/chromium-linux/css3/filters/custom/missing-custom-filter-shader-expected.txt: Added.
* platform/chromium-mac/css3/filters/custom/custom-filter-shader-cache-expected.png: Added.
* platform/chromium-mac/css3/filters/custom/custom-filter-shader-cache-expected.txt: Added.
* platform/chromium-mac/css3/filters/custom/effect-custom-combined-missing-expected.png: Added.
* platform/chromium-mac/css3/filters/custom/effect-custom-combined-missing-expected.txt: Added.
* platform/chromium-mac/css3/filters/custom/effect-custom-expected.png: Added.
* platform/chromium-mac/css3/filters/custom/effect-custom-expected.txt: Added.
* platform/chromium-mac/css3/filters/custom/effect-custom-parameters-expected.png: Added.
* platform/chromium-mac/css3/filters/custom/effect-custom-parameters-expected.txt: Added.
* platform/chromium-mac/css3/filters/custom/filter-repaint-shaders-expected.png: Added.
* platform/chromium-mac/css3/filters/custom/filter-repaint-shaders-expected.txt: Added.
* platform/chromium-mac/css3/filters/custom/missing-custom-filter-shader-expected.png: Added.
* platform/chromium-mac/css3/filters/custom/missing-custom-filter-shader-expected.txt: Added.
* platform/chromium/css3/filters/custom/custom-filter-property-computed-style-expected.txt: Added.
* platform/chromium/css3/filters/custom/custom-filter-property-parsing-expected.txt: Added.
* platform/chromium/css3/filters/custom/custom-filter-property-parsing-invalid-expected.txt: Added.
* platform/chromium/css3/filters/custom/effect-custom-disabled-expected.txt: Added.
* platform/chromium/test_expectations.txt: I've added Mac and Linux results, so skipping the tests only on Windows.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111610 268f45cc-cd09-0410-ab3c-d52691b4dbfc
54 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/filters/custom/custom-filter-shader-cache.html
LayoutTests/css3/filters/custom/effect-custom-combined-missing.html
LayoutTests/css3/filters/custom/effect-custom-parameters.html
LayoutTests/css3/filters/custom/effect-custom.html
LayoutTests/css3/filters/custom/missing-custom-filter-shader.html
LayoutTests/css3/filters/script-tests/custom-filter-property-computed-style.js
LayoutTests/css3/filters/script-tests/custom-filter-property-parsing-invalid.js
LayoutTests/css3/filters/script-tests/custom-filter-property-parsing.js
LayoutTests/platform/chromium-linux/css3/filters/custom/custom-filter-property-computed-style-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux/css3/filters/custom/custom-filter-property-parsing-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux/css3/filters/custom/custom-filter-property-parsing-invalid-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux/css3/filters/custom/custom-filter-shader-cache-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux/css3/filters/custom/custom-filter-shader-cache-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux/css3/filters/custom/effect-custom-combined-missing-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux/css3/filters/custom/effect-custom-combined-missing-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux/css3/filters/custom/effect-custom-disabled-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux/css3/filters/custom/effect-custom-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux/css3/filters/custom/effect-custom-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux/css3/filters/custom/effect-custom-parameters-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux/css3/filters/custom/effect-custom-parameters-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux/css3/filters/custom/missing-custom-filter-shader-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux/css3/filters/custom/missing-custom-filter-shader-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-mac/css3/filters/custom/custom-filter-shader-cache-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-mac/css3/filters/custom/custom-filter-shader-cache-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-mac/css3/filters/custom/effect-custom-combined-missing-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-mac/css3/filters/custom/effect-custom-combined-missing-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-mac/css3/filters/custom/effect-custom-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-mac/css3/filters/custom/effect-custom-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-mac/css3/filters/custom/effect-custom-parameters-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-mac/css3/filters/custom/effect-custom-parameters-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-mac/css3/filters/custom/filter-repaint-shaders-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-mac/css3/filters/custom/filter-repaint-shaders-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-mac/css3/filters/custom/missing-custom-filter-shader-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-mac/css3/filters/custom/missing-custom-filter-shader-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/css3/filters/custom/custom-filter-property-computed-style-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/css3/filters/custom/custom-filter-property-parsing-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/css3/filters/custom/custom-filter-property-parsing-invalid-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/css3/filters/custom/effect-custom-disabled-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/test_expectations.txt
Source/WebCore/ChangeLog
Source/WebCore/loader/cache/CachedResource.cpp
Source/WebCore/platform/graphics/filters/FECustomFilter.cpp
Source/WebCore/platform/graphics/filters/FECustomFilter.h
Source/WebCore/rendering/FilterEffectRenderer.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/features.gypi
Source/WebKit/chromium/public/WebSettings.h
Source/WebKit/chromium/src/WebSettingsImpl.cpp
Source/WebKit/chromium/src/WebSettingsImpl.h
Tools/ChangeLog
Tools/DumpRenderTree/chromium/LayoutTestController.cpp
Tools/DumpRenderTree/chromium/WebPreferences.cpp
Tools/DumpRenderTree/chromium/WebPreferences.h