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

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: Rebase 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/css/CSSAnimations.h" 8 #include "core/animation/css/CSSAnimations.h"
9 #include "core/animation/interpolation/DefaultStyleInterpolation.h" 9 #include "core/animation/interpolation/DefaultStyleInterpolation.h"
10 #include "core/animation/interpolation/LegacyStyleInterpolation.h" 10 #include "core/animation/interpolation/LegacyStyleInterpolation.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 : Keyframe::PropertySpecificKeyframe(offset, easing, AnimationEffect::Compos iteReplace) 61 : Keyframe::PropertySpecificKeyframe(offset, easing, AnimationEffect::Compos iteReplace)
62 , m_value(value) 62 , m_value(value)
63 { 63 {
64 ASSERT(!isNull(m_offset)); 64 ASSERT(!isNull(m_offset));
65 } 65 }
66 66
67 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: createInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe* end, Element* element) const 67 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: createInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe* end, Element* element) const
68 { 68 {
69 CSSValue* fromCSSValue = m_value.get(); 69 CSSValue* fromCSSValue = m_value.get();
70 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value(); 70 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value();
71 ValueRange range = ValueRangeAll;
71 72
72 if (!CSSAnimations::isAnimatableProperty(property)) 73 if (!CSSAnimations::isAnimatableProperty(property))
73 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope rty); 74 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope rty);
74 75
76 // FIXME: add non-negative CSSPropertyFontSize and CSSPropertyOutlineWidth
75 switch (property) { 77 switch (property) {
78 case CSSPropertyBorderBottomWidth:
79 case CSSPropertyBorderLeftWidth:
80 case CSSPropertyBorderRightWidth:
81 case CSSPropertyBorderTopWidth:
82 case CSSPropertyHeight:
83 case CSSPropertyLineHeight:
84 case CSSPropertyMaxHeight:
85 case CSSPropertyMaxWidth:
86 case CSSPropertyMinHeight:
87 case CSSPropertyMinWidth:
88 case CSSPropertyPaddingBottom:
89 case CSSPropertyPaddingLeft:
90 case CSSPropertyPaddingRight:
91 case CSSPropertyPaddingTop:
92 case CSSPropertyPerspective:
93 case CSSPropertyShapeMargin:
94 case CSSPropertyWidth:
95 range = ValueRangeNonNegative;
96 // Fall through
97 case CSSPropertyBottom:
76 case CSSPropertyLeft: 98 case CSSPropertyLeft:
99 case CSSPropertyLetterSpacing:
100 case CSSPropertyMarginBottom:
101 case CSSPropertyMarginLeft:
102 case CSSPropertyMarginRight:
103 case CSSPropertyMarginTop:
104 case CSSPropertyOutlineOffset:
77 case CSSPropertyRight: 105 case CSSPropertyRight:
78 case CSSPropertyWidth: 106 case CSSPropertyTop:
79 case CSSPropertyHeight: 107 case CSSPropertyVerticalAlign:
108 case CSSPropertyWordSpacing:
80 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl eInterpolation::canCreateFrom(*toCSSValue)) 109 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl eInterpolation::canCreateFrom(*toCSSValue))
81 return LengthStyleInterpolation::create(fromCSSValue, toCSSValue, pr operty); 110 return LengthStyleInterpolation::create(fromCSSValue, toCSSValue, pr operty, range);
82 break; 111 break;
83 default: 112 default:
84 break; 113 break;
85 } 114 }
86 115
87 // FIXME: Remove the use of AnimatableValues, RenderStyles and Elements here . 116 // FIXME: Remove the use of AnimatableValues, RenderStyles and Elements here .
88 // FIXME: Remove this cache 117 // FIXME: Remove this cache
89 if (!m_animatableValueCache) 118 if (!m_animatableValueCache)
90 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(*e lement, property, fromCSSValue); 119 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(*e lement, property, fromCSSValue);
91 120
(...skipping 16 matching lines...) Expand all
108 } 137 }
109 138
110 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) 139 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor)
111 { 140 {
112 visitor->trace(m_value); 141 visitor->trace(m_value);
113 visitor->trace(m_animatableValueCache); 142 visitor->trace(m_animatableValueCache);
114 Keyframe::PropertySpecificKeyframe::trace(visitor); 143 Keyframe::PropertySpecificKeyframe::trace(visitor);
115 } 144 }
116 145
117 } 146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698