Changeset 107162 in webkit
- Timestamp:
- Feb 8, 2012 6:07:11 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r107160 r107162 1 2012-02-08 Igor Oliveira <igor.o@sisa.samsung.com> 2 3 Implement reverse animation direction 4 https://bugs.webkit.org/show_bug.cgi?id=60525 5 6 Add test for the new animation-direction values. 7 8 Reviewed by Dean Jackson. 9 10 * animations/animation-direction-alternate-reverse-expected.txt: Added. 11 * animations/animation-direction-alternate-reverse.html: Added. 12 * animations/animation-direction-reverse-expected.txt: Added. 13 * animations/animation-direction-reverse.html: Added. 14 * animations/fill-mode-reverse-expected.txt: Added. 15 * animations/fill-mode-reverse.html: Added. 16 1 17 2012-02-08 David Hyatt <hyatt@apple.com> 2 18 -
trunk/Source/WebCore/ChangeLog
r107161 r107162 1 2012-02-08 Igor Oliveira <igor.o@sisa.samsung.com> 2 3 Implement reverse animation direction 4 5 Implement reverse animation direction 6 https://bugs.webkit.org/show_bug.cgi?id=60525 7 8 Implement reverse and alternate-reverse direction. 9 10 Reviewed by Dean Jackson. 11 12 Tests: animations/animation-direction-alternate-reverse.html 13 animations/animation-direction-reverse.html 14 animations/fill-mode-reverse.html 15 16 * css/CSSParser.cpp: 17 (WebCore::CSSParser::parseAnimationDirection): 18 * css/CSSStyleSelector.cpp: 19 (WebCore::CSSStyleSelector::mapAnimationDirection): 20 * css/CSSValueKeywords.in: 21 * page/WebKitAnimation.cpp: 22 (WebCore::WebKitAnimation::direction): 23 * page/WebKitAnimation.h: 24 * page/animation/AnimationBase.cpp: 25 (WebCore::AnimationBase::fractionalTime): 26 * platform/animation/Animation.h: 27 (Animation): 28 * platform/graphics/texmap/TextureMapperAnimation.cpp: 29 (WebCore): 30 (WebCore::shouldReverseAnimationValue): 31 (WebCore::normalizedAnimationValue): 32 1 33 2012-02-08 James Robinson <jamesr@chromium.org> 2 34 -
trunk/Source/WebCore/css/CSSParser.cpp
r107030 r107162 3377 3377 { 3378 3378 CSSParserValue* value = m_valueList->current(); 3379 if (value->id == CSSValueNormal || value->id == CSSValueAlternate )3379 if (value->id == CSSValueNormal || value->id == CSSValueAlternate || value->id == CSSValueReverse || value->id == CSSValueAlternateReverse) 3380 3380 return cssValuePool()->createIdentifierValue(value->id); 3381 3381 return 0; -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r107112 r107162 4319 4319 4320 4320 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); 4321 layer->setDirection(primitiveValue->getIdent() == CSSValueAlternate ? Animation::AnimationDirectionAlternate : Animation::AnimationDirectionNormal); 4321 switch (primitiveValue->getIdent()) { 4322 case CSSValueNormal: 4323 layer->setDirection(Animation::AnimationDirectionNormal); 4324 break; 4325 case CSSValueAlternate: 4326 layer->setDirection(Animation::AnimationDirectionAlternate); 4327 break; 4328 case CSSValueReverse: 4329 layer->setDirection(Animation::AnimationDirectionReverse); 4330 break; 4331 case CSSValueAlternateReverse: 4332 layer->setDirection(Animation::AnimationDirectionAlternateReverse); 4333 break; 4334 } 4322 4335 } 4323 4336 -
trunk/Source/WebCore/css/CSSValueKeywords.in
r106980 r107162 701 701 // alternate 702 702 703 alternate-reverse 704 703 705 // 704 706 // CSS_PROP__WEBKIT_ANIMATION_FILL_MODE -
trunk/Source/WebCore/page/WebKitAnimation.cpp
r94823 r107162 85 85 WebKitAnimation::Direction WebKitAnimation::direction() const 86 86 { 87 if (m_keyframeAnimation->animation()->direction() == Animation::AnimationDirectionNormal) 87 switch (m_keyframeAnimation->animation()->direction()) { 88 case Animation::AnimationDirectionNormal: 88 89 return DIRECTION_NORMAL; 89 return DIRECTION_ALTERNATE; 90 case Animation::AnimationDirectionAlternate: 91 return DIRECTION_ALTERNATE; 92 case Animation::AnimationDirectionReverse: 93 return DIRECTION_REVERSE; 94 case Animation::AnimationDirectionAlternateReverse: 95 return DIRECTION_ALTERNATE_REVERSE; 96 } 97 ASSERT_NOT_REACHED(); 98 return DIRECTION_NORMAL; 90 99 } 91 100 -
trunk/Source/WebCore/page/WebKitAnimation.h
r80846 r107162 60 60 61 61 // direction 62 enum Direction { DIRECTION_NORMAL, DIRECTION_ALTERNATE };62 enum Direction { DIRECTION_NORMAL, DIRECTION_ALTERNATE, DIRECTION_REVERSE, DIRECTION_ALTERNATE_REVERSE }; 63 63 Direction direction() const; 64 64 -
trunk/Source/WebCore/page/animation/AnimationBase.cpp
r105901 r107162 1674 1674 fractionalTime -= integralTime; 1675 1675 1676 if ((m_animation->direction() == Animation::AnimationDirectionAlternate) && (integralTime & 1)) 1676 if (((m_animation->direction() == Animation::AnimationDirectionAlternate) && (integralTime & 1)) 1677 || ((m_animation->direction() == Animation::AnimationDirectionAlternateReverse) && !(integralTime & 1)) 1678 || m_animation->direction() == Animation::AnimationDirectionReverse) 1677 1679 fractionalTime = 1 - fractionalTime; 1678 1680 -
trunk/Source/WebCore/platform/animation/Animation.h
r95901 r107162 43 43 static PassRefPtr<Animation> create() { return adoptRef(new Animation); } 44 44 static PassRefPtr<Animation> create(const Animation* o) { return adoptRef(new Animation(*o)); } 45 45 46 46 bool isDelaySet() const { return m_delaySet; } 47 47 bool isDirectionSet() const { return m_directionSet; } … … 97 97 double delay() const { return m_delay; } 98 98 99 enum AnimationDirection { AnimationDirectionNormal, AnimationDirectionAlternate }; 99 enum AnimationDirection { 100 AnimationDirectionNormal, 101 AnimationDirectionAlternate, 102 AnimationDirectionReverse, 103 AnimationDirectionAlternateReverse 104 }; 100 105 AnimationDirection direction() const { return static_cast<AnimationDirection>(m_direction); } 101 106 … … 145 150 double m_duration; 146 151 RefPtr<TimingFunction> m_timingFunction; 147 unsigned m_direction : 1; // AnimationDirection152 unsigned m_direction : 2; // AnimationDirection 148 153 unsigned m_fillMode : 2; 149 154 -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp
r106190 r107162 27 27 namespace WebCore { 28 28 29 static double normalizedAnimationValue(double runningTime, double duration, bool alternate) 29 30 static bool shouldReverseAnimationValue(Animation::AnimationDirection direction, int loopCount) 31 { 32 if (((direction == Animation::AnimationDirectionAlternate) && (loopCount & 1)) 33 || ((direction == Animation::AnimationDirectionAlternateReverse) && !(loopCount & 1)) 34 || direction == Animation::AnimationDirectionReverse) 35 return true; 36 return false; 37 } 38 39 static double normalizedAnimationValue(double runningTime, double duration, Animation::AnimationDirection direction) 30 40 { 31 41 if (!duration) … … 36 46 const double remainder = runningTime - lastFullLoop; 37 47 const double normalized = remainder / duration; 38 return (loopCount % 2 && alternate) ? (1 - normalized) : normalized; 48 49 return shouldReverseAnimationValue(direction, loopCount) ? 1 - normalized : normalized; 39 50 } 40 51
Note: See TracChangeset
for help on using the changeset viewer.