Skip to content
  • timothy_horton@apple.com's avatar
    Enable animations of CSS images using -webkit-cross-fade · ad938aae
    timothy_horton@apple.com authored
    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: http://svn.webkit.org/repository/webkit/trunk@102388 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    ad938aae