Commit 0c8994e6 authored by michelangelo@webkit.org's avatar michelangelo@webkit.org
Browse files

Use arrays in shaders

https://bugs.webkit.org/show_bug.cgi?id=95223

Reviewed by Dean Jackson.

Source/WebCore:

Custom Filters' support for array() is introduced. Values within
the array() function will be passed as uniforms to shaders.

Values within array() are comma-separated; the specification will be
updated accordingly: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18839

Test: css3/filters/custom/custom-filter-array.html

* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::valueForCustomFilterArrayParameter):
(WebCore):
(WebCore::valueForCustomFilterParameter):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::collectMatchingRulesForList):
* css/StyleResolver.h:
(StyleResolver):
* platform/graphics/filters/CustomFilterArrayParameter.h: Container for array()
parameter values.
(WebCore):
(CustomFilterArrayParameter):
(WebCore::CustomFilterArrayParameter::create):
(WebCore::CustomFilterArrayParameter::size):
(WebCore::CustomFilterArrayParameter::valueAt):
(WebCore::CustomFilterArrayParameter::addValue):
(WebCore::CustomFilterArrayParameter::blend):
(WebCore::CustomFilterArrayParameter::operator==):
(WebCore::CustomFilterArrayParameter::CustomFilterArrayParameter):
* platform/graphics/filters/CustomFilterParameter.h:
* platform/graphics/filters/FECustomFilter.cpp:
(WebCore::FECustomFilter::bindProgramArrayParameters):
(WebCore):
(WebCore::FECustomFilter::bindProgramParameters):
* platform/graphics/filters/FECustomFilter.h:
(WebCore):
(FECustomFilter):

LayoutTests:

New tests have been added for checking the correctness of array()
within shaders.

* css3/filters/custom/custom-filter-array-expected.html: Added.
* css3/filters/custom/custom-filter-array.html: Added.
* css3/filters/custom/custom-filter-property-computed-style-expected.txt:
* css3/filters/custom/custom-filter-property-parsing-invalid-expected.txt:
* css3/filters/resources/fragment-color.fs: Added.
* css3/filters/script-tests/custom-filter-property-computed-style.js:
* css3/filters/script-tests/custom-filter-property-parsing-invalid.js:
* platform/chromium/css3/filters/custom/custom-filter-property-computed-style-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@128626 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 42835557
2012-09-14 Michelangelo De Simone <michelangelo@webkit.org>
Use arrays in shaders
https://bugs.webkit.org/show_bug.cgi?id=95223
Reviewed by Dean Jackson.
New tests have been added for checking the correctness of array()
within shaders.
* css3/filters/custom/custom-filter-array-expected.html: Added.
* css3/filters/custom/custom-filter-array.html: Added.
* css3/filters/custom/custom-filter-property-computed-style-expected.txt:
* css3/filters/custom/custom-filter-property-parsing-invalid-expected.txt:
* css3/filters/resources/fragment-color.fs: Added.
* css3/filters/script-tests/custom-filter-property-computed-style.js:
* css3/filters/script-tests/custom-filter-property-parsing-invalid.js:
* platform/chromium/css3/filters/custom/custom-filter-property-computed-style-expected.txt:
2012-09-14 Christophe Dumez <christophe.dumez@intel.com>
 
WebKitTestRunner needs layoutTestController.dumpDatabaseCallbacks
<!doctype html>
<html>
<head>
<title>Tests the array() function in custom filters</title>
<style>
#filtertestbox {
height: 100px;
width: 100px;
background-color: rgb(0, 255, 0);
}
</style>
</head>
<body onload="runTest()">
<div id="filtertestbox"></div>
</body>
</html>
<!doctype html>
<html>
<head>
<title>Tests the array() function in custom filters</title>
<script>
if (window.testRunner) {
window.testRunner.overridePreference("WebKitCSSCustomFilterEnabled", "1");
window.testRunner.overridePreference("WebKitWebGLEnabled", "1");
window.testRunner.waitUntilDone();
}
function runTest()
{
// We need to run the tests after the downloading succeeded.
if (window.testRunner)
window.testRunner.notifyDone();
}
</script>
<style>
#filtertestbox {
height: 100px;
width: 100px;
background-color: red;
-webkit-filter: custom(none url('../resources/fragment-color.fs'), colorArray array(0.0, 1.0, 0.0, 1.0));
}
</style>
</head>
<body onload="runTest()">
<!--
A 100x100px red div is coloured green by fragment-color.fs, a fragment shader.
Fails if the div stays red.
-->
<div id="filtertestbox"></div>
</body>
</html>
......@@ -529,6 +529,51 @@ PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM
PASS removeBaseURL(subRule.cssText) is 'custom(none url(fragment.shader), 1 1 filter-box)'
PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_SEPIA
PASS removeBaseURL(subRule.cssText) is 'sepia(1)'
Custom with array() made up of three values : custom(none url(fragment.shader), a1 array(1, 2, 3))
PASS removeBaseURL(filterStyle.getPropertyValue('-webkit-filter')) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(1, 2, 3))'
PASS jsWrapperClass(filterRule) is 'CSSValueList'
PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype'
PASS jsWrapperClass(filterRule.constructor) is 'CSSValueListConstructor'
PASS filterRule.length is 1
PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM
PASS removeBaseURL(subRule.cssText) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(1, 2, 3))'
Custom with array() made up of three floating point values : custom(none url(fragment.shader), a1 array(1.6180, -2.7182, 3.1415))
PASS removeBaseURL(filterStyle.getPropertyValue('-webkit-filter')) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(1.618, -2.7182, 3.1415))'
PASS jsWrapperClass(filterRule) is 'CSSValueList'
PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype'
PASS jsWrapperClass(filterRule.constructor) is 'CSSValueListConstructor'
PASS filterRule.length is 1
PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM
PASS removeBaseURL(subRule.cssText) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(1.618, -2.7182, 3.1415))'
Custom with array() made up of several floating point and integer values : custom(none url(fragment.shader), a1 array(1.6180, 1, -2.7182, 0.1, 3.1415))
PASS removeBaseURL(filterStyle.getPropertyValue('-webkit-filter')) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(1.618, 1, -2.7182, 0.1, 3.1415))'
PASS jsWrapperClass(filterRule) is 'CSSValueList'
PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype'
PASS jsWrapperClass(filterRule.constructor) is 'CSSValueListConstructor'
PASS filterRule.length is 1
PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM
PASS removeBaseURL(subRule.cssText) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(1.618, 1, -2.7182, 0.1, 3.1415))'
Custom with array() made up of 247 different floating point values : custom(none url(fragment.shader), a1 array(6.00, 38.58, 40.14, 34.03, 83.33, 24.18, 68.37, 15.87, 56.56, 73.21, 99.05, 24.64, 6.39, 69.34, 91.19, 27.98, 37.52, 60.71, 21.94, 62.70, 77.96, 67.27, 2.75, 28.16, 8.88, 11.61, 34.89, 45.75, 54.55, 35.04, 6.13, 69.68, 81.21, 49.44, 54.74, 26.74, 91.49, 68.20, 84.05, 65.81, 57.89, 73.22, 13.87, 71.73, 18.61, 8.54, 9.79, 28.05, 14.11, 69.93, 47.19, 10.48, 81.35, 37.15, 19.29, 14.98, 32.54, 98.96, 69.37, 92.26, 34.64, 67.43, 71.92, 45.52, 9.22, 41.96, 31.26, 92.65, 35.02, 39.00, 76.76, 29.33, 22.93, 80.65, 70.78, 42.94, 27.72, 28.19, 75.15, 18.14, 89.71, 95.38, 54.51, 36.93, 98.45, 87.58, 44.51, 71.73, 75.71, 70.43, 78.51, 82.19, 31.73, 2.90, 8.23, 93.74, 31.26, 84.73, 6.48, 41.96, 75.72, 53.96, 35.06, 67.50, 76.62, 35.02, 1.62, 13.05, 33.59, 26.89, 36.94, 74.13, 95.09, 56.87, 46.01, 11.94, 12.92, 48.88, 11.03, 24.80, 68.06, 19.83, 12.98, 41.56, 62.03, 80.35, 41.10, 5.31, 43.96, 9.02, 92.32, 34.50, 88.41, 90.34, 97.62, 58.70, 23.62, 13.03, 85.41, 29.73, 30.21, 59.25, 91.22, 78.21, 62.30, 60.93, 33.26, 16.13, 95.61, 78.62, 97.42, 96.42, 38.04, 8.49, 45.47, 68.73, 18.20, 26.65, 78.39, 95.26, 66.80, 34.41, 10.69, 94.43, 71.69, 4.58, 23.87, 61.01, 95.68, 8.51, 14.92, 16.27, 30.41, 1.40, 12.35, 99.39, 5.80, 68.10, 73.87, 28.36, 24.98, 77.58, 8.73, 34.08, 54.45, 87.64, 36.14, 74.68, 38.04, 56.54, 46.42, 12.40, 5.90, 15.70, 10.88, 55.82, 84.66, 75.74, 87.92, 59.03, 60.30, 4.32, 7.05, 3.34, 9.87, 64.51, 4.60, 54.16, 48.80, 46.93, 5.84, 90.34, 75.48, 32.59, 29.65, 94.57, 28.22, 93.70, 23.79, 89.57, 14.84, 79.58, 62.29, 58.76, 29.43, 19.16, 44.47, 38.31, 44.77, 42.66, 88.85, 74.96, 24.07, 37.75, 41.65, 62.35, 90.40, 40.77, 53.93, 80.23, 84.49, 20.18, 45.36, 26.02, 93.72, 65.54, 32.86))
PASS removeBaseURL(filterStyle.getPropertyValue('-webkit-filter')) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(6, 38.58, 40.14, 34.03, 83.33, 24.18, 68.37, 15.87, 56.56, 73.21, 99.05, 24.64, 6.39, 69.34, 91.19, 27.98, 37.52, 60.71, 21.94, 62.7, 77.96, 67.27, 2.75, 28.16, 8.88, 11.61, 34.89, 45.75, 54.55, 35.04, 6.13, 69.68, 81.21, 49.44, 54.74, 26.74, 91.49, 68.2, 84.05, 65.81, 57.89, 73.22, 13.87, 71.73, 18.61, 8.54, 9.79, 28.05, 14.11, 69.93, 47.19, 10.48, 81.35, 37.15, 19.29, 14.98, 32.54, 98.96, 69.37, 92.26, 34.64, 67.43, 71.92, 45.52, 9.22, 41.96, 31.26, 92.65, 35.02, 39, 76.76, 29.33, 22.93, 80.65, 70.78, 42.94, 27.72, 28.19, 75.15, 18.14, 89.71, 95.38, 54.51, 36.93, 98.45, 87.58, 44.51, 71.73, 75.71, 70.43, 78.51, 82.19, 31.73, 2.9, 8.23, 93.74, 31.26, 84.73, 6.48, 41.96, 75.72, 53.96, 35.06, 67.5, 76.62, 35.02, 1.62, 13.05, 33.59, 26.89, 36.94, 74.13, 95.09, 56.87, 46.01, 11.94, 12.92, 48.88, 11.03, 24.8, 68.06, 19.83, 12.98, 41.56, 62.03, 80.35, 41.1, 5.31, 43.96, 9.02, 92.32, 34.5, 88.41, 90.34, 97.62, 58.7, 23.62, 13.03, 85.41, 29.73, 30.21, 59.25, 91.22, 78.21, 62.3, 60.93, 33.26, 16.13, 95.61, 78.62, 97.42, 96.42, 38.04, 8.49, 45.47, 68.73, 18.2, 26.65, 78.39, 95.26, 66.8, 34.41, 10.69, 94.43, 71.69, 4.58, 23.87, 61.01, 95.68, 8.51, 14.92, 16.27, 30.41, 1.4, 12.35, 99.39, 5.8, 68.1, 73.87, 28.36, 24.98, 77.58, 8.73, 34.08, 54.45, 87.64, 36.14, 74.68, 38.04, 56.54, 46.42, 12.4, 5.9, 15.7, 10.88, 55.82, 84.66, 75.74, 87.92, 59.03, 60.3, 4.32, 7.05, 3.34, 9.87, 64.51, 4.6, 54.16, 48.8, 46.93, 5.84, 90.34, 75.48, 32.59, 29.65, 94.57, 28.22, 93.7, 23.79, 89.57, 14.84, 79.58, 62.29, 58.76, 29.43, 19.16, 44.47, 38.31, 44.77, 42.66, 88.85, 74.96, 24.07, 37.75, 41.65, 62.35, 90.4, 40.77, 53.93, 80.23, 84.49, 20.18, 45.36, 26.02, 93.72, 65.54, 32.86))'
PASS jsWrapperClass(filterRule) is 'CSSValueList'
PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype'
PASS jsWrapperClass(filterRule.constructor) is 'CSSValueListConstructor'
PASS filterRule.length is 1
PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM
PASS removeBaseURL(subRule.cssText) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(6, 38.58, 40.14, 34.03, 83.33, 24.18, 68.37, 15.87, 56.56, 73.21, 99.05, 24.64, 6.39, 69.34, 91.19, 27.98, 37.52, 60.71, 21.94, 62.7, 77.96, 67.27, 2.75, 28.16, 8.88, 11.61, 34.89, 45.75, 54.55, 35.04, 6.13, 69.68, 81.21, 49.44, 54.74, 26.74, 91.49, 68.2, 84.05, 65.81, 57.89, 73.22, 13.87, 71.73, 18.61, 8.54, 9.79, 28.05, 14.11, 69.93, 47.19, 10.48, 81.35, 37.15, 19.29, 14.98, 32.54, 98.96, 69.37, 92.26, 34.64, 67.43, 71.92, 45.52, 9.22, 41.96, 31.26, 92.65, 35.02, 39, 76.76, 29.33, 22.93, 80.65, 70.78, 42.94, 27.72, 28.19, 75.15, 18.14, 89.71, 95.38, 54.51, 36.93, 98.45, 87.58, 44.51, 71.73, 75.71, 70.43, 78.51, 82.19, 31.73, 2.9, 8.23, 93.74, 31.26, 84.73, 6.48, 41.96, 75.72, 53.96, 35.06, 67.5, 76.62, 35.02, 1.62, 13.05, 33.59, 26.89, 36.94, 74.13, 95.09, 56.87, 46.01, 11.94, 12.92, 48.88, 11.03, 24.8, 68.06, 19.83, 12.98, 41.56, 62.03, 80.35, 41.1, 5.31, 43.96, 9.02, 92.32, 34.5, 88.41, 90.34, 97.62, 58.7, 23.62, 13.03, 85.41, 29.73, 30.21, 59.25, 91.22, 78.21, 62.3, 60.93, 33.26, 16.13, 95.61, 78.62, 97.42, 96.42, 38.04, 8.49, 45.47, 68.73, 18.2, 26.65, 78.39, 95.26, 66.8, 34.41, 10.69, 94.43, 71.69, 4.58, 23.87, 61.01, 95.68, 8.51, 14.92, 16.27, 30.41, 1.4, 12.35, 99.39, 5.8, 68.1, 73.87, 28.36, 24.98, 77.58, 8.73, 34.08, 54.45, 87.64, 36.14, 74.68, 38.04, 56.54, 46.42, 12.4, 5.9, 15.7, 10.88, 55.82, 84.66, 75.74, 87.92, 59.03, 60.3, 4.32, 7.05, 3.34, 9.87, 64.51, 4.6, 54.16, 48.8, 46.93, 5.84, 90.34, 75.48, 32.59, 29.65, 94.57, 28.22, 93.7, 23.79, 89.57, 14.84, 79.58, 62.29, 58.76, 29.43, 19.16, 44.47, 38.31, 44.77, 42.66, 88.85, 74.96, 24.07, 37.75, 41.65, 62.35, 90.4, 40.77, 53.93, 80.23, 84.49, 20.18, 45.36, 26.02, 93.72, 65.54, 32.86))'
Custom with two array() made up of three and six values : custom(none url(fragment.shader), a1 array(1, 2, 3), a2 array(1, 2, 3, 4, 5, 6))
PASS removeBaseURL(filterStyle.getPropertyValue('-webkit-filter')) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(1, 2, 3), a2 array(1, 2, 3, 4, 5, 6))'
PASS jsWrapperClass(filterRule) is 'CSSValueList'
PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype'
PASS jsWrapperClass(filterRule.constructor) is 'CSSValueListConstructor'
PASS filterRule.length is 1
PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM
PASS removeBaseURL(subRule.cssText) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(1, 2, 3), a2 array(1, 2, 3, 4, 5, 6))'
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -369,6 +369,16 @@ PASS cssRule.type is 1
PASS declaration.length is 0
PASS declaration.getPropertyValue('-webkit-filter') is null
NaN in array() : custom(none url(shader), id array(NaN))
PASS cssRule.type is 1
PASS declaration.length is 0
PASS declaration.getPropertyValue('-webkit-filter') is null
NaN and values in array() : custom(none url(shader), id array(1, 2, NaN, 3))
PASS cssRule.type is 1
PASS declaration.length is 0
PASS declaration.getPropertyValue('-webkit-filter') is null
Invalid unit value in array() : custom(none url(shader), id array(1px))
PASS cssRule.type is 1
PASS declaration.length is 0
......
precision mediump float;
uniform float colorArray[4];
void main()
{
gl_FragColor = vec4(colorArray[0], colorArray[1], colorArray[2], colorArray[3]);
}
......@@ -199,3 +199,23 @@ testFilterRule("Multiple with fragment shader",
["grayscale(1)",
"custom(none url(fragment.shader), 1 1 filter-box)",
"sepia(1)"]);
testFilterRule("Custom with array() made up of three values",
"custom(none url(fragment.shader), a1 array(1, 2, 3))",
"custom(none url(fragment.shader), 1 1 filter-box, a1 array(1, 2, 3))");
testFilterRule("Custom with array() made up of three floating point values",
"custom(none url(fragment.shader), a1 array(1.6180, -2.7182, 3.1415))",
"custom(none url(fragment.shader), 1 1 filter-box, a1 array(1.618, -2.7182, 3.1415))");
testFilterRule("Custom with array() made up of several floating point and integer values",
"custom(none url(fragment.shader), a1 array(1.6180, 1, -2.7182, 0.1, 3.1415))",
"custom(none url(fragment.shader), 1 1 filter-box, a1 array(1.618, 1, -2.7182, 0.1, 3.1415))");
testFilterRule("Custom with array() made up of 247 different floating point values",
"custom(none url(fragment.shader), a1 array(6.00, 38.58, 40.14, 34.03, 83.33, 24.18, 68.37, 15.87, 56.56, 73.21, 99.05, 24.64, 6.39, 69.34, 91.19, 27.98, 37.52, 60.71, 21.94, 62.70, 77.96, 67.27, 2.75, 28.16, 8.88, 11.61, 34.89, 45.75, 54.55, 35.04, 6.13, 69.68, 81.21, 49.44, 54.74, 26.74, 91.49, 68.20, 84.05, 65.81, 57.89, 73.22, 13.87, 71.73, 18.61, 8.54, 9.79, 28.05, 14.11, 69.93, 47.19, 10.48, 81.35, 37.15, 19.29, 14.98, 32.54, 98.96, 69.37, 92.26, 34.64, 67.43, 71.92, 45.52, 9.22, 41.96, 31.26, 92.65, 35.02, 39.00, 76.76, 29.33, 22.93, 80.65, 70.78, 42.94, 27.72, 28.19, 75.15, 18.14, 89.71, 95.38, 54.51, 36.93, 98.45, 87.58, 44.51, 71.73, 75.71, 70.43, 78.51, 82.19, 31.73, 2.90, 8.23, 93.74, 31.26, 84.73, 6.48, 41.96, 75.72, 53.96, 35.06, 67.50, 76.62, 35.02, 1.62, 13.05, 33.59, 26.89, 36.94, 74.13, 95.09, 56.87, 46.01, 11.94, 12.92, 48.88, 11.03, 24.80, 68.06, 19.83, 12.98, 41.56, 62.03, 80.35, 41.10, 5.31, 43.96, 9.02, 92.32, 34.50, 88.41, 90.34, 97.62, 58.70, 23.62, 13.03, 85.41, 29.73, 30.21, 59.25, 91.22, 78.21, 62.30, 60.93, 33.26, 16.13, 95.61, 78.62, 97.42, 96.42, 38.04, 8.49, 45.47, 68.73, 18.20, 26.65, 78.39, 95.26, 66.80, 34.41, 10.69, 94.43, 71.69, 4.58, 23.87, 61.01, 95.68, 8.51, 14.92, 16.27, 30.41, 1.40, 12.35, 99.39, 5.80, 68.10, 73.87, 28.36, 24.98, 77.58, 8.73, 34.08, 54.45, 87.64, 36.14, 74.68, 38.04, 56.54, 46.42, 12.40, 5.90, 15.70, 10.88, 55.82, 84.66, 75.74, 87.92, 59.03, 60.30, 4.32, 7.05, 3.34, 9.87, 64.51, 4.60, 54.16, 48.80, 46.93, 5.84, 90.34, 75.48, 32.59, 29.65, 94.57, 28.22, 93.70, 23.79, 89.57, 14.84, 79.58, 62.29, 58.76, 29.43, 19.16, 44.47, 38.31, 44.77, 42.66, 88.85, 74.96, 24.07, 37.75, 41.65, 62.35, 90.40, 40.77, 53.93, 80.23, 84.49, 20.18, 45.36, 26.02, 93.72, 65.54, 32.86))",
"custom(none url(fragment.shader), 1 1 filter-box, a1 array(6, 38.58, 40.14, 34.03, 83.33, 24.18, 68.37, 15.87, 56.56, 73.21, 99.05, 24.64, 6.39, 69.34, 91.19, 27.98, 37.52, 60.71, 21.94, 62.7, 77.96, 67.27, 2.75, 28.16, 8.88, 11.61, 34.89, 45.75, 54.55, 35.04, 6.13, 69.68, 81.21, 49.44, 54.74, 26.74, 91.49, 68.2, 84.05, 65.81, 57.89, 73.22, 13.87, 71.73, 18.61, 8.54, 9.79, 28.05, 14.11, 69.93, 47.19, 10.48, 81.35, 37.15, 19.29, 14.98, 32.54, 98.96, 69.37, 92.26, 34.64, 67.43, 71.92, 45.52, 9.22, 41.96, 31.26, 92.65, 35.02, 39, 76.76, 29.33, 22.93, 80.65, 70.78, 42.94, 27.72, 28.19, 75.15, 18.14, 89.71, 95.38, 54.51, 36.93, 98.45, 87.58, 44.51, 71.73, 75.71, 70.43, 78.51, 82.19, 31.73, 2.9, 8.23, 93.74, 31.26, 84.73, 6.48, 41.96, 75.72, 53.96, 35.06, 67.5, 76.62, 35.02, 1.62, 13.05, 33.59, 26.89, 36.94, 74.13, 95.09, 56.87, 46.01, 11.94, 12.92, 48.88, 11.03, 24.8, 68.06, 19.83, 12.98, 41.56, 62.03, 80.35, 41.1, 5.31, 43.96, 9.02, 92.32, 34.5, 88.41, 90.34, 97.62, 58.7, 23.62, 13.03, 85.41, 29.73, 30.21, 59.25, 91.22, 78.21, 62.3, 60.93, 33.26, 16.13, 95.61, 78.62, 97.42, 96.42, 38.04, 8.49, 45.47, 68.73, 18.2, 26.65, 78.39, 95.26, 66.8, 34.41, 10.69, 94.43, 71.69, 4.58, 23.87, 61.01, 95.68, 8.51, 14.92, 16.27, 30.41, 1.4, 12.35, 99.39, 5.8, 68.1, 73.87, 28.36, 24.98, 77.58, 8.73, 34.08, 54.45, 87.64, 36.14, 74.68, 38.04, 56.54, 46.42, 12.4, 5.9, 15.7, 10.88, 55.82, 84.66, 75.74, 87.92, 59.03, 60.3, 4.32, 7.05, 3.34, 9.87, 64.51, 4.6, 54.16, 48.8, 46.93, 5.84, 90.34, 75.48, 32.59, 29.65, 94.57, 28.22, 93.7, 23.79, 89.57, 14.84, 79.58, 62.29, 58.76, 29.43, 19.16, 44.47, 38.31, 44.77, 42.66, 88.85, 74.96, 24.07, 37.75, 41.65, 62.35, 90.4, 40.77, 53.93, 80.23, 84.49, 20.18, 45.36, 26.02, 93.72, 65.54, 32.86))");
testFilterRule("Custom with two array() made up of three and six values",
"custom(none url(fragment.shader), a1 array(1, 2, 3), a2 array(1, 2, 3, 4, 5, 6))",
"custom(none url(fragment.shader), 1 1 filter-box, a1 array(1, 2, 3), a2 array(1, 2, 3, 4, 5, 6))");
......@@ -107,6 +107,8 @@ testInvalidFilterRule("Semicolon separated values in array()", "custom(none url(
testInvalidFilterRule("Space separated values in array()", "custom(none url(shader), id array(1 2 3 4))");
testInvalidFilterRule("Space separated values with comma terminator in array()", "custom(none url(shader), id array(1 2 3 4,))");
testInvalidFilterRule("Space separated values with leading comma in array()", "custom(none url(shader), id array(, 1 2 3 4))");
testInvalidFilterRule("NaN in array()", "custom(none url(shader), id array(NaN))");
testInvalidFilterRule("NaN and values in array()", "custom(none url(shader), id array(1, 2, NaN, 3))");
testInvalidFilterRule("Invalid unit value in array()", "custom(none url(shader), id array(1px))");
testInvalidFilterRule("Invalid unit value in array(), second", "custom(none url(shader), id array(none))");
testInvalidFilterRule("Invalid unit value in array(), third", "custom(none url(shader), id array(1deg))");
......
......@@ -529,6 +529,51 @@ PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM
PASS removeBaseURL(subRule.cssText) is 'custom(none url(fragment.shader), 1 1 filter-box)'
PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_SEPIA
PASS removeBaseURL(subRule.cssText) is 'sepia(1)'
Custom with array() made up of three values : custom(none url(fragment.shader), a1 array(1, 2, 3))
PASS removeBaseURL(filterStyle.getPropertyValue('-webkit-filter')) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(1, 2, 3))'
PASS jsWrapperClass(filterRule) is 'CSSValueList'
FAIL jsWrapperClass(filterRule.__proto__) should be CSSValueListPrototype. Was Object.
FAIL jsWrapperClass(filterRule.constructor) should be CSSValueListConstructor. Was Function.
PASS filterRule.length is 1
PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM
PASS removeBaseURL(subRule.cssText) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(1, 2, 3))'
Custom with array() made up of three floating point values : custom(none url(fragment.shader), a1 array(1.6180, -2.7182, 3.1415))
PASS removeBaseURL(filterStyle.getPropertyValue('-webkit-filter')) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(1.618, -2.7182, 3.1415))'
PASS jsWrapperClass(filterRule) is 'CSSValueList'
FAIL jsWrapperClass(filterRule.__proto__) should be CSSValueListPrototype. Was Object.
FAIL jsWrapperClass(filterRule.constructor) should be CSSValueListConstructor. Was Function.
PASS filterRule.length is 1
PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM
PASS removeBaseURL(subRule.cssText) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(1.618, -2.7182, 3.1415))'
Custom with array() made up of several floating point and integer values : custom(none url(fragment.shader), a1 array(1.6180, 1, -2.7182, 0.1, 3.1415))
PASS removeBaseURL(filterStyle.getPropertyValue('-webkit-filter')) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(1.618, 1, -2.7182, 0.1, 3.1415))'
PASS jsWrapperClass(filterRule) is 'CSSValueList'
FAIL jsWrapperClass(filterRule.__proto__) should be CSSValueListPrototype. Was Object.
FAIL jsWrapperClass(filterRule.constructor) should be CSSValueListConstructor. Was Function.
PASS filterRule.length is 1
PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM
PASS removeBaseURL(subRule.cssText) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(1.618, 1, -2.7182, 0.1, 3.1415))'
Custom with array() made up of 247 different floating point values : custom(none url(fragment.shader), a1 array(6.00, 38.58, 40.14, 34.03, 83.33, 24.18, 68.37, 15.87, 56.56, 73.21, 99.05, 24.64, 6.39, 69.34, 91.19, 27.98, 37.52, 60.71, 21.94, 62.70, 77.96, 67.27, 2.75, 28.16, 8.88, 11.61, 34.89, 45.75, 54.55, 35.04, 6.13, 69.68, 81.21, 49.44, 54.74, 26.74, 91.49, 68.20, 84.05, 65.81, 57.89, 73.22, 13.87, 71.73, 18.61, 8.54, 9.79, 28.05, 14.11, 69.93, 47.19, 10.48, 81.35, 37.15, 19.29, 14.98, 32.54, 98.96, 69.37, 92.26, 34.64, 67.43, 71.92, 45.52, 9.22, 41.96, 31.26, 92.65, 35.02, 39.00, 76.76, 29.33, 22.93, 80.65, 70.78, 42.94, 27.72, 28.19, 75.15, 18.14, 89.71, 95.38, 54.51, 36.93, 98.45, 87.58, 44.51, 71.73, 75.71, 70.43, 78.51, 82.19, 31.73, 2.90, 8.23, 93.74, 31.26, 84.73, 6.48, 41.96, 75.72, 53.96, 35.06, 67.50, 76.62, 35.02, 1.62, 13.05, 33.59, 26.89, 36.94, 74.13, 95.09, 56.87, 46.01, 11.94, 12.92, 48.88, 11.03, 24.80, 68.06, 19.83, 12.98, 41.56, 62.03, 80.35, 41.10, 5.31, 43.96, 9.02, 92.32, 34.50, 88.41, 90.34, 97.62, 58.70, 23.62, 13.03, 85.41, 29.73, 30.21, 59.25, 91.22, 78.21, 62.30, 60.93, 33.26, 16.13, 95.61, 78.62, 97.42, 96.42, 38.04, 8.49, 45.47, 68.73, 18.20, 26.65, 78.39, 95.26, 66.80, 34.41, 10.69, 94.43, 71.69, 4.58, 23.87, 61.01, 95.68, 8.51, 14.92, 16.27, 30.41, 1.40, 12.35, 99.39, 5.80, 68.10, 73.87, 28.36, 24.98, 77.58, 8.73, 34.08, 54.45, 87.64, 36.14, 74.68, 38.04, 56.54, 46.42, 12.40, 5.90, 15.70, 10.88, 55.82, 84.66, 75.74, 87.92, 59.03, 60.30, 4.32, 7.05, 3.34, 9.87, 64.51, 4.60, 54.16, 48.80, 46.93, 5.84, 90.34, 75.48, 32.59, 29.65, 94.57, 28.22, 93.70, 23.79, 89.57, 14.84, 79.58, 62.29, 58.76, 29.43, 19.16, 44.47, 38.31, 44.77, 42.66, 88.85, 74.96, 24.07, 37.75, 41.65, 62.35, 90.40, 40.77, 53.93, 80.23, 84.49, 20.18, 45.36, 26.02, 93.72, 65.54, 32.86))
PASS removeBaseURL(filterStyle.getPropertyValue('-webkit-filter')) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(6, 38.58, 40.14, 34.03, 83.33, 24.18, 68.37, 15.87, 56.56, 73.21, 99.05, 24.64, 6.39, 69.34, 91.19, 27.98, 37.52, 60.71, 21.94, 62.7, 77.96, 67.27, 2.75, 28.16, 8.88, 11.61, 34.89, 45.75, 54.55, 35.04, 6.13, 69.68, 81.21, 49.44, 54.74, 26.74, 91.49, 68.2, 84.05, 65.81, 57.89, 73.22, 13.87, 71.73, 18.61, 8.54, 9.79, 28.05, 14.11, 69.93, 47.19, 10.48, 81.35, 37.15, 19.29, 14.98, 32.54, 98.96, 69.37, 92.26, 34.64, 67.43, 71.92, 45.52, 9.22, 41.96, 31.26, 92.65, 35.02, 39, 76.76, 29.33, 22.93, 80.65, 70.78, 42.94, 27.72, 28.19, 75.15, 18.14, 89.71, 95.38, 54.51, 36.93, 98.45, 87.58, 44.51, 71.73, 75.71, 70.43, 78.51, 82.19, 31.73, 2.9, 8.23, 93.74, 31.26, 84.73, 6.48, 41.96, 75.72, 53.96, 35.06, 67.5, 76.62, 35.02, 1.62, 13.05, 33.59, 26.89, 36.94, 74.13, 95.09, 56.87, 46.01, 11.94, 12.92, 48.88, 11.03, 24.8, 68.06, 19.83, 12.98, 41.56, 62.03, 80.35, 41.1, 5.31, 43.96, 9.02, 92.32, 34.5, 88.41, 90.34, 97.62, 58.7, 23.62, 13.03, 85.41, 29.73, 30.21, 59.25, 91.22, 78.21, 62.3, 60.93, 33.26, 16.13, 95.61, 78.62, 97.42, 96.42, 38.04, 8.49, 45.47, 68.73, 18.2, 26.65, 78.39, 95.26, 66.8, 34.41, 10.69, 94.43, 71.69, 4.58, 23.87, 61.01, 95.68, 8.51, 14.92, 16.27, 30.41, 1.4, 12.35, 99.39, 5.8, 68.1, 73.87, 28.36, 24.98, 77.58, 8.73, 34.08, 54.45, 87.64, 36.14, 74.68, 38.04, 56.54, 46.42, 12.4, 5.9, 15.7, 10.88, 55.82, 84.66, 75.74, 87.92, 59.03, 60.3, 4.32, 7.05, 3.34, 9.87, 64.51, 4.6, 54.16, 48.8, 46.93, 5.84, 90.34, 75.48, 32.59, 29.65, 94.57, 28.22, 93.7, 23.79, 89.57, 14.84, 79.58, 62.29, 58.76, 29.43, 19.16, 44.47, 38.31, 44.77, 42.66, 88.85, 74.96, 24.07, 37.75, 41.65, 62.35, 90.4, 40.77, 53.93, 80.23, 84.49, 20.18, 45.36, 26.02, 93.72, 65.54, 32.86))'
PASS jsWrapperClass(filterRule) is 'CSSValueList'
FAIL jsWrapperClass(filterRule.__proto__) should be CSSValueListPrototype. Was Object.
FAIL jsWrapperClass(filterRule.constructor) should be CSSValueListConstructor. Was Function.
PASS filterRule.length is 1
PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM
PASS removeBaseURL(subRule.cssText) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(6, 38.58, 40.14, 34.03, 83.33, 24.18, 68.37, 15.87, 56.56, 73.21, 99.05, 24.64, 6.39, 69.34, 91.19, 27.98, 37.52, 60.71, 21.94, 62.7, 77.96, 67.27, 2.75, 28.16, 8.88, 11.61, 34.89, 45.75, 54.55, 35.04, 6.13, 69.68, 81.21, 49.44, 54.74, 26.74, 91.49, 68.2, 84.05, 65.81, 57.89, 73.22, 13.87, 71.73, 18.61, 8.54, 9.79, 28.05, 14.11, 69.93, 47.19, 10.48, 81.35, 37.15, 19.29, 14.98, 32.54, 98.96, 69.37, 92.26, 34.64, 67.43, 71.92, 45.52, 9.22, 41.96, 31.26, 92.65, 35.02, 39, 76.76, 29.33, 22.93, 80.65, 70.78, 42.94, 27.72, 28.19, 75.15, 18.14, 89.71, 95.38, 54.51, 36.93, 98.45, 87.58, 44.51, 71.73, 75.71, 70.43, 78.51, 82.19, 31.73, 2.9, 8.23, 93.74, 31.26, 84.73, 6.48, 41.96, 75.72, 53.96, 35.06, 67.5, 76.62, 35.02, 1.62, 13.05, 33.59, 26.89, 36.94, 74.13, 95.09, 56.87, 46.01, 11.94, 12.92, 48.88, 11.03, 24.8, 68.06, 19.83, 12.98, 41.56, 62.03, 80.35, 41.1, 5.31, 43.96, 9.02, 92.32, 34.5, 88.41, 90.34, 97.62, 58.7, 23.62, 13.03, 85.41, 29.73, 30.21, 59.25, 91.22, 78.21, 62.3, 60.93, 33.26, 16.13, 95.61, 78.62, 97.42, 96.42, 38.04, 8.49, 45.47, 68.73, 18.2, 26.65, 78.39, 95.26, 66.8, 34.41, 10.69, 94.43, 71.69, 4.58, 23.87, 61.01, 95.68, 8.51, 14.92, 16.27, 30.41, 1.4, 12.35, 99.39, 5.8, 68.1, 73.87, 28.36, 24.98, 77.58, 8.73, 34.08, 54.45, 87.64, 36.14, 74.68, 38.04, 56.54, 46.42, 12.4, 5.9, 15.7, 10.88, 55.82, 84.66, 75.74, 87.92, 59.03, 60.3, 4.32, 7.05, 3.34, 9.87, 64.51, 4.6, 54.16, 48.8, 46.93, 5.84, 90.34, 75.48, 32.59, 29.65, 94.57, 28.22, 93.7, 23.79, 89.57, 14.84, 79.58, 62.29, 58.76, 29.43, 19.16, 44.47, 38.31, 44.77, 42.66, 88.85, 74.96, 24.07, 37.75, 41.65, 62.35, 90.4, 40.77, 53.93, 80.23, 84.49, 20.18, 45.36, 26.02, 93.72, 65.54, 32.86))'
Custom with two array() made up of three and six values : custom(none url(fragment.shader), a1 array(1, 2, 3), a2 array(1, 2, 3, 4, 5, 6))
PASS removeBaseURL(filterStyle.getPropertyValue('-webkit-filter')) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(1, 2, 3), a2 array(1, 2, 3, 4, 5, 6))'
PASS jsWrapperClass(filterRule) is 'CSSValueList'
FAIL jsWrapperClass(filterRule.__proto__) should be CSSValueListPrototype. Was Object.
FAIL jsWrapperClass(filterRule.constructor) should be CSSValueListConstructor. Was Function.
PASS filterRule.length is 1
PASS subRule.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM
PASS removeBaseURL(subRule.cssText) is 'custom(none url(fragment.shader), 1 1 filter-box, a1 array(1, 2, 3), a2 array(1, 2, 3, 4, 5, 6))'
PASS successfullyParsed is true
TEST COMPLETE
......
2012-09-14 Michelangelo De Simone <michelangelo@webkit.org>
Use arrays in shaders
https://bugs.webkit.org/show_bug.cgi?id=95223
Reviewed by Dean Jackson.
Custom Filters' support for array() is introduced. Values within
the array() function will be passed as uniforms to shaders.
Values within array() are comma-separated; the specification will be
updated accordingly: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18839
Test: css3/filters/custom/custom-filter-array.html
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::valueForCustomFilterArrayParameter):
(WebCore):
(WebCore::valueForCustomFilterParameter):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::collectMatchingRulesForList):
* css/StyleResolver.h:
(StyleResolver):
* platform/graphics/filters/CustomFilterArrayParameter.h: Container for array()
parameter values.
(WebCore):
(CustomFilterArrayParameter):
(WebCore::CustomFilterArrayParameter::create):
(WebCore::CustomFilterArrayParameter::size):
(WebCore::CustomFilterArrayParameter::valueAt):
(WebCore::CustomFilterArrayParameter::addValue):
(WebCore::CustomFilterArrayParameter::blend):
(WebCore::CustomFilterArrayParameter::operator==):
(WebCore::CustomFilterArrayParameter::CustomFilterArrayParameter):
* platform/graphics/filters/CustomFilterParameter.h:
* platform/graphics/filters/FECustomFilter.cpp:
(WebCore::FECustomFilter::bindProgramArrayParameters):
(WebCore):
(WebCore::FECustomFilter::bindProgramParameters):
* platform/graphics/filters/FECustomFilter.h:
(WebCore):
(FECustomFilter):
2012-09-14 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
 
[Qt] Remove old cruft from the qmake build system
......@@ -4251,6 +4251,7 @@ webcore_sources += \
Source/WebCore/platform/graphics/cairo/RefPtrCairo.cpp \
Source/WebCore/platform/graphics/cairo/RefPtrCairo.h \
Source/WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp \
Source/WebCore/platform/graphics/filters/CustomFilterArrayParameter.h \
Source/WebCore/platform/graphics/filters/CustomFilterGlobalContext.cpp \
Source/WebCore/platform/graphics/filters/CustomFilterGlobalContext.h \
Source/WebCore/platform/graphics/filters/CustomFilterMesh.cpp \
......
......@@ -2045,6 +2045,7 @@ HEADERS += \
platform/graphics/BitmapImage.h \
platform/graphics/Color.h \
platform/graphics/CrossfadeGeneratedImage.h \
platform/graphics/filters/CustomFilterArrayParameter.h \
platform/graphics/filters/CustomFilterGlobalContext.h \
platform/graphics/filters/CustomFilterMesh.h \
platform/graphics/filters/CustomFilterMeshGenerator.h \
......
......@@ -4919,6 +4919,7 @@
'platform/graphics/efl/ImageEfl.cpp',
'platform/graphics/efl/IntPointEfl.cpp',
'platform/graphics/efl/IntRectEfl.cpp',
'platform/graphics/filters/CustomFilterArrayParameter.h',
'platform/graphics/filters/CustomFilterGlobalContext.cpp',
'platform/graphics/filters/CustomFilterGlobalContext.h',
'platform/graphics/filters/CustomFilterMesh.h',
......
......@@ -31876,6 +31876,10 @@
<Filter
Name="filters"
>
<File
RelativePath="..\platform\graphics\filters\CustomFilterArrayParameter.h"
>
</File>
<File
RelativePath="..\platform\graphics\filters\CustomFilterGlobalContext.cpp"
>
......@@ -354,6 +354,7 @@
14FFE31E0AE1963300136BF5 /* HTMLFrameElementBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14FFE31C0AE1963300136BF5 /* HTMLFrameElementBase.cpp */; };
150B923915F08DC400E10986 /* WebKitCSSArrayFunctionValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150B923715F08DC400E10986 /* WebKitCSSArrayFunctionValue.cpp */; };
150B923A15F08DC400E10986 /* WebKitCSSArrayFunctionValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 150B923815F08DC400E10986 /* WebKitCSSArrayFunctionValue.h */; };
15B3FC1915FB217800A81BCB /* CustomFilterArrayParameter.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B3FC1715FB217800A81BCB /* CustomFilterArrayParameter.h */; };
15C7708D100D3C6B005BA267 /* ValidityState.h in Headers */ = {isa = PBXBuildFile; fileRef = 15C7708A100D3C6A005BA267 /* ValidityState.h */; };
15C7708E100D3C6B005BA267 /* ValidityState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15C7708B100D3C6A005BA267 /* ValidityState.cpp */; };
15C77093100D3CA8005BA267 /* JSValidityState.h in Headers */ = {isa = PBXBuildFile; fileRef = 15C77091100D3CA8005BA267 /* JSValidityState.h */; };
......@@ -7407,6 +7408,7 @@
14FFE31C0AE1963300136BF5 /* HTMLFrameElementBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLFrameElementBase.cpp; sourceTree = "<group>"; };
150B923715F08DC400E10986 /* WebKitCSSArrayFunctionValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSArrayFunctionValue.cpp; sourceTree = "<group>"; };
150B923815F08DC400E10986 /* WebKitCSSArrayFunctionValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSArrayFunctionValue.h; sourceTree = "<group>"; };
15B3FC1715FB217800A81BCB /* CustomFilterArrayParameter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomFilterArrayParameter.h; path = filters/CustomFilterArrayParameter.h; sourceTree = "<group>"; };
15C77089100D3C6A005BA267 /* ValidityState.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ValidityState.idl; sourceTree = "<group>"; };
15C7708A100D3C6A005BA267 /* ValidityState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValidityState.h; sourceTree = "<group>"; };
15C7708B100D3C6A005BA267 /* ValidityState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ValidityState.cpp; sourceTree = "<group>"; };
......@@ -18181,6 +18183,7 @@
isa = PBXGroup;
children = (
49ECEB5C1499790D00CDD3A4 /* arm */,
15B3FC1715FB217800A81BCB /* CustomFilterArrayParameter.h */,
50D4060F147D49DE00D30BB5 /* CustomFilterCompiledProgram.cpp */,
50D40610147D49DE00D30BB5 /* CustomFilterCompiledProgram.h */,
50987C24157D676D00BDA835 /* CustomFilterGlobalContext.cpp */,
......@@ -22589,6 +22592,7 @@
BC2272A20E82E87C00E7F975 /* CursorData.h in Headers */,
BC2272AD0E82E8F300E7F975 /* CursorList.h in Headers */,
62CD325A1157E57C0063B0A7 /* CustomEvent.h in Headers */,
15B3FC1915FB217800A81BCB /* CustomFilterArrayParameter.h in Headers */,
50D40612147D49DE00D30BB5 /* CustomFilterCompiledProgram.h in Headers */,
50987C27157D676D00BDA835 /* CustomFilterGlobalContext.h in Headers */,
50D405FA147D31F300D30BB5 /* CustomFilterMesh.h in Headers */,
......@@ -64,10 +64,12 @@
#include <wtf/text/StringBuilder.h>
#if ENABLE(CSS_SHADERS)
#include "CustomFilterArrayParameter.h"
#include "CustomFilterNumberParameter.h"
#include "CustomFilterOperation.h"
#include "CustomFilterParameter.h"
#include "CustomFilterTransformParameter.h"
#include "WebKitCSSArrayFunctionValue.h"
#include "WebKitCSSMixFunctionValue.h"
#endif
......@@ -771,6 +773,14 @@ static PassRefPtr<CSSValue> computedTransform(RenderObject* renderer, const Rend
}
#if ENABLE(CSS_SHADERS)
static PassRefPtr<CSSValue> valueForCustomFilterArrayParameter(const CustomFilterArrayParameter* arrayParameter)
{
RefPtr<WebKitCSSArrayFunctionValue> arrayParameterValue = WebKitCSSArrayFunctionValue::create();
for (unsigned i = 0, size = arrayParameter->size(); i < size; ++i)
arrayParameterValue->append(cssValuePool().createValue(arrayParameter->valueAt(i), CSSPrimitiveValue::CSS_NUMBER));
return arrayParameterValue.release();
}
static PassRefPtr<CSSValue> valueForCustomFilterNumberParameter(const CustomFilterNumberParameter* numberParameter)
{
RefPtr<CSSValueList> numberParameterValue = CSSValueList::createSpaceSeparated();
......@@ -793,6 +803,8 @@ static PassRefPtr<CSSValue> valueForCustomFilterParameter(const RenderObject* re
// FIXME: Add here computed style for the other types: boolean, transform, matrix, texture.
ASSERT(parameter);
switch (parameter->parameterType()) {
case CustomFilterParameter::ARRAY:
return valueForCustomFilterArrayParameter(static_cast<const CustomFilterArrayParameter*>(parameter));
case CustomFilterParameter::NUMBER:
return valueForCustomFilterNumberParameter(static_cast<const CustomFilterNumberParameter*>(parameter));
case CustomFilterParameter::TRANSFORM:
......
......@@ -147,6 +147,7 @@
#endif
#if ENABLE(CSS_SHADERS)
#include "CustomFilterArrayParameter.h"
#include "CustomFilterNumberParameter.h"
#include "CustomFilterOperation.h"
#include "CustomFilterParameter.h"
......@@ -5252,6 +5253,21 @@ static bool sortParametersByNameComparator(const RefPtr<CustomFilterParameter>&
return codePointCompareLessThan(a->name(), b->name());
}
PassRefPtr<CustomFilterParameter> StyleResolver::parseCustomFilterArrayParameter(const String& name, CSSValueList* values)
{
RefPtr<CustomFilterArrayParameter> arrayParameter = CustomFilterArrayParameter::create(name);
for (unsigned i = 0, length = values->length(); i < length; ++i) {
CSSValue* value = values->itemWithoutBoundsCheck(i);
if (!value->isPrimitiveValue())
return 0;
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
if (primitiveValue->primitiveType() != CSSPrimitiveValue::CSS_NUMBER)
return 0;
arrayParameter->addValue(primitiveValue->getDoubleValue());
}
return arrayParameter.release();
}
PassRefPtr<CustomFilterParameter> StyleResolver::parseCustomFilterNumberParameter(const String& name, CSSValueList* values)
{
RefPtr<CustomFilterNumberParameter> numberParameter = CustomFilterNumberParameter::create(name);
......@@ -5282,6 +5298,8 @@ PassRefPtr<CustomFilterParameter> StyleResolver::parseCustomFilterParameter(cons
// booleans: https://bugs.webkit.org/show_bug.cgi?id=76438
// textures: https://bugs.webkit.org/show_bug.cgi?id=71442
// mat2, mat3, mat4: https://bugs.webkit.org/show_bug.cgi?id=71444
// Number parameters are wrapped inside a CSSValueList and all
// the other functions values inherit from CSSValueList.
if (!parameterValue->isValueList())
return 0;
......@@ -5289,9 +5307,16 @@ PassRefPtr<CustomFilterParameter> StyleResolver::parseCustomFilterParameter(cons
if (!values->length())
return 0;
if (parameterValue->isWebKitCSSArrayFunctionValue())
return parseCustomFilterArrayParameter(name, values);
// If the first value of the list is a transform function,
// then we could safely assume that all the remaining items
// are transforms. parseCustomFilterTransformParameter will
// return 0 if that assumption is incorrect.
if (values->itemWithoutBoundsCheck(0)->isWebKitCSSTransformValue())
return parseCustomFilterTransformParameter(name, values);
// We can have only arrays of booleans or numbers, so use the first value to choose between those two.
// We need up to 4 values (all booleans or all numbers).
if (!values->itemWithoutBoundsCheck(0)->isPrimitiveValue() || values->length() > 4)
......
......@@ -261,6 +261,7 @@ public:
StyleShader* cachedOrPendingStyleShaderFromValue(WebKitCSSShaderValue*);
bool parseCustomFilterParameterList(CSSValue*, CustomFilterParameterList&);
PassRefPtr<CustomFilterParameter> parseCustomFilterParameter(const String& name, CSSValue*);
PassRefPtr<CustomFilterParameter> parseCustomFilterArrayParameter(const String& name, CSSValueList*);
PassRefPtr<CustomFilterParameter> parseCustomFilterNumberParameter(const String& name, CSSValueList*);
PassRefPtr<CustomFilterParameter> parseCustomFilterTransformParameter(const String& name, CSSValueList*);
PassRefPtr<CustomFilterOperation> createCustomFilterOperation(WebKitCSSFilterValue*);
......
/*
* Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef CustomFilterArrayParameter_h
#define CustomFilterArrayParameter_h
#if ENABLE(CSS_SHADERS)
#include "CustomFilterParameter.h"
#include <wtf/Vector.h>
namespace WebCore {
class CustomFilterArrayParameter : public CustomFilterParameter {
public:
static PassRefPtr<CustomFilterArrayParameter> create(const String& name)
{
return adoptRef(new CustomFilterArrayParameter(name));
}
unsigned size() const { return m_data.size(); }
double valueAt(unsigned index) const { return m_data.at(index); }
void addValue(double value) { m_data.append(value); }
virtual PassRefPtr<CustomFilterParameter> blend(const CustomFilterParameter* from, double progress, const LayoutSize&)
{
// FIXME: https://bugs.webkit.org/show_bug.cgi?id=96437
UNUSED_PARAM(from);
UNUSED_PARAM(progress);
return this;
}
virtual bool operator==(const CustomFilterParameter& o) const
{
if (!isSameType(o))
return false;
const CustomFilterArrayParameter* other = static_cast<const CustomFilterArrayParameter*>(&o);
return m_data == other->m_data;
}
private:
CustomFilterArrayParameter(const String& name)
: CustomFilterParameter(ARRAY, name)
{
}
Vector<double> m_data;
};
} // namespace WebCore
#endif // ENABLE(CSS_SHADERS)
#endif // CustomFilterArrayParameter_h
......@@ -45,6 +45,7 @@ public:
// 3d-transforms: https://bugs.webkit.org/show_bug.cgi?id=71443
// mat2, mat3, mat4: https://bugs.webkit.org/show_bug.cgi?id=71444
enum ParameterType {
ARRAY,
NUMBER,
TRANSFORM
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment