Bug 119956 - Support animation of CSS gradients
: Support animation of CSS gradients
Status: NEW
Product: WebKit
Classification: Unclassified
Component: CSS
: 528+ (Nightly build)
: Unspecified Unspecified
: P2 Normal
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-17 11:33 PDT by Dirk Schulze
Modified: 2013-09-08 14:06 PDT (History)
10 users (show)

See Also:


Attachments
Rotating gradient example (404 bytes, text/html)
2013-08-19 03:41 PDT, Dirk Schulze
no flags Details
Patch (9.80 KB, patch)
2013-08-19 03:43 PDT, Dirk Schulze
no flags Details | Formatted Diff | Diff
Patch (23.57 KB, patch)
2013-09-08 14:03 PDT, Dirk Schulze
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Schulze 2013-08-17 11:33:25 PDT
Support animations of CSS gradients
Comment 1 Dirk Schulze 2013-08-19 03:41:16 PDT
Created attachment 209074 [details]
Rotating gradient example
Comment 2 Dirk Schulze 2013-08-19 03:43:39 PDT
Created attachment 209075 [details]
Patch

Wit this patch, linear gradient angles can be animated as well as colors from color-stops.

Animating the angle as described by the spec at the moment, leads to weird wonky looking gradients, since the gradient length gets shrinked on the edges and stretched on the corners.
Comment 3 WebKit Commit Bot 2013-08-19 03:45:17 PDT
Attachment 209075 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/css/CSSGradientValue.cpp', u'Source/WebCore/css/CSSGradientValue.h', u'Source/WebCore/page/animation/CSSPropertyAnimation.cpp']" exit_code: 1
Source/WebCore/page/animation/CSSPropertyAnimation.cpp:37:  Alphabetical sorting problem.  [build/include_order] [4]
Source/WebCore/css/CSSGradientValue.h:129:  The parameter name "to" adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 2 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Dirk Schulze 2013-08-21 07:45:45 PDT
I think the tasks can be divided into three parts that don't necessarily need to be done in one patch:

Animation of Colors,
Animation of Color stops (with the help of calc as requested by CSS specs)
Animation of Gradient direction/position

I am not particular keen about the last step, since that requires layout information that we might not have at animation time.

The first part should be very easy (done in the patch already) and the most important use case anyway.
Comment 5 Dirk Schulze 2013-09-08 14:03:37 PDT
Created attachment 210992 [details]
Patch

color-stop animation from the latest proposal on www-style. Interpolate unordered color-stop list and use calc() to blend different types. The patch cleans up CSSGradientValue.cpp quite a bit as well.
Comment 6 WebKit Commit Bot 2013-09-08 14:06:12 PDT
Attachment 210992 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/css/CSSGradientValue.cpp', u'Source/WebCore/css/CSSGradientValue.h', u'Source/WebCore/page/animation/CSSPropertyAnimation.cpp']" exit_code: 1
Source/WebCore/css/CSSGradientValue.cpp:145:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Source/WebCore/css/CSSGradientValue.h:129:  The parameter name "to" adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 2 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.