Enable animations of CSS images using -webkit-cross-fade
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Dec 2011 23:06:15 +0000 (23:06 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Dec 2011 23:06:15 +0000 (23:06 +0000)
commitecb552204d93e36d1affc4a648dc23bd6e2ddf48
tree772162c14979d583da313745ccb99a08daf04fc4
parentfa59e8d4818aa2c76bd08575580fe0c735dac2e4
Enable animations of CSS images using -webkit-cross-fade
https://bugs.webkit.org/show_bug.cgi?id=74049
<rdar://problem/10209303>

Reviewed by Simon Fraser.

Add support for animating CSS images in the following properties:
    - background(-image)
    - border-image(-source)
    - list-style(-image)
    - -webkit-mask-box-image(-source)
    - -webkit-mask-image(-source)

This patch only adds support for transitioning between NinePieceImages
where all of the properties except the image itself are equal, and the
size of the images are equal. Other cases will not animate.

Add animation blend functions for StyleImage and NinePieceImage.

Apply the proper compositing operation to -webkit-cross-fade, and
fix handling of the destination and source areas to support scaling.

Tests: animations/cross-fade-background-image.html
       animations/cross-fade-border-image-source.html
       animations/cross-fade-list-style-image.html
       animations/cross-fade-webkit-mask-box-image.html
       animations/cross-fade-webkit-mask-image.html

* css/CSSCrossfadeValue.cpp:
(WebCore::cachedImageForCSSValue):
(WebCore::CSSCrossfadeValue::fixedSize):
(WebCore::CSSCrossfadeValue::image):
* css/CSSImageValue.cpp:
(WebCore::CSSImageValue::CSSImageValue):
* css/CSSImageValue.h:
(WebCore::CSSImageValue::create):
* page/animation/AnimationBase.cpp:
(WebCore::crossfadeBlend):
(WebCore::blendFunc):
(WebCore::RefCountedPropertyWrapper::RefCountedPropertyWrapper):
(WebCore::RefCountedPropertyWrapper::blend):
(WebCore::FillLayerRefCountedPropertyWrapper::FillLayerRefCountedPropertyWrapper):
(WebCore::FillLayerRefCountedPropertyWrapper::blend):
(WebCore::FillLayersPropertyWrapper::FillLayersPropertyWrapper):
(WebCore::AnimationBase::ensurePropertyMap):
(WebCore::addShorthandProperties):
* platform/graphics/CrossfadeGeneratedImage.cpp:
(WebCore::CrossfadeGeneratedImage::drawCrossfade):
(WebCore::CrossfadeGeneratedImage::draw):
(WebCore::CrossfadeGeneratedImage::drawPattern):
* platform/graphics/CrossfadeGeneratedImage.h:
* rendering/style/RenderStyle.h:
(WebCore::InheritedFlags::setMaskImage):

Add tests of -webkit-animation (using -webkit-cross-fade) between:
    - background-image
    - border-image
    - list-style-image
    - -webkit-mask-box-image
    - -webkit-mask-image

Add the ability for animation tests to compare an animated element to a static element.

Add tests of -webkit-transition (using -webkit-cross-fade) between:
    - background-image
    - border-image

* animations/cross-fade-background-image-expected.txt: Added.
* animations/cross-fade-background-image.html: Added.
* animations/cross-fade-border-image-source-expected.txt: Added.
* animations/cross-fade-border-image-source.html: Added.
* animations/cross-fade-list-style-image-expected.txt: Added.
* animations/cross-fade-list-style-image.html: Added.
* animations/cross-fade-webkit-mask-box-image-expected.txt: Added.
* animations/cross-fade-webkit-mask-box-image.html: Added.
* animations/cross-fade-webkit-mask-image-expected.txt: Added.
* animations/cross-fade-webkit-mask-image.html: Added.
* animations/resources/animation-test-helpers.js:
(parseCrossFade):
(checkExpectedValue):
* animations/resources/blue-100.png: Added.
* animations/resources/green-100.png: Added.
* animations/resources/stripes-100.png: Added.
* platform/mac/animations/cross-fade-background-image-expected.png: Added.
* platform/mac/animations/cross-fade-border-image-source-expected.png: Added.
* platform/mac/animations/cross-fade-list-style-image-expected.png: Added.
* platform/mac/animations/cross-fade-webkit-mask-box-image-expected.png: Added.
* platform/mac/animations/cross-fade-webkit-mask-image-expected.png: Added.
* platform/mac/transitions/cross-fade-background-image-expected.png: Added.
* platform/mac/transitions/cross-fade-border-image-expected.png: Added.
* transitions/cross-fade-background-image-expected.txt: Added.
* transitions/cross-fade-background-image.html: Added.
* transitions/cross-fade-border-image-expected.txt: Added.
* transitions/cross-fade-border-image.html: Added.
* transitions/resources/transition-test-helpers.js:
(expected):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@102388 268f45cc-cd09-0410-ab3c-d52691b4dbfc
35 files changed:
LayoutTests/ChangeLog
LayoutTests/animations/cross-fade-background-image-expected.txt [new file with mode: 0644]
LayoutTests/animations/cross-fade-background-image.html [new file with mode: 0644]
LayoutTests/animations/cross-fade-border-image-source-expected.txt [new file with mode: 0644]
LayoutTests/animations/cross-fade-border-image-source.html [new file with mode: 0644]
LayoutTests/animations/cross-fade-list-style-image-expected.txt [new file with mode: 0644]
LayoutTests/animations/cross-fade-list-style-image.html [new file with mode: 0644]
LayoutTests/animations/cross-fade-webkit-mask-box-image-expected.txt [new file with mode: 0644]
LayoutTests/animations/cross-fade-webkit-mask-box-image.html [new file with mode: 0644]
LayoutTests/animations/cross-fade-webkit-mask-image-expected.txt [new file with mode: 0644]
LayoutTests/animations/cross-fade-webkit-mask-image.html [new file with mode: 0644]
LayoutTests/animations/resources/animation-test-helpers.js
LayoutTests/animations/resources/blue-100.png [new file with mode: 0644]
LayoutTests/animations/resources/green-100.png [new file with mode: 0644]
LayoutTests/animations/resources/stripes-100.png [new file with mode: 0644]
LayoutTests/platform/mac/animations/cross-fade-background-image-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/animations/cross-fade-border-image-source-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/animations/cross-fade-list-style-image-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/animations/cross-fade-webkit-mask-box-image-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/animations/cross-fade-webkit-mask-image-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/transitions/cross-fade-background-image-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/transitions/cross-fade-border-image-expected.png [new file with mode: 0644]
LayoutTests/transitions/cross-fade-background-image-expected.txt [new file with mode: 0644]
LayoutTests/transitions/cross-fade-background-image.html [new file with mode: 0644]
LayoutTests/transitions/cross-fade-border-image-expected.txt [new file with mode: 0644]
LayoutTests/transitions/cross-fade-border-image.html [new file with mode: 0644]
LayoutTests/transitions/resources/transition-test-helpers.js
Source/WebCore/ChangeLog
Source/WebCore/css/CSSCrossfadeValue.cpp
Source/WebCore/css/CSSImageValue.cpp
Source/WebCore/css/CSSImageValue.h
Source/WebCore/page/animation/AnimationBase.cpp
Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp
Source/WebCore/platform/graphics/CrossfadeGeneratedImage.h
Source/WebCore/rendering/style/RenderStyle.h