Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/ColorStyleInterpolation.h" | 8 #include "core/animation/ColorStyleInterpolation.h" |
| 9 #include "core/animation/DefaultStyleInterpolation.h" | 9 #include "core/animation/DefaultStyleInterpolation.h" |
| 10 #include "core/animation/DeferredLegacyStyleInterpolation.h" | 10 #include "core/animation/DeferredLegacyStyleInterpolation.h" |
| 11 #include "core/animation/DoubleStyleInterpolation.h" | |
| 11 #include "core/animation/LegacyStyleInterpolation.h" | 12 #include "core/animation/LegacyStyleInterpolation.h" |
| 13 #include "core/animation/LengthBoxStyleInterpolation.h" | |
| 12 #include "core/animation/LengthStyleInterpolation.h" | 14 #include "core/animation/LengthStyleInterpolation.h" |
| 13 #include "core/animation/VisibilityStyleInterpolation.h" | 15 #include "core/animation/VisibilityStyleInterpolation.h" |
| 14 #include "core/animation/css/CSSAnimations.h" | 16 #include "core/animation/css/CSSAnimations.h" |
| 15 #include "core/css/CSSPropertyMetadata.h" | 17 #include "core/css/CSSPropertyMetadata.h" |
| 16 #include "core/css/resolver/StyleResolver.h" | 18 #include "core/css/resolver/StyleResolver.h" |
| 17 #include "core/rendering/style/RenderStyle.h" | 19 #include "core/rendering/style/RenderStyle.h" |
| 18 | 20 |
| 19 namespace blink { | 21 namespace blink { |
| 20 | 22 |
| 21 StringKeyframe::StringKeyframe(const StringKeyframe& copyFrom) | 23 StringKeyframe::StringKeyframe(const StringKeyframe& copyFrom) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 { | 74 { |
| 73 CSSValue* fromCSSValue = m_value.get(); | 75 CSSValue* fromCSSValue = m_value.get(); |
| 74 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value(); | 76 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value(); |
| 75 ValueRange range = ValueRangeAll; | 77 ValueRange range = ValueRangeAll; |
| 76 | 78 |
| 77 if (!CSSPropertyMetadata::isAnimatableProperty(property)) | 79 if (!CSSPropertyMetadata::isAnimatableProperty(property)) |
| 78 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope rty); | 80 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope rty); |
| 79 | 81 |
| 80 switch (property) { | 82 switch (property) { |
| 81 case CSSPropertyBorderBottomWidth: | 83 case CSSPropertyBorderBottomWidth: |
| 82 case CSSPropertyBorderLeftWidth: | 84 case CSSPropertyBorderLeftWidth: |
|
Eric Willigers
2014/12/22 07:35:38
case CSSPropertyBorderBottomWidth:
case CSSPr
jadeg
2015/01/05 23:15:20
Done.
| |
| 83 case CSSPropertyBorderRightWidth: | 85 case CSSPropertyBorderRightWidth: |
| 84 case CSSPropertyBorderTopWidth: | 86 case CSSPropertyBorderTopWidth: |
| 87 case CSSPropertyFillOpacity: | |
| 88 case CSSPropertyFlexGrow: | |
| 89 case CSSPropertyFlexShrink: | |
| 90 case CSSPropertyFloodOpacity: | |
| 85 case CSSPropertyFontSize: | 91 case CSSPropertyFontSize: |
| 92 case CSSPropertyLetterSpacing: | |
|
Eric Willigers
2014/12/22 07:35:38
letter spacer and word spacing and outline offset
jadeg
2015/01/05 23:15:20
Done.
| |
| 93 case CSSPropertyOrphans: | |
|
Eric Willigers
2014/12/22 07:35:38
The following are always integers: orphans webki
jadeg
2015/01/05 23:15:20
Done.
| |
| 94 case CSSPropertyOutlineOffset: | |
| 95 case CSSPropertyOutlineWidth: | |
| 96 case CSSPropertyPerspective: | |
| 97 case CSSPropertyShapeImageThreshold: | |
|
Eric Willigers
2014/12/22 07:35:38
shape-image-threshold is clamped 0..1, just like o
jadeg
2015/01/05 23:15:20
Have changed this, but just to note that this clam
| |
| 98 case CSSPropertyStopOpacity: | |
| 99 case CSSPropertyStrokeMiterlimit: | |
| 100 case CSSPropertyStrokeOpacity: | |
| 101 case CSSPropertyWebkitBorderHorizontalSpacing: | |
| 102 case CSSPropertyWebkitBorderVerticalSpacing: | |
| 103 case CSSPropertyWebkitColumnCount: | |
| 104 case CSSPropertyWebkitColumnGap: | |
| 105 case CSSPropertyWebkitColumnRuleWidth: | |
| 106 case CSSPropertyWebkitColumnWidth: | |
|
Eric Willigers
2014/12/22 07:35:38
OutlineWidth and Perspective and WebkitBorderHoriz
jadeg
2015/01/05 23:15:20
Done.
| |
| 107 case CSSPropertyWidows: | |
| 108 case CSSPropertyWordSpacing: | |
| 109 case CSSPropertyZIndex: | |
| 110 case CSSPropertyZoom: | |
| 111 if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyl eInterpolation::canCreateFrom(*toCSSValue)) | |
|
Eric Willigers
2014/12/22 07:35:38
Note that Chrome does not permit negative values f
jadeg
2015/01/05 23:15:20
Just to check, I have found no clamping rules for
jadeg
2015/01/05 23:15:20
Done.
| |
| 112 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, NoClamp); | |
| 113 break; | |
| 114 case CSSPropertyOpacity: | |
| 115 if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyl eInterpolation::canCreateFrom(*toCSSValue)) | |
| 116 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, ClampOpacity); | |
| 117 break; | |
| 118 | |
| 119 case CSSPropertyLineHeight: | |
| 120 if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyl eInterpolation::canCreateFrom(*toCSSValue)) | |
| 121 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, NoClamp); | |
|
Eric Willigers
2014/12/22 05:02:41
clamp to non-negative values
jadeg
2015/01/05 23:15:20
Done.
| |
| 122 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl eInterpolation::canCreateFrom(*toCSSValue)) | |
| 123 return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, range); | |
|
Eric Willigers
2014/12/22 05:02:41
ValueRangeNonNegative
jadeg
2015/01/05 23:15:20
Done.
| |
| 124 break; | |
| 125 | |
| 86 case CSSPropertyHeight: | 126 case CSSPropertyHeight: |
| 87 case CSSPropertyLineHeight: | |
| 88 case CSSPropertyMaxHeight: | 127 case CSSPropertyMaxHeight: |
| 89 case CSSPropertyMaxWidth: | 128 case CSSPropertyMaxWidth: |
| 90 case CSSPropertyMinHeight: | 129 case CSSPropertyMinHeight: |
| 91 case CSSPropertyMinWidth: | 130 case CSSPropertyMinWidth: |
| 92 case CSSPropertyMotionPosition: | 131 case CSSPropertyMotionPosition: |
| 93 case CSSPropertyOutlineWidth: | |
| 94 case CSSPropertyPaddingBottom: | 132 case CSSPropertyPaddingBottom: |
| 95 case CSSPropertyPaddingLeft: | 133 case CSSPropertyPaddingLeft: |
| 96 case CSSPropertyPaddingRight: | 134 case CSSPropertyPaddingRight: |
| 97 case CSSPropertyPaddingTop: | 135 case CSSPropertyPaddingTop: |
| 98 case CSSPropertyPerspective: | |
| 99 case CSSPropertyShapeMargin: | 136 case CSSPropertyShapeMargin: |
| 100 case CSSPropertyWidth: | 137 case CSSPropertyWidth: |
| 101 range = ValueRangeNonNegative; | 138 range = ValueRangeNonNegative; |
| 102 // Fall through | 139 // Fall through |
| 103 case CSSPropertyBottom: | 140 case CSSPropertyBottom: |
| 141 case CSSPropertyFlexBasis: | |
|
Eric Willigers
2014/12/22 05:02:41
Move CSSPropertyFlexBasis up to use ValueRangeNonN
jadeg
2015/01/05 23:15:20
Done.
| |
| 104 case CSSPropertyLeft: | 142 case CSSPropertyLeft: |
| 105 case CSSPropertyLetterSpacing: | |
| 106 case CSSPropertyMarginBottom: | 143 case CSSPropertyMarginBottom: |
| 107 case CSSPropertyMarginLeft: | 144 case CSSPropertyMarginLeft: |
| 108 case CSSPropertyMarginRight: | 145 case CSSPropertyMarginRight: |
| 109 case CSSPropertyMarginTop: | 146 case CSSPropertyMarginTop: |
| 110 case CSSPropertyOutlineOffset: | |
| 111 case CSSPropertyRight: | 147 case CSSPropertyRight: |
| 148 case CSSPropertyTextIndent: | |
| 112 case CSSPropertyTop: | 149 case CSSPropertyTop: |
| 113 case CSSPropertyVerticalAlign: | 150 case CSSPropertyVerticalAlign: |
| 114 case CSSPropertyWordSpacing: | |
|
Eric Willigers
2014/12/22 05:02:41
Removing
case CSSPropertyLetterSpacing:
case C
jadeg
2015/01/05 23:15:20
Done.
| |
| 115 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl eInterpolation::canCreateFrom(*toCSSValue)) | 151 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl eInterpolation::canCreateFrom(*toCSSValue)) |
| 116 return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, range); | 152 return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, range); |
| 153 break; | |
| 154 | |
| 155 case CSSPropertyBorderImageSlice: | |
|
Eric Willigers
2014/12/19 00:16:13
Let's move the two LengthBoxStyleInterpolation cas
jadeg
2015/01/05 23:15:20
Done.
| |
| 156 case CSSPropertyClip: | |
| 157 if (LengthBoxStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthB oxStyleInterpolation::canCreateFrom(*toCSSValue)) | |
| 158 return LengthBoxStyleInterpolation::create(*fromCSSValue, *toCSSValu e, property); | |
| 159 break; | |
| 160 | |
| 117 case CSSPropertyVisibility: | 161 case CSSPropertyVisibility: |
| 118 if (VisibilityStyleInterpolation::canCreateFrom(*fromCSSValue) && Visibi lityStyleInterpolation::canCreateFrom(*toCSSValue) && (VisibilityStyleInterpolat ion::isVisible(*fromCSSValue) || VisibilityStyleInterpolation::isVisible(*toCSSV alue))) { | 162 if (VisibilityStyleInterpolation::canCreateFrom(*fromCSSValue) && Visibi lityStyleInterpolation::canCreateFrom(*toCSSValue) && (VisibilityStyleInterpolat ion::isVisible(*fromCSSValue) || VisibilityStyleInterpolation::isVisible(*toCSSV alue))) { |
| 119 return VisibilityStyleInterpolation::create(*fromCSSValue, *toCSSVal ue, property); | 163 return VisibilityStyleInterpolation::create(*fromCSSValue, *toCSSVal ue, property); |
| 120 } | 164 } |
| 121 break; | 165 break; |
| 166 | |
|
samli
2014/12/22 03:41:15
Remove new line
jadeg
2015/01/05 23:15:20
Done.
| |
| 122 case CSSPropertyFill: | 167 case CSSPropertyFill: |
| 123 case CSSPropertyStroke: | 168 case CSSPropertyStroke: |
| 169 | |
|
samli
2014/12/22 03:41:15
ditto
jadeg
2015/01/05 23:15:20
Done.
| |
| 124 case CSSPropertyBackgroundColor: | 170 case CSSPropertyBackgroundColor: |
| 125 case CSSPropertyBorderBottomColor: | 171 case CSSPropertyBorderBottomColor: |
| 126 case CSSPropertyBorderLeftColor: | 172 case CSSPropertyBorderLeftColor: |
| 127 case CSSPropertyBorderRightColor: | 173 case CSSPropertyBorderRightColor: |
| 128 case CSSPropertyBorderTopColor: | 174 case CSSPropertyBorderTopColor: |
| 129 case CSSPropertyColor: | 175 case CSSPropertyColor: |
| 130 case CSSPropertyFloodColor: | 176 case CSSPropertyFloodColor: |
| 131 case CSSPropertyLightingColor: | 177 case CSSPropertyLightingColor: |
| 132 case CSSPropertyOutlineColor: | 178 case CSSPropertyOutlineColor: |
| 133 case CSSPropertyStopColor: | 179 case CSSPropertyStopColor: |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 } | 214 } |
| 169 | 215 |
| 170 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) | 216 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) |
| 171 { | 217 { |
| 172 visitor->trace(m_value); | 218 visitor->trace(m_value); |
| 173 visitor->trace(m_animatableValueCache); | 219 visitor->trace(m_animatableValueCache); |
| 174 Keyframe::PropertySpecificKeyframe::trace(visitor); | 220 Keyframe::PropertySpecificKeyframe::trace(visitor); |
| 175 } | 221 } |
| 176 | 222 |
| 177 } | 223 } |
| OLD | NEW |