Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: Source/core/animation/StringKeyframe.cpp

Issue 273903002: Web Animations API: Length properties responsive to style changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/animation/StringKeyframe.h" 6 #include "core/animation/StringKeyframe.h"
7 7
8 #include "core/animation/Interpolation.h" 8 #include "core/animation/Interpolation.h"
9 #include "core/animation/css/CSSAnimations.h" 9 #include "core/animation/css/CSSAnimations.h"
10 #include "core/css/resolver/StyleResolver.h" 10 #include "core/css/resolver/StyleResolver.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 : Keyframe::PropertySpecificKeyframe(offset, easing, AnimationEffect::Compos iteReplace) 59 : Keyframe::PropertySpecificKeyframe(offset, easing, AnimationEffect::Compos iteReplace)
60 , m_value(value) 60 , m_value(value)
61 { 61 {
62 ASSERT(!isNull(m_offset)); 62 ASSERT(!isNull(m_offset));
63 } 63 }
64 64
65 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: createInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe* end, Element* element) const 65 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: createInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe* end, Element* element) const
66 { 66 {
67 CSSValue* fromCSSValue = m_value.get(); 67 CSSValue* fromCSSValue = m_value.get();
68 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value(); 68 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value();
69 ValueRange range = ValueRangeAll;
69 70
70 if (!CSSAnimations::isAnimatableProperty(property)) 71 if (!CSSAnimations::isAnimatableProperty(property))
71 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope rty); 72 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope rty);
72 73
74 // FIXME: add non-negative CSSPropertyFontSize
73 switch (property) { 75 switch (property) {
76 case CSSPropertyBorderBottomWidth:
77 case CSSPropertyBorderLeftWidth:
78 case CSSPropertyBorderRightWidth:
79 case CSSPropertyBorderTopWidth:
80 case CSSPropertyHeight:
81 case CSSPropertyLineHeight:
82 case CSSPropertyMaxHeight:
83 case CSSPropertyMaxWidth:
84 case CSSPropertyMinHeight:
85 case CSSPropertyMinWidth:
86 case CSSPropertyPaddingBottom:
87 case CSSPropertyPaddingLeft:
88 case CSSPropertyPaddingRight:
89 case CSSPropertyPaddingTop:
90 case CSSPropertyPerspective:
91 case CSSPropertyShapeMargin:
92 case CSSPropertyWidth:
93 range = ValueRangeNonNegative;
94 // Fall through
95 case CSSPropertyBottom:
74 case CSSPropertyLeft: 96 case CSSPropertyLeft:
97 case CSSPropertyLetterSpacing:
98 case CSSPropertyMarginBottom:
99 case CSSPropertyMarginLeft:
100 case CSSPropertyMarginRight:
101 case CSSPropertyMarginTop:
102 case CSSPropertyOutlineOffset:
75 case CSSPropertyRight: 103 case CSSPropertyRight:
76 case CSSPropertyWidth: 104 case CSSPropertyTop:
77 case CSSPropertyHeight: 105 case CSSPropertyVerticalAlign:
alancutter (OOO until 2018) 2014/05/12 09:17:36 vertical-align is not animatable, we should add a
Eric Willigers 2014/05/12 09:42:37 Done.
106 case CSSPropertyWordSpacing:
78 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl eInterpolation::canCreateFrom(*toCSSValue)) 107 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl eInterpolation::canCreateFrom(*toCSSValue))
79 return LengthStyleInterpolation::create(fromCSSValue, toCSSValue, pr operty); 108 return LengthStyleInterpolation::create(fromCSSValue, toCSSValue, pr operty, range);
80 break; 109 break;
81 default: 110 default:
82 break; 111 break;
83 } 112 }
84 113
85 // FIXME: Remove the use of AnimatableValues, RenderStyles and Elements here . 114 // FIXME: Remove the use of AnimatableValues, RenderStyles and Elements here .
86 // FIXME: Remove this cache 115 // FIXME: Remove this cache
87 if (!m_animatableValueCache) 116 if (!m_animatableValueCache)
88 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(*e lement, property, fromCSSValue); 117 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(*e lement, property, fromCSSValue);
89 118
(...skipping 16 matching lines...) Expand all
106 } 135 }
107 136
108 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) 137 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor)
109 { 138 {
110 visitor->trace(m_value); 139 visitor->trace(m_value);
111 visitor->trace(m_animatableValueCache); 140 visitor->trace(m_animatableValueCache);
112 Keyframe::PropertySpecificKeyframe::trace(visitor); 141 Keyframe::PropertySpecificKeyframe::trace(visitor);
113 } 142 }
114 143
115 } 144 }
OLDNEW
« Source/core/animation/Interpolation.cpp ('K') | « Source/core/animation/InterpolationTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698