[CSS Shaders] Implement transform parameter animations for CSS Custom Filters
authorachicu@adobe.com <achicu@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Sep 2012 23:33:41 +0000 (23:33 +0000)
committerachicu@adobe.com <achicu@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Sep 2012 23:33:41 +0000 (23:33 +0000)
commit7c8bc45b917fa95f0434ca45d2a95786201b83be
tree7ea81e4223a885522c5fc787aeed9775dbf6a6be
parent00c3a9e11eac9c79376b1a966406e171198ff9c6
[CSS Shaders] Implement transform parameter animations for CSS Custom Filters
https://bugs.webkit.org/show_bug.cgi?id=94980

Reviewed by Dean Jackson.

Based on patch from Joshua Netterfield <jnetterfield@rim.com>.

Source/WebCore:

According to Section 39.2 of Filter Effects 1.0 Editor's draft
(https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html), animations
of transforms should be handled following the CSS3 transform interpolation
rules. This patch implements this functionality.

Test: css3/filters/custom/custom-filter-transforms-animation.html

* page/animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
(WebCore):
* platform/graphics/filters/CustomFilterNumberParameter.h:
(WebCore::CustomFilterNumberParameter::blend):
* platform/graphics/filters/CustomFilterOperation.cpp:
(WebCore::blendCustomFilterParameters):
(WebCore::CustomFilterOperation::blend):
* platform/graphics/filters/CustomFilterOperation.h:
(WebCore):
(WebCore::CustomFilterOperation::blendingNeedsRendererSize): Some filters need the box size, so that they could compute
Transforms. Right now only the CustomFilterOperation needs that, but I've implemented using this generic function.
(CustomFilterOperation):
* platform/graphics/filters/CustomFilterParameter.h:
(CustomFilterParameter):
* platform/graphics/filters/CustomFilterTransformParameter.h:
(CustomFilterTransformParameter):
(WebCore::CustomFilterTransformParameter::blend):
* platform/graphics/filters/FilterOperation.h:
(WebCore::FilterOperation::FilterOperation::blend):
(FilterOperation):
(WebCore::FilterOperation::FilterOperation::blendingNeedsRendererSize):
* platform/graphics/transforms/TransformOperations.cpp: Extracted the blending functions from CSSPropertyAnimation.cpp
so that they could be reused from other classes.
(WebCore::TransformOperations::blendByMatchingOperations):
(WebCore):
(WebCore::TransformOperations::blendByUsingMatrixInterpolation): Used when the TransformOperations do not match.
(WebCore::TransformOperations::blend): Uses when the caller doesn't know whether the TransformOperations match or not.
* platform/graphics/transforms/TransformOperations.h:
(TransformOperations):

LayoutTests:

Added test transform animations in css3/filters/custom/custom-filter-transform-animation.html.

* animations/resources/animation-test-helpers.js:
(customFilterParameterMatch): Extracted the parameter matching from filterParametersMatch and added function parameters matching.
This should work for all functions that have number parameters, ie. arrays, mat4 functions.

(filterParametersMatch):
* css3/filters/custom/custom-filter-transforms-animation-expected.txt: Added.
* css3/filters/custom/custom-filter-transforms-animation.html: Added.
* css3/filters/resources/custom-filter-parser.js: Fixed function parsing.
(TokenStream.prototype.skip):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@128380 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/animations/resources/animation-test-helpers.js
LayoutTests/css3/filters/custom/custom-filter-transforms-animation-expected.txt [new file with mode: 0644]
LayoutTests/css3/filters/custom/custom-filter-transforms-animation.html [new file with mode: 0644]
LayoutTests/css3/filters/resources/custom-filter-parser.js
Source/WebCore/ChangeLog
Source/WebCore/page/animation/CSSPropertyAnimation.cpp
Source/WebCore/platform/graphics/filters/CustomFilterNumberParameter.h
Source/WebCore/platform/graphics/filters/CustomFilterOperation.cpp
Source/WebCore/platform/graphics/filters/CustomFilterOperation.h
Source/WebCore/platform/graphics/filters/CustomFilterParameter.h
Source/WebCore/platform/graphics/filters/CustomFilterTransformParameter.h
Source/WebCore/platform/graphics/filters/FilterOperation.h
Source/WebCore/platform/graphics/transforms/TransformOperations.cpp
Source/WebCore/platform/graphics/transforms/TransformOperations.h