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/XLinkNames.h" | |
| 8 #include "core/animation/AngleSVGInterpolation.h" | 9 #include "core/animation/AngleSVGInterpolation.h" |
| 9 #include "core/animation/CSSColorInterpolationType.h" | 10 #include "core/animation/CSSColorInterpolationType.h" |
| 10 #include "core/animation/CSSImageInterpolationType.h" | 11 #include "core/animation/CSSImageInterpolationType.h" |
| 11 #include "core/animation/CSSImageListInterpolationType.h" | 12 #include "core/animation/CSSImageListInterpolationType.h" |
| 12 #include "core/animation/CSSLengthInterpolationType.h" | 13 #include "core/animation/CSSLengthInterpolationType.h" |
| 13 #include "core/animation/CSSNumberInterpolationType.h" | 14 #include "core/animation/CSSNumberInterpolationType.h" |
| 14 #include "core/animation/CSSPaintInterpolationType.h" | 15 #include "core/animation/CSSPaintInterpolationType.h" |
| 15 #include "core/animation/CSSShadowListInterpolationType.h" | 16 #include "core/animation/CSSShadowListInterpolationType.h" |
| 16 #include "core/animation/CSSValueInterpolationType.h" | 17 #include "core/animation/CSSValueInterpolationType.h" |
| 17 #include "core/animation/CompositorAnimations.h" | 18 #include "core/animation/CompositorAnimations.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 31 #include "core/animation/LengthSVGInterpolation.h" | 32 #include "core/animation/LengthSVGInterpolation.h" |
| 32 #include "core/animation/LengthStyleInterpolation.h" | 33 #include "core/animation/LengthStyleInterpolation.h" |
| 33 #include "core/animation/ListSVGInterpolation.h" | 34 #include "core/animation/ListSVGInterpolation.h" |
| 34 #include "core/animation/ListStyleInterpolation.h" | 35 #include "core/animation/ListStyleInterpolation.h" |
| 35 #include "core/animation/NumberOptionalNumberSVGInterpolation.h" | 36 #include "core/animation/NumberOptionalNumberSVGInterpolation.h" |
| 36 #include "core/animation/NumberSVGInterpolation.h" | 37 #include "core/animation/NumberSVGInterpolation.h" |
| 37 #include "core/animation/PathSVGInterpolation.h" | 38 #include "core/animation/PathSVGInterpolation.h" |
| 38 #include "core/animation/PointSVGInterpolation.h" | 39 #include "core/animation/PointSVGInterpolation.h" |
| 39 #include "core/animation/RectSVGInterpolation.h" | 40 #include "core/animation/RectSVGInterpolation.h" |
| 40 #include "core/animation/SVGStrokeDasharrayStyleInterpolation.h" | 41 #include "core/animation/SVGStrokeDasharrayStyleInterpolation.h" |
| 42 #include "core/animation/SVGValueInterpolationType.h" | |
| 41 #include "core/animation/TransformSVGInterpolation.h" | 43 #include "core/animation/TransformSVGInterpolation.h" |
| 42 #include "core/animation/VisibilityStyleInterpolation.h" | 44 #include "core/animation/VisibilityStyleInterpolation.h" |
| 43 #include "core/animation/css/CSSAnimations.h" | 45 #include "core/animation/css/CSSAnimations.h" |
| 44 #include "core/css/CSSPropertyMetadata.h" | 46 #include "core/css/CSSPropertyMetadata.h" |
| 45 #include "core/css/resolver/StyleResolver.h" | 47 #include "core/css/resolver/StyleResolver.h" |
| 46 #include "core/style/ComputedStyle.h" | 48 #include "core/style/ComputedStyle.h" |
| 47 #include "core/svg/SVGElement.h" | 49 #include "core/svg/SVGElement.h" |
| 48 #include "platform/RuntimeEnabledFeatures.h" | 50 #include "platform/RuntimeEnabledFeatures.h" |
| 49 | 51 |
| 50 namespace blink { | 52 namespace blink { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 if (!baseStyle && (!m_value || DeferredLegacyStyleInterpolation::interpolati onRequiresStyleResolve(*m_value))) | 125 if (!baseStyle && (!m_value || DeferredLegacyStyleInterpolation::interpolati onRequiresStyleResolve(*m_value))) |
| 124 return false; | 126 return false; |
| 125 if (!element.document().frame()) | 127 if (!element.document().frame()) |
| 126 return false; | 128 return false; |
| 127 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(elemen t, baseStyle, property, m_value.get()); | 129 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(elemen t, baseStyle, property, m_value.get()); |
| 128 return true; | 130 return true; |
| 129 } | 131 } |
| 130 | 132 |
| 131 namespace { | 133 namespace { |
| 132 | 134 |
| 133 const Vector<const InterpolationType*>* applicableTypesForProperty(CSSPropertyID property) | 135 const Vector<const InterpolationType*>* applicableTypesForProperty(PropertyHandl e property) |
|
dstockwell
2015/10/28 03:29:16
As discussed I think we'll want to clean this up t
alancutter (OOO until 2018)
2015/10/28 03:48:45
Added TODOs.
| |
| 134 { | 136 { |
| 135 using ApplicableTypesMap = HashMap<CSSPropertyID, const Vector<const Interpo lationType*>*>; | 137 using ApplicableTypesMap = HashMap<PropertyHandle, const Vector<const Interp olationType*>*>; |
| 136 DEFINE_STATIC_LOCAL(ApplicableTypesMap, applicableTypesMap, ()); | 138 DEFINE_STATIC_LOCAL(ApplicableTypesMap, applicableTypesMap, ()); |
| 137 auto entry = applicableTypesMap.find(property); | 139 auto entry = applicableTypesMap.find(property); |
| 138 if (entry != applicableTypesMap.end()) | 140 if (entry != applicableTypesMap.end()) |
| 139 return entry->value; | 141 return entry->value; |
| 140 | 142 |
| 143 bool fallbackToLegacy = false; | |
| 141 auto applicableTypes = new Vector<const InterpolationType*>(); | 144 auto applicableTypes = new Vector<const InterpolationType*>(); |
| 142 switch (property) { | 145 |
| 143 case CSSPropertyBaselineShift: | 146 if (property.isCSSProperty()) { |
| 144 case CSSPropertyBorderBottomWidth: | 147 CSSPropertyID cssProperty = property.cssProperty(); |
| 145 case CSSPropertyBorderLeftWidth: | 148 switch (cssProperty) { |
| 146 case CSSPropertyBorderRightWidth: | 149 case CSSPropertyBaselineShift: |
| 147 case CSSPropertyBorderTopWidth: | 150 case CSSPropertyBorderBottomWidth: |
| 148 case CSSPropertyBottom: | 151 case CSSPropertyBorderLeftWidth: |
| 149 case CSSPropertyCx: | 152 case CSSPropertyBorderRightWidth: |
| 150 case CSSPropertyCy: | 153 case CSSPropertyBorderTopWidth: |
| 151 case CSSPropertyFlexBasis: | 154 case CSSPropertyBottom: |
| 152 case CSSPropertyHeight: | 155 case CSSPropertyCx: |
| 153 case CSSPropertyLeft: | 156 case CSSPropertyCy: |
| 154 case CSSPropertyLetterSpacing: | 157 case CSSPropertyFlexBasis: |
| 155 case CSSPropertyMarginBottom: | 158 case CSSPropertyHeight: |
| 156 case CSSPropertyMarginLeft: | 159 case CSSPropertyLeft: |
| 157 case CSSPropertyMarginRight: | 160 case CSSPropertyLetterSpacing: |
| 158 case CSSPropertyMarginTop: | 161 case CSSPropertyMarginBottom: |
| 159 case CSSPropertyMaxHeight: | 162 case CSSPropertyMarginLeft: |
| 160 case CSSPropertyMaxWidth: | 163 case CSSPropertyMarginRight: |
| 161 case CSSPropertyMinHeight: | 164 case CSSPropertyMarginTop: |
| 162 case CSSPropertyMinWidth: | 165 case CSSPropertyMaxHeight: |
| 163 case CSSPropertyMotionOffset: | 166 case CSSPropertyMaxWidth: |
| 164 case CSSPropertyOutlineOffset: | 167 case CSSPropertyMinHeight: |
| 165 case CSSPropertyOutlineWidth: | 168 case CSSPropertyMinWidth: |
| 166 case CSSPropertyPaddingBottom: | 169 case CSSPropertyMotionOffset: |
| 167 case CSSPropertyPaddingLeft: | 170 case CSSPropertyOutlineOffset: |
| 168 case CSSPropertyPaddingRight: | 171 case CSSPropertyOutlineWidth: |
| 169 case CSSPropertyPaddingTop: | 172 case CSSPropertyPaddingBottom: |
| 170 case CSSPropertyPerspective: | 173 case CSSPropertyPaddingLeft: |
| 171 case CSSPropertyR: | 174 case CSSPropertyPaddingRight: |
| 172 case CSSPropertyRight: | 175 case CSSPropertyPaddingTop: |
| 173 case CSSPropertyRx: | 176 case CSSPropertyPerspective: |
| 174 case CSSPropertyRy: | 177 case CSSPropertyR: |
| 175 case CSSPropertyShapeMargin: | 178 case CSSPropertyRight: |
| 176 case CSSPropertyStrokeDashoffset: | 179 case CSSPropertyRx: |
| 177 case CSSPropertyStrokeWidth: | 180 case CSSPropertyRy: |
| 178 case CSSPropertyTop: | 181 case CSSPropertyShapeMargin: |
| 179 case CSSPropertyVerticalAlign: | 182 case CSSPropertyStrokeDashoffset: |
| 180 case CSSPropertyWebkitBorderHorizontalSpacing: | 183 case CSSPropertyStrokeWidth: |
| 181 case CSSPropertyWebkitBorderVerticalSpacing: | 184 case CSSPropertyTop: |
| 182 case CSSPropertyWebkitColumnGap: | 185 case CSSPropertyVerticalAlign: |
| 183 case CSSPropertyWebkitColumnRuleWidth: | 186 case CSSPropertyWebkitBorderHorizontalSpacing: |
| 184 case CSSPropertyWebkitColumnWidth: | 187 case CSSPropertyWebkitBorderVerticalSpacing: |
| 185 case CSSPropertyWebkitPerspectiveOriginX: | 188 case CSSPropertyWebkitColumnGap: |
| 186 case CSSPropertyWebkitPerspectiveOriginY: | 189 case CSSPropertyWebkitColumnRuleWidth: |
| 187 case CSSPropertyWebkitTransformOriginX: | 190 case CSSPropertyWebkitColumnWidth: |
| 188 case CSSPropertyWebkitTransformOriginY: | 191 case CSSPropertyWebkitPerspectiveOriginX: |
| 189 case CSSPropertyWebkitTransformOriginZ: | 192 case CSSPropertyWebkitPerspectiveOriginY: |
| 190 case CSSPropertyWidth: | 193 case CSSPropertyWebkitTransformOriginX: |
| 191 case CSSPropertyWordSpacing: | 194 case CSSPropertyWebkitTransformOriginY: |
| 192 case CSSPropertyX: | 195 case CSSPropertyWebkitTransformOriginZ: |
| 193 case CSSPropertyY: | 196 case CSSPropertyWidth: |
| 194 applicableTypes->append(new CSSLengthInterpolationType(property)); | 197 case CSSPropertyWordSpacing: |
| 195 break; | 198 case CSSPropertyX: |
| 196 case CSSPropertyFlexGrow: | 199 case CSSPropertyY: |
| 197 case CSSPropertyFlexShrink: | 200 applicableTypes->append(new CSSLengthInterpolationType(cssProperty)) ; |
| 198 case CSSPropertyFillOpacity: | 201 break; |
| 199 case CSSPropertyFloodOpacity: | 202 case CSSPropertyFlexGrow: |
| 200 case CSSPropertyFontSizeAdjust: | 203 case CSSPropertyFlexShrink: |
| 201 case CSSPropertyOpacity: | 204 case CSSPropertyFillOpacity: |
| 202 case CSSPropertyOrphans: | 205 case CSSPropertyFloodOpacity: |
| 203 case CSSPropertyShapeImageThreshold: | 206 case CSSPropertyFontSizeAdjust: |
| 204 case CSSPropertyStopOpacity: | 207 case CSSPropertyOpacity: |
| 205 case CSSPropertyStrokeMiterlimit: | 208 case CSSPropertyOrphans: |
| 206 case CSSPropertyStrokeOpacity: | 209 case CSSPropertyShapeImageThreshold: |
| 207 case CSSPropertyWebkitColumnCount: | 210 case CSSPropertyStopOpacity: |
| 208 case CSSPropertyWidows: | 211 case CSSPropertyStrokeMiterlimit: |
| 209 case CSSPropertyZIndex: | 212 case CSSPropertyStrokeOpacity: |
| 210 applicableTypes->append(new CSSNumberInterpolationType(property)); | 213 case CSSPropertyWebkitColumnCount: |
| 211 break; | 214 case CSSPropertyWidows: |
| 212 case CSSPropertyLineHeight: | 215 case CSSPropertyZIndex: |
| 213 applicableTypes->append(new CSSLengthInterpolationType(property)); | 216 applicableTypes->append(new CSSNumberInterpolationType(cssProperty)) ; |
| 214 applicableTypes->append(new CSSNumberInterpolationType(property)); | 217 break; |
| 215 break; | 218 case CSSPropertyLineHeight: |
| 216 case CSSPropertyBackgroundColor: | 219 applicableTypes->append(new CSSLengthInterpolationType(cssProperty)) ; |
| 217 case CSSPropertyBorderBottomColor: | 220 applicableTypes->append(new CSSNumberInterpolationType(cssProperty)) ; |
| 218 case CSSPropertyBorderLeftColor: | 221 break; |
| 219 case CSSPropertyBorderRightColor: | 222 case CSSPropertyBackgroundColor: |
| 220 case CSSPropertyBorderTopColor: | 223 case CSSPropertyBorderBottomColor: |
| 221 case CSSPropertyColor: | 224 case CSSPropertyBorderLeftColor: |
| 222 case CSSPropertyFloodColor: | 225 case CSSPropertyBorderRightColor: |
| 223 case CSSPropertyLightingColor: | 226 case CSSPropertyBorderTopColor: |
| 224 case CSSPropertyOutlineColor: | 227 case CSSPropertyColor: |
| 225 case CSSPropertyStopColor: | 228 case CSSPropertyFloodColor: |
| 226 case CSSPropertyTextDecorationColor: | 229 case CSSPropertyLightingColor: |
| 227 case CSSPropertyWebkitColumnRuleColor: | 230 case CSSPropertyOutlineColor: |
| 228 case CSSPropertyWebkitTextStrokeColor: | 231 case CSSPropertyStopColor: |
| 229 applicableTypes->append(new CSSColorInterpolationType(property)); | 232 case CSSPropertyTextDecorationColor: |
| 230 break; | 233 case CSSPropertyWebkitColumnRuleColor: |
| 231 case CSSPropertyFill: | 234 case CSSPropertyWebkitTextStrokeColor: |
| 232 case CSSPropertyStroke: | 235 applicableTypes->append(new CSSColorInterpolationType(cssProperty)); |
| 233 applicableTypes->append(new CSSPaintInterpolationType(property)); | 236 break; |
| 234 break; | 237 case CSSPropertyFill: |
| 235 case CSSPropertyBoxShadow: | 238 case CSSPropertyStroke: |
| 236 case CSSPropertyTextShadow: | 239 applicableTypes->append(new CSSPaintInterpolationType(cssProperty)); |
| 237 applicableTypes->append(new CSSShadowListInterpolationType(property)); | 240 break; |
| 238 break; | 241 case CSSPropertyBoxShadow: |
| 239 case CSSPropertyBorderImageSource: | 242 case CSSPropertyTextShadow: |
| 240 case CSSPropertyListStyleImage: | 243 applicableTypes->append(new CSSShadowListInterpolationType(cssProper ty)); |
| 241 case CSSPropertyWebkitMaskBoxImageSource: | 244 break; |
| 242 applicableTypes->append(new CSSImageInterpolationType(property)); | 245 case CSSPropertyBorderImageSource: |
| 243 break; | 246 case CSSPropertyListStyleImage: |
| 244 case CSSPropertyBackgroundImage: | 247 case CSSPropertyWebkitMaskBoxImageSource: |
| 245 case CSSPropertyWebkitMaskImage: | 248 applicableTypes->append(new CSSImageInterpolationType(cssProperty)); |
| 246 applicableTypes->append(new CSSImageListInterpolationType(property)); | 249 break; |
| 247 break; | 250 case CSSPropertyBackgroundImage: |
| 248 default: | 251 case CSSPropertyWebkitMaskImage: |
| 249 // TODO(alancutter): Support all interpolable CSS properties here so we can stop falling back to the old StyleInterpolation implementation. | 252 applicableTypes->append(new CSSImageListInterpolationType(cssPropert y)); |
| 250 if (CSSPropertyMetadata::isInterpolableProperty(property)) { | 253 break; |
| 251 delete applicableTypes; | 254 default: |
| 252 applicableTypesMap.add(property, nullptr); | 255 // TODO(alancutter): Support all interpolable CSS properties here so we can stop falling back to the old StyleInterpolation implementation. |
| 253 return nullptr; | 256 if (CSSPropertyMetadata::isInterpolableProperty(cssProperty)) |
| 257 fallbackToLegacy = true; | |
| 258 break; | |
| 254 } | 259 } |
| 255 break; | 260 applicableTypes->append(new CSSValueInterpolationType(cssProperty)); |
| 261 } else { | |
| 262 const QualifiedName& attribute = property.svgAttribute(); | |
| 263 if (attribute == HTMLNames::classAttr | |
| 264 || attribute == SVGNames::clipPathUnitsAttr | |
| 265 || attribute == SVGNames::edgeModeAttr | |
| 266 || attribute == SVGNames::filterUnitsAttr | |
| 267 || attribute == SVGNames::gradientUnitsAttr | |
| 268 || attribute == SVGNames::inAttr | |
| 269 || attribute == SVGNames::in2Attr | |
| 270 || attribute == SVGNames::lengthAdjustAttr | |
| 271 || attribute == SVGNames::markerUnitsAttr | |
| 272 || attribute == SVGNames::maskContentUnitsAttr | |
| 273 || attribute == SVGNames::maskUnitsAttr | |
| 274 || attribute == SVGNames::methodAttr | |
| 275 || attribute == SVGNames::modeAttr | |
| 276 || attribute == SVGNames::operatorAttr | |
| 277 || attribute == SVGNames::patternContentUnitsAttr | |
| 278 || attribute == SVGNames::patternUnitsAttr | |
| 279 || attribute == SVGNames::preserveAlphaAttr | |
| 280 || attribute == SVGNames::preserveAspectRatioAttr | |
| 281 || attribute == SVGNames::primitiveUnitsAttr | |
| 282 || attribute == SVGNames::resultAttr | |
| 283 || attribute == SVGNames::spacingAttr | |
| 284 || attribute == SVGNames::spreadMethodAttr | |
| 285 || attribute == SVGNames::stitchTilesAttr | |
| 286 || attribute == SVGNames::targetAttr | |
| 287 || attribute == SVGNames::typeAttr | |
| 288 || attribute == SVGNames::xChannelSelectorAttr | |
| 289 || attribute == SVGNames::yChannelSelectorAttr | |
| 290 || attribute == XLinkNames::hrefAttr) { | |
| 291 applicableTypes->append(new SVGValueInterpolationType(attribute)); | |
| 292 } else { | |
| 293 fallbackToLegacy = true; | |
| 294 } | |
| 256 } | 295 } |
| 257 applicableTypes->append(new CSSValueInterpolationType(property)); | 296 |
| 297 if (fallbackToLegacy) { | |
| 298 delete applicableTypes; | |
| 299 applicableTypesMap.add(property, nullptr); | |
| 300 return nullptr; | |
| 301 } | |
| 302 | |
| 258 applicableTypesMap.add(property, applicableTypes); | 303 applicableTypesMap.add(property, applicableTypes); |
| 259 return applicableTypes; | 304 return applicableTypes; |
| 260 } | 305 } |
| 261 | 306 |
| 262 } // namespace | 307 } // namespace |
| 263 | 308 |
| 264 PassRefPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyframe::createLeg acyStyleInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe & end, Element* element, const ComputedStyle* baseStyle) const | 309 PassRefPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyframe::createLeg acyStyleInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe & end, Element* element, const ComputedStyle* baseStyle) const |
| 265 { | 310 { |
| 266 CSSValue& fromCSSValue = *m_value.get(); | 311 CSSValue& fromCSSValue = *m_value.get(); |
| 267 CSSValue& toCSSValue = *toCSSPropertySpecificKeyframe(end).value(); | 312 CSSValue& toCSSValue = *toCSSPropertySpecificKeyframe(end).value(); |
| 268 if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(from CSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve (toCSSValue)) { | 313 if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(from CSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve (toCSSValue)) { |
| 269 // FIXME: Handle these cases outside of DeferredLegacyStyleInterpolation . | 314 // FIXME: Handle these cases outside of DeferredLegacyStyleInterpolation . |
| 270 return DeferredLegacyStyleInterpolation::create(&fromCSSValue, &toCSSVal ue, property); | 315 return DeferredLegacyStyleInterpolation::create(&fromCSSValue, &toCSSVal ue, property); |
| 271 } | 316 } |
| 272 | 317 |
| 273 // FIXME: Remove the use of AnimatableValues and Elements here. | 318 // FIXME: Remove the use of AnimatableValues and Elements here. |
| 274 ASSERT(element); | 319 ASSERT(element); |
| 275 populateAnimatableValue(property, *element, baseStyle, false); | 320 populateAnimatableValue(property, *element, baseStyle, false); |
| 276 end.populateAnimatableValue(property, *element, baseStyle, false); | 321 end.populateAnimatableValue(property, *element, baseStyle, false); |
| 277 return LegacyStyleInterpolation::create(getAnimatableValue(), end.getAnimata bleValue(), property); | 322 return LegacyStyleInterpolation::create(getAnimatableValue(), end.getAnimata bleValue(), property); |
| 278 } | 323 } |
| 279 | 324 |
| 280 PassRefPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyframe::maybeCrea teInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyfram e& end, Element* element, const ComputedStyle* baseStyle) const | 325 PassRefPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyframe::maybeCrea teInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyfram e& end, Element* element, const ComputedStyle* baseStyle) const |
| 281 { | 326 { |
| 282 CSSPropertyID property = propertyHandle.cssProperty(); | 327 const Vector<const InterpolationType*>* applicableTypes = applicableTypesFor Property(propertyHandle); |
| 283 const Vector<const InterpolationType*>* applicableTypes = applicableTypesFor Property(property); | |
| 284 if (applicableTypes) | 328 if (applicableTypes) |
| 285 return InvalidatableInterpolation::create(*applicableTypes, *this, end); | 329 return InvalidatableInterpolation::create(*applicableTypes, *this, end); |
| 286 | 330 |
| 287 // TODO(alancutter): Remove the remainder of this function. | 331 // TODO(alancutter): Remove the remainder of this function. |
| 288 | 332 |
| 289 // FIXME: Refactor this into a generic piece that lives in InterpolationEffe ct, and a template parameter specific converter. | 333 // FIXME: Refactor this into a generic piece that lives in InterpolationEffe ct, and a template parameter specific converter. |
| 334 CSSPropertyID property = propertyHandle.cssProperty(); | |
| 290 CSSValue* fromCSSValue = m_value.get(); | 335 CSSValue* fromCSSValue = m_value.get(); |
| 291 CSSValue* toCSSValue = toCSSPropertySpecificKeyframe(end).value(); | 336 CSSValue* toCSSValue = toCSSPropertySpecificKeyframe(end).value(); |
| 292 InterpolationRange range = RangeAll; | 337 InterpolationRange range = RangeAll; |
| 293 | 338 |
| 294 // FIXME: Remove this flag once we can rely on legacy's behaviour being corr ect. | 339 // FIXME: Remove this flag once we can rely on legacy's behaviour being corr ect. |
| 295 bool forceDefaultInterpolation = false; | 340 bool forceDefaultInterpolation = false; |
| 296 | 341 |
| 297 // FIXME: Remove this check once neutral keyframes are implemented in String Keyframes. | 342 // FIXME: Remove this check once neutral keyframes are implemented in String Keyframes. |
| 298 if (!fromCSSValue || !toCSSValue) | 343 if (!fromCSSValue || !toCSSValue) |
| 299 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSValue , property); | 344 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSValue , property); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 520 if (interpolation) | 565 if (interpolation) |
| 521 return interpolation.release(); | 566 return interpolation.release(); |
| 522 | 567 |
| 523 return DefaultSVGInterpolation::create(fromValue, toValue, attribute); | 568 return DefaultSVGInterpolation::create(fromValue, toValue, attribute); |
| 524 } | 569 } |
| 525 | 570 |
| 526 } // namespace | 571 } // namespace |
| 527 | 572 |
| 528 PassRefPtr<Interpolation> SVGPropertySpecificKeyframe::maybeCreateInterpolation( PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const | 573 PassRefPtr<Interpolation> SVGPropertySpecificKeyframe::maybeCreateInterpolation( PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const |
| 529 { | 574 { |
| 575 const Vector<const InterpolationType*>* applicableTypes = applicableTypesFor Property(propertyHandle); | |
| 576 if (applicableTypes) | |
| 577 return InvalidatableInterpolation::create(*applicableTypes, *this, end); | |
| 578 | |
| 530 ASSERT(element); | 579 ASSERT(element); |
| 531 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute = toSVGElement(element )->propertyFromAttribute(propertyHandle.svgAttribute()); | 580 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute = toSVGElement(element )->propertyFromAttribute(propertyHandle.svgAttribute()); |
| 532 ASSERT(attribute); | 581 ASSERT(attribute); |
| 533 | 582 |
| 534 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase( )->cloneForAnimation(m_value); | 583 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase( )->cloneForAnimation(m_value); |
| 535 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()- >cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); | 584 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()- >cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); |
| 536 | 585 |
| 537 if (!fromValue || !toValue) | 586 if (!fromValue || !toValue) |
| 538 return nullptr; | 587 return nullptr; |
| 539 | 588 |
| 540 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get( )); | 589 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get( )); |
| 541 } | 590 } |
| 542 | 591 |
| 543 } // namespace blink | 592 } // namespace blink |
| OLD | NEW |