Changeset 55576 in webkit


Ignore:
Timestamp:
Mar 5, 2010 4:58:54 AM (14 years ago)
Author:
dino@apple.com
Message:

2010-03-05 Dean Jackson <dino@apple.com>

Reviewed by Simon Fraser and Chris Marrin.

Bug 26869: Add fill modes for CSS Animations
https://bugs.webkit.org/show_bug.cgi?id=26869

Tests: animations/fill-mode-removed.html

animations/fill-mode-transform.html
animations/fill-mode.html

  • css/CSSComputedStyleDeclaration.cpp:
  • css/CSSParser.cpp:
  • css/CSSParser.h:
  • css/CSSPropertyNames.in:
  • css/CSSStyleSelector.cpp:
  • css/CSSStyleSelector.h:
  • css/CSSValueKeywords.in:
    • parse, assign and retrieve the value of the new -webkit-animation-fill-mode property
  • page/animation/AnimationBase.cpp:
  • page/animation/AnimationBase.h:
    • new state in animation engine for a finished animation that is "filling" forwards in time. This allows the engine to keep the animation around and not revert to the old style.
    • update the timer code to indicate it doesn't need to keep animating if it is filling
    • now that animations can extend beyond their elapsed time, make sure progress works correctly with iteration counts
  • page/animation/KeyframeAnimation.cpp: (WebCore::KeyframeAnimation::animate):
    • ensure correct style value is returned at the right time by checking for fill mode

(WebCore::KeyframeAnimation::onAnimationEnd):

  • continue to send the end event, but only remove the animation if it isn't filling forwards
  • platform/animation/Animation.cpp:
  • platform/animation/Animation.h:
    • new fill mode member property
  • platform/animation/AnimationList.cpp:
    • ensure the fill mode is propagated to a list of style valus
  • platform/graphics/mac/GraphicsLayerCA.mm:
    • make hardware layers use Core Animation's fill mode
Location:
trunk
Files:
6 added
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r55574 r55576  
     12010-03-05  Dean Jackson  <dino@apple.com>
     2
     3        Reviewed by Simon Fraser and Chris Marrin.
     4
     5        Bug 26869: Add fill modes for CSS Animations
     6        https://bugs.webkit.org/show_bug.cgi?id=26869
     7
     8        Add tests for -webkit-animation-fill-mode property,
     9        and update existing computed style tests with the
     10        new property.
     11
     12        * animations/computed-style-expected.txt:
     13        * animations/computed-style.html:
     14        * animations/fill-mode-expected.txt: Added.
     15        * animations/fill-mode-removed-expected.txt: Added.
     16        * animations/fill-mode-removed.html: Added.
     17        * animations/fill-mode-transform-expected.txt: Added.
     18        * animations/fill-mode-transform.html: Added.
     19        * animations/fill-mode.html: Added.
     20        * animations/fill-unset-properties-expected.txt:
     21        * animations/fill-unset-properties.html:
     22        * fast/css/getComputedStyle/computed-style-expected.txt:
     23        * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
     24        * platform/mac/fast/css/getComputedStyle/computed-style-expected.txt:
     25        * platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
     26        * svg/css/getComputedStyle-basic-expected.txt:
     27
    1282010-03-05  Fumitoshi Ukai  <ukai@chromium.org>
    229
  • trunk/LayoutTests/animations/computed-style-expected.txt

    r40667 r55576  
    88PASS test1Style.webkitAnimationDuration is '10s'
    99PASS test2Style.webkitAnimationDuration is '5s, 2.5s'
     10PASS test1Style.webkitAnimationFillMode is 'backwards'
     11PASS test2Style.webkitAnimationFillMode is 'forwards, both'
    1012PASS test1Style.webkitAnimationIterationCount is '10'
    1113PASS test2Style.webkitAnimationIterationCount is '10, infinite'
  • trunk/LayoutTests/animations/computed-style.html

    r40667 r55576  
    1010        -webkit-animation-name: anim1;
    1111        -webkit-animation-duration: 10s;
     12        -webkit-animation-fill-mode: backwards;
    1213        -webkit-animation-iteration-count: 10;
    1314        -webkit-animation-timing-function: linear;
     
    2122        -webkit-animation-name: anim2, anim3;
    2223        -webkit-animation-duration: 5s, 2500ms;
     24        -webkit-animation-fill-mode: forwards, both;
    2325        -webkit-animation-iteration-count: 10, infinite;
    2426        -webkit-animation-timing-function: linear, ease-in-out;
     
    6163shouldBe("test2Style.webkitAnimationDuration", "'5s, 2.5s'");
    6264
     65shouldBe("test1Style.webkitAnimationFillMode", "'backwards'");
     66shouldBe("test2Style.webkitAnimationFillMode", "'forwards, both'");
     67
    6368shouldBe("test1Style.webkitAnimationIterationCount", "'10'");
    6469shouldBe("test2Style.webkitAnimationIterationCount", "'10, infinite'");
  • trunk/LayoutTests/animations/fill-unset-properties-expected.txt

    r38776 r55576  
    66Testing webkitAnimationDuration: PASS
    77Testing webkitAnimationDelay: PASS
     8Testing webkitAnimationFillMode: PASS
    89
  • trunk/LayoutTests/animations/fill-unset-properties.html

    r38776 r55576  
    1414    -webkit-animation-duration: 10s, 20s;
    1515    -webkit-animation-delay: 1s;
     16    -webkit-animation-fill-mode: forwards, backwards;
    1617}
    1718@-webkit-keyframes a { }
     
    3334      { 'property': 'webkitAnimationDuration',  'value': '10s, 20s, 10s, 20s, 10s' },
    3435      { 'property': 'webkitAnimationDelay',     'value': '1s, 1s, 1s, 1s, 1s' },
     36      { 'property': 'webkitAnimationFillMode',  'value': 'forwards, backwards, forwards, backwards, forwards' },
    3537    ];
    3638   
  • trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt

    r46287 r55576  
    8787-webkit-animation-direction: normal;
    8888-webkit-animation-duration: 0s;
     89-webkit-animation-fill-mode: none;
    8990-webkit-animation-iteration-count: 1;
    9091-webkit-animation-name: none;
  • trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt

    r46287 r55576  
    8686    -webkit-animation-direction: normal
    8787    -webkit-animation-duration: 0s
     88    -webkit-animation-fill-mode: none
    8889    -webkit-animation-iteration-count: 1
    8990    -webkit-animation-name: none
  • trunk/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-expected.txt

    r53157 r55576  
    9797-webkit-animation-direction: normal;
    9898-webkit-animation-duration: 0s;
     99-webkit-animation-fill-mode: none;
    99100-webkit-animation-iteration-count: 1;
    100101-webkit-animation-name: none;
  • trunk/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt

    r53157 r55576  
    9696    -webkit-animation-direction: normal
    9797    -webkit-animation-duration: 0s
     98    -webkit-animation-fill-mode: none
    9899    -webkit-animation-iteration-count: 1
    99100    -webkit-animation-name: none
  • trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt

    r53157 r55576  
    191191rect: style.getPropertyValue(-webkit-animation-duration) : 0s
    192192rect: style.getPropertyCSSValue(-webkit-animation-duration) : [object CSSValueList]
     193rect: style.getPropertyValue(-webkit-animation-fill-mode) : none
     194rect: style.getPropertyCSSValue(-webkit-animation-fill-mode) : [object CSSValueList]
    193195rect: style.getPropertyValue(-webkit-animation-iteration-count) : 1
    194196rect: style.getPropertyCSSValue(-webkit-animation-iteration-count) : [object CSSValueList]
     
    605607g: style.getPropertyValue(-webkit-animation-duration) : 0s
    606608g: style.getPropertyCSSValue(-webkit-animation-duration) : [object CSSValueList]
     609g: style.getPropertyValue(-webkit-animation-fill-mode) : none
     610g: style.getPropertyCSSValue(-webkit-animation-fill-mode) : [object CSSValueList]
    607611g: style.getPropertyValue(-webkit-animation-iteration-count) : 1
    608612g: style.getPropertyCSSValue(-webkit-animation-iteration-count) : [object CSSValueList]
  • trunk/WebCore/ChangeLog

    r55575 r55576  
     12010-03-05  Dean Jackson  <dino@apple.com>
     2
     3        Reviewed by Simon Fraser and Chris Marrin.
     4
     5        Bug 26869: Add fill modes for CSS Animations
     6        https://bugs.webkit.org/show_bug.cgi?id=26869
     7
     8        Tests: animations/fill-mode-removed.html
     9               animations/fill-mode-transform.html
     10               animations/fill-mode.html
     11
     12        * css/CSSComputedStyleDeclaration.cpp:
     13        * css/CSSParser.cpp:
     14        * css/CSSParser.h:
     15        * css/CSSPropertyNames.in:
     16        * css/CSSStyleSelector.cpp:
     17        * css/CSSStyleSelector.h:
     18        * css/CSSValueKeywords.in:
     19            - parse, assign and retrieve the value of the new
     20              -webkit-animation-fill-mode property
     21        * page/animation/AnimationBase.cpp:
     22        * page/animation/AnimationBase.h:
     23            - new state in animation engine for a finished animation
     24              that is "filling" forwards in time. This allows the
     25              engine to keep the animation around and not revert to the
     26              old style.
     27            - update the timer code to indicate it doesn't need to
     28              keep animating if it is filling
     29            - now that animations can extend beyond their elapsed time,
     30              make sure progress works correctly with iteration counts
     31        * page/animation/KeyframeAnimation.cpp:
     32        (WebCore::KeyframeAnimation::animate):
     33            - ensure correct style value is returned at the right
     34              time by checking for fill mode
     35        (WebCore::KeyframeAnimation::onAnimationEnd):
     36            - continue to send the end event, but only remove the
     37              animation if it isn't filling forwards
     38        * platform/animation/Animation.cpp:
     39        * platform/animation/Animation.h:
     40            - new fill mode member property
     41        * platform/animation/AnimationList.cpp:
     42            - ensure the fill mode is propagated to a list of style valus
     43        * platform/graphics/mac/GraphicsLayerCA.mm:
     44            - make hardware layers use Core Animation's fill mode
     45
    1462010-03-05  Ilya Tikhonovsky  <loislo@chromium.org>
    247
  • trunk/WebCore/css/CSSComputedStyleDeclaration.cpp

    r53450 r55576  
    147147    CSSPropertyWebkitAnimationDirection,
    148148    CSSPropertyWebkitAnimationDuration,
     149    CSSPropertyWebkitAnimationFillMode,
    149150    CSSPropertyWebkitAnimationIterationCount,
    150151    CSSPropertyWebkitAnimationName,
     
    11991200        case CSSPropertyWebkitAnimationDuration:
    12001201            return getDurationValue(style->animations());
     1202        case CSSPropertyWebkitAnimationFillMode: {
     1203            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
     1204            const AnimationList* t = style->animations();
     1205            if (t) {
     1206                for (size_t i = 0; i < t->size(); ++i) {
     1207                    switch (t->animation(i)->fillMode()) {
     1208                    case Animation::AnimationFillModeNone:
     1209                        list->append(CSSPrimitiveValue::createIdentifier(CSSValueNone));
     1210                        break;
     1211                    case Animation::AnimationFillModeForwards:
     1212                        list->append(CSSPrimitiveValue::createIdentifier(CSSValueForwards));
     1213                        break;
     1214                    case Animation::AnimationFillModeBackwards:
     1215                        list->append(CSSPrimitiveValue::createIdentifier(CSSValueBackwards));
     1216                        break;
     1217                    case Animation::AnimationFillModeBoth:
     1218                        list->append(CSSPrimitiveValue::createIdentifier(CSSValueBoth));
     1219                        break;
     1220                    }
     1221                }
     1222            } else
     1223                list->append(CSSPrimitiveValue::createIdentifier(CSSValueNone));
     1224            return list.release();
     1225        }
    12011226        case CSSPropertyWebkitAnimationIterationCount: {
    12021227            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
  • trunk/WebCore/css/CSSParser.cpp

    r55308 r55576  
    13941394    case CSSPropertyWebkitAnimationDirection:
    13951395    case CSSPropertyWebkitAnimationDuration:
     1396    case CSSPropertyWebkitAnimationFillMode:
    13961397    case CSSPropertyWebkitAnimationName:
    13971398    case CSSPropertyWebkitAnimationPlayState:
     
    25722573}
    25732574
     2575PassRefPtr<CSSValue> CSSParser::parseAnimationFillMode()
     2576{
     2577    CSSParserValue* value = m_valueList->current();
     2578    if (value->id == CSSValueNone || value->id == CSSValueForwards || value->id == CSSValueBackwards || value->id == CSSValueBoth)
     2579        return CSSPrimitiveValue::createIdentifier(value->id);
     2580    return 0;
     2581}
     2582
    25742583PassRefPtr<CSSValue> CSSParser::parseAnimationIterationCount()
    25752584{
     
    27112720                case CSSPropertyWebkitTransitionDuration:
    27122721                    currValue = parseAnimationDuration();
     2722                    if (currValue)
     2723                        m_valueList->next();
     2724                    break;
     2725                case CSSPropertyWebkitAnimationFillMode:
     2726                    currValue = parseAnimationFillMode();
    27132727                    if (currValue)
    27142728                        m_valueList->next();
  • trunk/WebCore/css/CSSParser.h

    r52784 r55576  
    9696        PassRefPtr<CSSValue> parseAnimationDirection();
    9797        PassRefPtr<CSSValue> parseAnimationDuration();
     98        PassRefPtr<CSSValue> parseAnimationFillMode();
    9899        PassRefPtr<CSSValue> parseAnimationIterationCount();
    99100        PassRefPtr<CSSValue> parseAnimationName();
  • trunk/WebCore/css/CSSPropertyNames.in

    r50760 r55576  
    152152-webkit-animation-direction
    153153-webkit-animation-duration
     154-webkit-animation-fill-mode
    154155-webkit-animation-iteration-count
    155156-webkit-animation-name
  • trunk/WebCore/css/CSSStyleSelector.cpp

    r55359 r55576  
    52925292        HANDLE_ANIMATION_VALUE(duration, Duration, value)
    52935293        return;
     5294    case CSSPropertyWebkitAnimationFillMode:
     5295        HANDLE_ANIMATION_VALUE(fillMode, FillMode, value)
     5296        return;
    52945297    case CSSPropertyWebkitAnimationIterationCount:
    52955298        HANDLE_ANIMATION_VALUE(iterationCount, IterationCount, value)
     
    56495652    else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_MS)
    56505653        animation->setDuration(primitiveValue->getFloatValue()/1000.0f);
     5654}
     5655
     5656void CSSStyleSelector::mapAnimationFillMode(Animation* layer, CSSValue* value)
     5657{
     5658    if (value->cssValueType() == CSSValue::CSS_INITIAL) {
     5659        layer->setFillMode(Animation::initialAnimationFillMode());
     5660        return;
     5661    }
     5662
     5663    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     5664    switch (primitiveValue->getIdent()) {
     5665    case CSSValueNone:
     5666        layer->setFillMode(Animation::AnimationFillModeNone);
     5667        break;
     5668    case CSSValueForwards:
     5669        layer->setFillMode(Animation::AnimationFillModeForwards);
     5670        break;
     5671    case CSSValueBackwards:
     5672        layer->setFillMode(Animation::AnimationFillModeBackwards);
     5673        break;
     5674    case CSSValueBoth:
     5675        layer->setFillMode(Animation::AnimationFillModeBoth);
     5676        break;
     5677    }
    56515678}
    56525679
  • trunk/WebCore/css/CSSStyleSelector.h

    r54834 r55576  
    236236        void mapAnimationDirection(Animation*, CSSValue*);
    237237        void mapAnimationDuration(Animation*, CSSValue*);
     238        void mapAnimationFillMode(Animation*, CSSValue*);
    238239        void mapAnimationIterationCount(Animation*, CSSValue*);
    239240        void mapAnimationName(Animation*, CSSValue*);
  • trunk/WebCore/css/CSSValueKeywords.in

    r54472 r55576  
    640640
    641641#
     642# CSS_PROP__WEBKIT_ANIMATION_FILL_MODE
     643#
     644# forwards
     645# backwards
     646# both
     647
     648#
    642649# CSS_PROP__WEBKIT_ANIMATION_ITERATION_COUNT
    643650#
  • trunk/WebCore/page/animation/AnimationBase.cpp

    r54106 r55576  
    919919    switch (m_animState) {
    920920        case AnimationStateNew:
    921             ASSERT(input == AnimationStateInputStartAnimation || input == AnimationStateInputPlayStateRunnning || input == AnimationStateInputPlayStatePaused);
    922             if (input == AnimationStateInputStartAnimation || input == AnimationStateInputPlayStateRunnning) {
     921            ASSERT(input == AnimationStateInputStartAnimation || input == AnimationStateInputPlayStateRunning || input == AnimationStateInputPlayStatePaused);
     922            if (input == AnimationStateInputStartAnimation || input == AnimationStateInputPlayStateRunning) {
    923923                m_requestedStartTime = beginAnimationUpdateTime();
    924924                m_animState = AnimationStateStartWaitTimer;
     
    10221022
    10231023            if (input == AnimationStateInputEndTimerFired) {
     1024
    10241025                ASSERT(param >= 0);
    10251026                // End timer fired, finish up
     
    10291030               
    10301031                if (m_object) {
    1031                     resumeOverriddenAnimations();
     1032                    if (m_animation->fillsForwards())
     1033                        m_animState = AnimationStateFillingForwards;
     1034                    else
     1035                        resumeOverriddenAnimations();
    10321036
    10331037                    // Fire off another style change so we can set the final value
     
    10431047            break;
    10441048        case AnimationStatePausedWaitTimer:
    1045             ASSERT(input == AnimationStateInputPlayStateRunnning);
     1049            ASSERT(input == AnimationStateInputPlayStateRunning);
    10461050            ASSERT(paused());
    10471051            // Update the times
     
    10591063            // When the AnimationStateInputStartTimeSet comes in and we were in AnimationStatePausedRun, we will notice
    10601064            // that we have already set the startTime and will ignore it.
    1061             ASSERT(input == AnimationStateInputPlayStateRunnning || input == AnimationStateInputStartTimeSet);
     1065            ASSERT(input == AnimationStateInputPlayStateRunning || input == AnimationStateInputStartTimeSet);
    10621066            ASSERT(paused());
    10631067           
     
    10941098            }
    10951099            break;
     1100        case AnimationStateFillingForwards:
    10961101        case AnimationStateDone:
    10971102            // We're done. Stay in this state until we are deleted
     
    11531158{
    11541159    if (paused() == run || isNew())
    1155         updateStateMachine(run ? AnimationStateInputPlayStateRunnning : AnimationStateInputPlayStatePaused, -1);
     1160        updateStateMachine(run ? AnimationStateInputPlayStateRunning : AnimationStateInputPlayStatePaused, -1);
    11561161}
    11571162
     
    11601165    // Returns the time at which next service is required. -1 means no service is required. 0 means
    11611166    // service is required now, and > 0 means service is required that many seconds in the future.
    1162     if (paused() || isNew())
     1167    if (paused() || isNew() || m_animState == AnimationStateFillingForwards)
    11631168        return -1;
    11641169   
     
    11851190        dur *= m_animation->iterationCount();
    11861191
    1187     if (postActive() || !m_animation->duration() || (m_animation->iterationCount() > 0 && elapsedTime >= dur))
     1192    if (postActive() || !m_animation->duration())
    11881193        return 1.0;
     1194    if (m_animation->iterationCount() > 0 && elapsedTime >= dur)
     1195        return (m_animation->iterationCount() % 2) ? 1.0 : 0.0;
    11891196
    11901197    // Compute the fractional time, taking into account direction.
  • trunk/WebCore/page/animation/AnimationBase.h

    r52017 r55576  
    7272        AnimationStatePausedWaitResponse,   // animation paused when in STARTING state
    7373        AnimationStatePausedRun,            // animation paused when in LOOPING or ENDING state
    74         AnimationStateDone                  // end timer fired, animation finished and removed
     74        AnimationStateDone,                 // end timer fired, animation finished and removed
     75        AnimationStateFillingForwards       // animation has ended and is retaining its final value
    7576    };
    7677
     
    8687        AnimationStateInputPauseOverride,     // pause an animation due to override
    8788        AnimationStateInputResumeOverride,    // resume an overridden animation
    88         AnimationStateInputPlayStateRunnning, // play state paused -> running
     89        AnimationStateInputPlayStateRunning, // play state paused -> running
    8990        AnimationStateInputPlayStatePaused,   // play state running -> paused
    9091        AnimationStateInputEndAnimation       // force an end from any state
  • trunk/WebCore/page/animation/KeyframeAnimation.cpp

    r52618 r55576  
    121121
    122122    // If we are waiting for the start timer, we don't want to change the style yet.
    123     // Special case - if the delay time is 0, then we do want to set the first frame of the
     123    // Special case 1 - if the delay time is 0, then we do want to set the first frame of the
    124124    // animation right away. This avoids a flash when the animation starts.
    125     if (waitingToStart() && m_animation->delay() > 0)
     125    // Special case 2 - if there is a backwards fill mode, then we want to continue
     126    // through to the style blend so that we get the fromStyle.
     127    if (waitingToStart() && m_animation->delay() > 0 && !m_animation->fillsBackwards())
    126128        return;
    127129
     
    261263{
    262264    sendAnimationEvent(eventNames().webkitAnimationEndEvent, elapsedTime);
    263     endAnimation();
     265    // End the animation if we don't fill forwards. Forward filling
     266    // animations are ended properly in the class destructor.
     267    if (!m_animation->fillsForwards())
     268        endAnimation();
    264269}
    265270
  • trunk/WebCore/platform/animation/Animation.cpp

    r40923 r55576  
    3333    , m_timingFunction(initialAnimationTimingFunction())
    3434    , m_direction(initialAnimationDirection())
     35    , m_fillMode(initialAnimationFillMode())
    3536    , m_playState(initialAnimationPlayState())
    3637    , m_delaySet(false)
    3738    , m_directionSet(false)
    3839    , m_durationSet(false)
     40    , m_fillModeSet(false)
    3941    , m_iterationCountSet(false)
    4042    , m_nameSet(false)
     
    5557    , m_timingFunction(o.m_timingFunction)
    5658    , m_direction(o.m_direction)
     59    , m_fillMode(o.m_fillMode)
    5760    , m_playState(o.m_playState)
    5861    , m_delaySet(o.m_delaySet)
    5962    , m_directionSet(o.m_directionSet)
    6063    , m_durationSet(o.m_durationSet)
     64    , m_fillModeSet(o.m_fillModeSet)
    6165    , m_iterationCountSet(o.m_iterationCountSet)
    6266    , m_nameSet(o.m_nameSet)
     
    7781    m_timingFunction = o.m_timingFunction;
    7882    m_direction = o.m_direction;
     83    m_fillMode = o.m_fillMode;
    7984    m_playState = o.m_playState;
    8085
     
    8287    m_directionSet = o.m_directionSet;
    8388    m_durationSet = o.m_durationSet;
     89    m_fillModeSet = o.m_fillModeSet;
    8490    m_iterationCountSet = o.m_iterationCountSet;
    8591    m_nameSet = o.m_nameSet;
     
    108114                  m_timingFunction == o->m_timingFunction &&
    109115                  m_direction == o->m_direction &&
     116                  m_fillMode == o->m_fillMode &&
    110117                  m_delaySet == o->m_delaySet &&
    111118                  m_directionSet == o->m_directionSet &&
    112119                  m_durationSet == o->m_durationSet &&
     120                  m_fillModeSet == o->m_fillModeSet &&
    113121                  m_iterationCountSet == o->m_iterationCountSet &&
    114122                  m_nameSet == o->m_nameSet &&
  • trunk/WebCore/platform/animation/Animation.h

    r46547 r55576  
    4545    bool isDirectionSet() const { return m_directionSet; }
    4646    bool isDurationSet() const { return m_durationSet; }
     47    bool isFillModeSet() const { return m_fillModeSet; }
    4748    bool isIterationCountSet() const { return m_iterationCountSet; }
    4849    bool isNameSet() const { return m_nameSet; }
     
    5960    bool isEmpty() const
    6061    {
    61         return (!m_directionSet && !m_durationSet && !m_nameSet && !m_playStateSet &&
    62                !m_iterationCountSet && !m_delaySet && !m_timingFunctionSet && !m_propertySet);
     62        return (!m_directionSet && !m_durationSet && !m_fillModeSet
     63                && !m_nameSet && !m_playStateSet && !m_iterationCountSet
     64                && !m_delaySet && !m_timingFunctionSet && !m_propertySet);
    6365    }
    6466
     
    7173    void clearDirection() { m_directionSet = false; }
    7274    void clearDuration() { m_durationSet = false; }
     75    void clearFillMode() { m_fillModeSet = false; }
    7376    void clearIterationCount() { m_iterationCountSet = false; }
    7477    void clearName() { m_nameSet = false; }
     
    8184    enum AnimationDirection { AnimationDirectionNormal, AnimationDirectionAlternate };
    8285    AnimationDirection direction() const { return m_direction; }
     86
     87    enum AnimationFillMode { AnimationFillModeNone, AnimationFillModeForwards, AnimationFillModeBackwards, AnimationFillModeBoth };
     88    AnimationFillMode fillMode() const { return m_fillMode; }
    8389
    8490    double duration() const { return m_duration; }
     
    94100    void setDirection(AnimationDirection d) { m_direction = d; m_directionSet = true; }
    95101    void setDuration(double d) { ASSERT(d >= 0); m_duration = d; m_durationSet = true; }
     102    void setFillMode(AnimationFillMode f) { m_fillMode = f; m_fillModeSet = true; }
    96103    void setIterationCount(int c) { m_iterationCount = c; m_iterationCountSet = true; }
    97104    void setName(const String& n) { m_name = n; m_nameSet = true; }
     
    111118    bool operator!=(const Animation& o) const { return !(*this == o); }
    112119
     120    bool fillsBackwards() const { return m_fillModeSet && (m_fillMode == AnimationFillModeBackwards || m_fillMode == AnimationFillModeBoth); }
     121    bool fillsForwards() const { return m_fillModeSet && (m_fillMode == AnimationFillModeForwards || m_fillMode == AnimationFillModeBoth); }
     122
    113123private:
    114124    Animation();
     
    122132    TimingFunction m_timingFunction;
    123133    AnimationDirection m_direction : 1;
     134    AnimationFillMode m_fillMode : 2;
    124135
    125136    unsigned m_playState     : 2;
     
    128139    bool m_directionSet      : 1;
    129140    bool m_durationSet       : 1;
     141    bool m_fillModeSet       : 1;
    130142    bool m_iterationCountSet : 1;
    131143    bool m_nameSet           : 1;
     
    140152    static AnimationDirection initialAnimationDirection() { return AnimationDirectionNormal; }
    141153    static double initialAnimationDuration() { return 0; }
     154    static AnimationFillMode initialAnimationFillMode() { return AnimationFillModeNone; }
    142155    static int initialAnimationIterationCount() { return 1; }
    143156    static String initialAnimationName() { return String("none"); }
  • trunk/WebCore/platform/animation/AnimationList.cpp

    r39382 r55576  
    3838    FILL_UNSET_PROPERTY(isDirectionSet, direction, setDirection);
    3939    FILL_UNSET_PROPERTY(isDurationSet, duration, setDuration);
     40    FILL_UNSET_PROPERTY(isFillModeSet, fillMode, setFillMode);
    4041    FILL_UNSET_PROPERTY(isIterationCountSet, iterationCount, setIterationCount);
    4142    FILL_UNSET_PROPERTY(isPlayStateSet, playState, setPlayState);
  • trunk/WebCore/platform/graphics/mac/GraphicsLayerCA.mm

    r55412 r55576  
    18601860        repeatCount /= 2;
    18611861
     1862    NSString* fillMode = 0;
     1863    switch (anim->fillMode()) {
     1864    case Animation::AnimationFillModeNone:
     1865        fillMode = kCAFillModeRemoved;
     1866        break;
     1867    case Animation::AnimationFillModeBackwards:
     1868        fillMode = kCAFillModeBackwards;
     1869        break;
     1870    case Animation::AnimationFillModeForwards:
     1871       fillMode = kCAFillModeForwards;
     1872       break;
     1873    case Animation::AnimationFillModeBoth:
     1874       fillMode = kCAFillModeBoth;
     1875       break;
     1876    }
     1877
    18621878    [propertyAnim setDuration:duration];
    18631879    [propertyAnim setRepeatCount:repeatCount];
     
    18651881    [propertyAnim setRemovedOnCompletion:NO];
    18661882    [propertyAnim setAdditive:additive];
    1867     [propertyAnim setFillMode:@"extended"];
     1883    [propertyAnim setFillMode:fillMode];
    18681884
    18691885    [propertyAnim setDelegate:m_animationDelegate.get()];
Note: See TracChangeset for help on using the changeset viewer.