Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "core/animation/animatable/AnimatableImage.h" | 31 #include "core/animation/animatable/AnimatableImage.h" |
| 32 | 32 |
| 33 #include "core/css/CSSImageValue.h" | 33 #include "core/css/CSSImageValue.h" |
| 34 #include "core/style/StyleGeneratedImage.h" | 34 #include "core/style/StyleGeneratedImage.h" |
| 35 #include "wtf/MathExtras.h" | 35 #include "wtf/MathExtras.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 // FIXME: Once cross-fade works on generated image types, remove this method. | |
|
alancutter (OOO until 2018)
2016/09/27 01:14:14
AnimatableValues are deprecated.
| |
| 40 bool AnimatableImage::usesDefaultInterpolationWith(const AnimatableValue* value) const | 39 bool AnimatableImage::usesDefaultInterpolationWith(const AnimatableValue* value) const |
| 41 { | 40 { |
| 42 if (!m_value->isImageValue()) | 41 if (!m_value->isImageValue()) |
| 43 return true; | 42 return true; |
| 44 if (!toAnimatableImage(value)->toCSSValue()->isImageValue()) | 43 if (!toAnimatableImage(value)->toCSSValue()->isImageValue()) |
| 45 return true; | 44 return true; |
| 46 return false; | 45 return false; |
| 47 } | 46 } |
| 48 | 47 |
| 49 PassRefPtr<AnimatableValue> AnimatableImage::interpolateTo(const AnimatableValue * value, double fraction) const | 48 PassRefPtr<AnimatableValue> AnimatableImage::interpolateTo(const AnimatableValue * value, double fraction) const |
| 50 { | 49 { |
| 51 if (fraction <= 0 || fraction >= 1 || usesDefaultInterpolationWith(value)) | 50 if (fraction <= 0 || fraction >= 1 || usesDefaultInterpolationWith(value)) |
| 52 return defaultInterpolateTo(this, value, fraction); | 51 return defaultInterpolateTo(this, value, fraction); |
| 53 | 52 |
| 54 CSSValue* fromValue = toCSSValue(); | 53 CSSValue* fromValue = toCSSValue(); |
| 55 CSSValue* toValue = toAnimatableImage(value)->toCSSValue(); | 54 CSSValue* toValue = toAnimatableImage(value)->toCSSValue(); |
| 56 | 55 |
| 57 return create(CSSCrossfadeValue::create(fromValue, toValue, CSSPrimitiveValu e::create(fraction, CSSPrimitiveValue::UnitType::Number))); | 56 return create(CSSCrossfadeValue::create(fromValue, toValue, CSSPrimitiveValu e::create(fraction, CSSPrimitiveValue::UnitType::Number))); |
| 58 } | 57 } |
| 59 | 58 |
| 60 bool AnimatableImage::equalTo(const AnimatableValue* value) const | 59 bool AnimatableImage::equalTo(const AnimatableValue* value) const |
| 61 { | 60 { |
| 62 return m_value->equals(*toAnimatableImage(value)->m_value.get()); | 61 return m_value->equals(*toAnimatableImage(value)->m_value.get()); |
| 63 } | 62 } |
| 64 | 63 |
| 65 } // namespace blink | 64 } // namespace blink |
| OLD | NEW |