[CSS Shaders] Implement CustomFilterArrayParameter::blend

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

Reviewed by Dean Jackson.

Source/WebCore:

This patch adds the missing code to blend values within
an array() when using Custom Filters.

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

* platform/graphics/filters/CustomFilterArrayParameter.h:
(WebCore::CustomFilterArrayParameter::blend):

LayoutTests:

New tests to asses the correctness of CustomFilterArrayParameter::blend.

* animations/resources/animation-test-helpers.js:
(customFilterParameterMatch): A check for functions' parameters length has been added.
* css3/filters/custom/custom-filter-array-blending-expected.txt: Added.
* css3/filters/custom/custom-filter-array-blending.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132795 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 59908921
2012-10-29 Michelangelo De Simone <michelangelo@webkit.org>
[CSS Shaders] Implement CustomFilterArrayParameter::blend
https://bugs.webkit.org/show_bug.cgi?id=96437
Reviewed by Dean Jackson.
New tests to asses the correctness of CustomFilterArrayParameter::blend.
* animations/resources/animation-test-helpers.js:
(customFilterParameterMatch): A check for functions' parameters length has been added.
* css3/filters/custom/custom-filter-array-blending-expected.txt: Added.
* css3/filters/custom/custom-filter-array-blending.html: Added.
2012-10-29 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r132782.
......@@ -103,6 +103,10 @@ function customFilterParameterMatch(param1, param2, tolerance)
case "function":
if (val1.name != val2.name)
return false;
if (val1.arguments.length != val2.arguments.length) {
console.error("Arguments length mismatch: ", val1.arguments.length, "/", val2.arguments.length);
return false;
}
for (var t = 0; t < val1.arguments.length; ++t) {
if (val1.arguments[t].type != "number" || val2.arguments[t].type != "number")
return false;
......
PASS - "webkitFilter" property for "custom-blend-from-none-box" element at 1s saw something close to: custom(url(no-shader-needed.vs) none, 1 1 filter-box, arrayFromNoneAnim array(10, 20))
PASS - "webkitFilter" property for "custom-blend-to-none-box" element at 1s saw something close to: custom(url(no-shader-needed.vs) none, 1 1 filter-box, arrayToNoneAnim array(10, 20))
PASS - "webkitFilter" property for "custom-blend-single-element-box" element at 1s saw something close to: custom(url(no-shader-needed.vs) none, 1 1 filter-box, singleElementArray array(5))
PASS - "webkitFilter" property for "custom-blend-two-floats-box" element at 1s saw something close to: custom(url(no-shader-needed.vs) none, 1 1 filter-box, twoFloatsArray array(2, 6.4))
PASS - "webkitFilter" property for "custom-blend-multiple-elements-box" element at 1s saw something close to: custom(url(no-shader-needed.vs) none, 1 1 filter-box, multipleElementsArray array(5, 10, 5, 10, 5, 10, 5, 10, 5))
PASS - "webkitFilter" property for "custom-blend-first-longer-box" element at 1s saw something close to: custom(url(no-shader-needed.vs) none, 1 1 filter-box, firstLonger array(10, 10, 10, 10))
PASS - "webkitFilter" property for "custom-blend-second-longer-box" element at 1s saw something close to: custom(url(no-shader-needed.vs) none, 1 1 filter-box, secondLonger array(10, 10, 10, 10, 10))
<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner) {
window.testRunner.overridePreference("WebKitCSSCustomFilterEnabled", "1");
window.testRunner.overridePreference("WebKitWebGLEnabled", "1");
}
</script>
<style>
.box {
height: 100px;
width: 100px;
margin: 10px;
background-color: blue;
display: inline-block;
}
#custom-blend-from-none-box {
-webkit-animation: custom-blend-from-none-anim 2s linear;
}
#custom-blend-to-none-box {
-webkit-animation: custom-blend-to-none-anim 2s linear;
}
#custom-blend-single-element-box {
-webkit-animation: custom-blend-single-element-anim 2s linear;
}
#custom-blend-two-floats-box {
-webkit-animation: custom-blend-two-floats-anim 2s linear;
}
#custom-blend-multiple-elements-box {
-webkit-animation: custom-blend-multiple-elements-anim 2s linear;
}
#custom-blend-first-longer-box {
-webkit-animation: custom-blend-first-longer-anim 2s linear;
}
#custom-blend-second-longer-box {
-webkit-animation: custom-blend-second-longer-anim 2s linear;
}
@-webkit-keyframes custom-blend-from-none-anim {
from { -webkit-filter: custom(url(no-shader-needed.vs)); }
to { -webkit-filter: custom(url(no-shader-needed.vs), arrayFromNoneAnim array(10.0, 20.0)); }
}
@-webkit-keyframes custom-blend-to-none-anim {
from { -webkit-filter: custom(url(no-shader-needed.vs), arrayToNoneAnim array(10.0, 20.0)); }
to { -webkit-filter: custom(url(no-shader-needed.vs)); }
}
@-webkit-keyframes custom-blend-single-element-anim {
from { -webkit-filter: custom(url(no-shader-needed.vs), singleElementArray array(0)); }
to { -webkit-filter: custom(url(no-shader-needed.vs), singleElementArray array(10)); }
}
@-webkit-keyframes custom-blend-two-floats-anim {
from { -webkit-filter: custom(url(no-shader-needed.vs), twoFloatsArray array(1.01, 3.14)); }
to { -webkit-filter: custom(url(no-shader-needed.vs), twoFloatsArray array(3.03, 9.42)); }
}
@-webkit-keyframes custom-blend-multiple-elements-anim {
from { -webkit-filter: custom(url(no-shader-needed.vs), multipleElementsArray array(0, 0, 0, 0, 0, 0, 0, 0, 0)); }
to { -webkit-filter: custom(url(no-shader-needed.vs), multipleElementsArray array(10, 20, 10, 20, 10, 20, 10, 20, 10)); }
}
@-webkit-keyframes custom-blend-first-longer-anim {
from { -webkit-filter: custom(url(no-shader-needed.vs), firstLonger array(10, 10, 10, 10, 10)); }
to { -webkit-filter: custom(url(no-shader-needed.vs), firstLonger array(10, 10, 10, 10)); }
}
@-webkit-keyframes custom-blend-second-longer-anim {
from { -webkit-filter: custom(url(no-shader-needed.vs), secondLonger array(10, 10, 10, 10)); }
to { -webkit-filter: custom(url(no-shader-needed.vs), secondLonger array(10, 10, 10, 10, 10)); }
}
</style>
<script src="../resources/custom-filter-parser.js"></script>
<script src="../../../animations/resources/animation-test-helpers.js"></script>
<script type="text/javascript">
const expectedValues = [
// [animation-name, time, element-id, property, expected-value, tolerance]
["custom-blend-from-none-anim", 1, "custom-blend-from-none-box", "webkitFilter", 'custom(url(no-shader-needed.vs) none, 1 1 filter-box, arrayFromNoneAnim array(10, 20))', 2],
["custom-blend-to-none-anim", 1, "custom-blend-to-none-box", "webkitFilter", 'custom(url(no-shader-needed.vs) none, 1 1 filter-box, arrayToNoneAnim array(10, 20))', 2],
["custom-blend-single-element-anim", 1, "custom-blend-single-element-box", "webkitFilter", 'custom(url(no-shader-needed.vs) none, 1 1 filter-box, singleElementArray array(5))', 2],
["custom-blend-two-floats-anim", 1, "custom-blend-two-floats-box", "webkitFilter", 'custom(url(no-shader-needed.vs) none, 1 1 filter-box, twoFloatsArray array(2, 6.4))', 2],
["custom-blend-multiple-elements-anim", 1, "custom-blend-multiple-elements-box", "webkitFilter", 'custom(url(no-shader-needed.vs) none, 1 1 filter-box, multipleElementsArray array(5, 10, 5, 10, 5, 10, 5, 10, 5))', 4],
["custom-blend-first-longer-anim", 1, "custom-blend-first-longer-box", "webkitFilter", 'custom(url(no-shader-needed.vs) none, 1 1 filter-box, firstLonger array(10, 10, 10, 10))', 2],
["custom-blend-second-longer-anim", 1, "custom-blend-second-longer-box", "webkitFilter", 'custom(url(no-shader-needed.vs) none, 1 1 filter-box, secondLonger array(10, 10, 10, 10, 10))', 2]];
runAnimationTest(expectedValues);
</script>
</head>
<body>
<div class="box" id="custom-blend-from-none-box"></div>
<div class="box" id="custom-blend-to-none-box"></div>
<div class="box" id="custom-blend-single-element-box"></div>
<div class="box" id="custom-blend-two-floats-box"></div>
<div class="box" id="custom-blend-multiple-elements-box"></div>
<div class="box" id="custom-blend-first-longer-box"></div>
<div class="box" id="custom-blend-second-longer-box"></div>
<div id="result">
</div>
</body>
</html>
2012-10-29 Michelangelo De Simone <michelangelo@webkit.org>
[CSS Shaders] Implement CustomFilterArrayParameter::blend
https://bugs.webkit.org/show_bug.cgi?id=96437
Reviewed by Dean Jackson.
This patch adds the missing code to blend values within
an array() when using Custom Filters.
Test: css3/filters/custom/custom-filter-array-blending.html
* platform/graphics/filters/CustomFilterArrayParameter.h:
(WebCore::CustomFilterArrayParameter::blend):
2012-10-29 Alexander Pavlov <apavlov@chromium.org>
Web Inspector: Drag and drop a URL in inspector is not working as expected
......@@ -50,11 +50,19 @@ public:
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);
if (!from || !isSameType(*from))
return this;
return this;
const CustomFilterArrayParameter* fromArray = static_cast<const CustomFilterArrayParameter*>(from);
if (size() != fromArray->size())
return this;
RefPtr<CustomFilterArrayParameter> result = CustomFilterArrayParameter::create(name());
for (size_t i = 0; i < size(); ++i)
result->addValue(WebCore::blend(fromArray->valueAt(i), valueAt(i), progress));
return result.release();
}
virtual bool operator==(const CustomFilterParameter& o) const
......
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