2010-08-29 Simon Fraser <simon.fraser@apple.com>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Aug 2010 23:16:21 +0000 (23:16 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Aug 2010 23:16:21 +0000 (23:16 +0000)
commit5956f7aea6e2796bdc07fab68d5a36b5cfc4fc37
treebd0a4075df3d3e1721239f68f7ab8ed95b349d92
parentb6353046ae3e183d66756b1397d002429287b34d
2010-08-29  Simon Fraser  <simon.fraser@apple.com>

        Reviewed by Darin Adler.

        When properties are missing from animation keyframes, interpolate between those keyframes that specify them
        https://bugs.webkit.org/show_bug.cgi?id=40794

        When a property does not appear in all keyframes of a keyframe animation, we currently use the
        value of that property from the unanimated style. That forces the author to use additional
        keyframes for properties that need to "skip a keyframe", which is laborious.

        With this change, properties are interpolated between the keyframes in which they appear.
        This is equivalent to splitting each property out into its own set of keyframes.

        Tests: animations/missing-keyframe-properties-repeating.html
               animations/missing-keyframe-properties-timing-function.html
               animations/missing-keyframe-properties.html

        * css/CSSStyleSelector.h:
        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::styleForKeyframe): Pass a KeyframeValue in so that we can
        collect which properties are represented per keyframe.
        (WebCore::CSSStyleSelector::keyframeStylesForAnimation): Keyframes are inserted into a
        KeyframeList by object now, rather than by key and style.

        * page/animation/AnimationBase.cpp:
        (WebCore::AnimationBase::progress): Use AnimationDirectionAlternate for readability.

        * page/animation/KeyframeAnimation.cpp:
        (WebCore::KeyframeAnimation::fetchIntervalEndpointsForProperty): Renamed from getKeyframeAnimationInterval.
        Use fractionalTime etc to match AnimationBase::progress(), and do lookups per-property.
        Simplify the code that finds the relevant keyframe to do less work.
        (WebCore::KeyframeAnimation::animate): Call fetchIntervalEndpointsForProperty() for each property, rather than just once for the
        entire keyframe.
        (WebCore::KeyframeAnimation::getAnimatedStyle): Ditto.
        (WebCore::KeyframeAnimation::hasAnimationForProperty): FIXME comment.

        * page/animation/KeyframeAnimation.h: Rename getKeyframeAnimationInterval() to fetchIntervalEndpointsForProperty().

        * rendering/RenderLayerBacking.cpp:
        (WebCore::RenderLayerBacking::startAnimation): For hardware animations, only insert values
        for keyframes which contain the property.

        (WebCore::KeyframeList::KeyframeList): insert() takes a KeyframeValue now.
        * rendering/style/KeyframeList.cpp:
        (WebCore::KeyframeList::operator==):
        (WebCore::KeyframeList::insert): Fix insert/replace logic, and ensure we maintain the
        m_properties hash.

        * rendering/style/KeyframeList.h:
        (WebCore::KeyframeValue::KeyframeValue): Make members private, with accessors.
        Add a m_properties HashSet for the properties animated in this keyframe.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@66339 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/animations/missing-from-to-transforms.html
LayoutTests/animations/missing-from-to.html
LayoutTests/animations/missing-keyframe-properties-expected.txt [new file with mode: 0644]
LayoutTests/animations/missing-keyframe-properties-repeating-expected.txt [new file with mode: 0644]
LayoutTests/animations/missing-keyframe-properties-repeating.html [new file with mode: 0644]
LayoutTests/animations/missing-keyframe-properties-timing-function-expected.txt [new file with mode: 0644]
LayoutTests/animations/missing-keyframe-properties-timing-function.html [new file with mode: 0644]
LayoutTests/animations/missing-keyframe-properties.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/css/CSSStyleSelector.cpp
WebCore/css/CSSStyleSelector.h
WebCore/page/animation/AnimationBase.cpp
WebCore/page/animation/KeyframeAnimation.cpp
WebCore/page/animation/KeyframeAnimation.h
WebCore/rendering/RenderLayerBacking.cpp
WebCore/rendering/style/KeyframeList.cpp
WebCore/rendering/style/KeyframeList.h