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

Unified Diff: Source/core/animation/AnimatableImage.cpp

Issue 196573030: Web Animations API: Load resources referenced in element.animate() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/animation/AnimatableImage.h ('k') | Source/core/animation/AnimatableValueTestHelper.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/AnimatableImage.cpp
diff --git a/Source/core/animation/AnimatableImage.cpp b/Source/core/animation/AnimatableImage.cpp
index 49df97fcd58d564b424d0fe03a49ea3167b0a7a2..ea2e60da5606efa842057c797b61b93fe5b9e60d 100644
--- a/Source/core/animation/AnimatableImage.cpp
+++ b/Source/core/animation/AnimatableImage.cpp
@@ -40,48 +40,26 @@ namespace WebCore {
// FIXME: Once cross-fade works on generated image types, remove this method.
bool AnimatableImage::usesDefaultInterpolationWith(const AnimatableValue* value) const
{
- RefPtrWillBeRawPtr<CSSValue> fromValue = toCSSValue();
- if (fromValue->isImageGeneratorValue())
+ if (!m_value->isImageValue())
return true;
- if (!fromValue->isImageValue() && !m_image->isImageResource())
- return true;
- const AnimatableImage* image = toAnimatableImage(value);
- RefPtrWillBeRawPtr<CSSValue> toValue = image->toCSSValue();
- if (toValue->isImageGeneratorValue())
- return true;
- if (!toValue->isImageValue() && !image->m_image->isImageResource())
+ if (!toAnimatableImage(value)->toCSSValue()->isImageValue())
return true;
return false;
}
PassRefPtr<AnimatableValue> AnimatableImage::interpolateTo(const AnimatableValue* value, double fraction) const
{
- if (fraction <= 0 || fraction >= 1)
- return defaultInterpolateTo(this, value, fraction);
- RefPtrWillBeRawPtr<CSSValue> fromValue = toCSSValue();
- // FIXME: Once cross-fade works on generated image types, remove this check.
- if (fromValue->isImageGeneratorValue())
+ if (fraction <= 0 || fraction >= 1 || usesDefaultInterpolationWith(value))
return defaultInterpolateTo(this, value, fraction);
- if (!fromValue->isImageValue() && !fromValue->isImageGeneratorValue()) {
- if (!m_image->isImageResource())
- return defaultInterpolateTo(this, value, fraction);
- ImageResource* resource = static_cast<ImageResource*>(m_image->data());
- fromValue = CSSImageValue::create(resource->url(), m_image.get());
- }
- const AnimatableImage* image = toAnimatableImage(value);
- RefPtrWillBeRawPtr<CSSValue> toValue = image->toCSSValue();
- // FIXME: Once cross-fade works on generated image types, remove this check.
dstockwell 2014/03/18 01:02:35 Does this work now?
alancutter (OOO until 2018) 2014/03/18 02:43:53 This FIXME is still on the usesDefaultInterpolatio
- if (toValue->isImageGeneratorValue())
- return defaultInterpolateTo(this, value, fraction);
- if (!toValue->isImageValue() && !toValue->isImageGeneratorValue()) {
- if (!image->m_image->isImageResource())
- return defaultInterpolateTo(this, value, fraction);
- ImageResource* resource = static_cast<ImageResource*>(image->m_image->data());
- toValue = CSSImageValue::create(resource->url(), image->m_image.get());
- }
+
+ CSSValue* fromValue = toCSSValue();
+ CSSValue* toValue = toAnimatableImage(value)->toCSSValue();
+ ASSERT(fromValue->isImageValue());
+ ASSERT(toValue->isImageValue());
+
RefPtrWillBeRawPtr<CSSCrossfadeValue> crossfadeValue = CSSCrossfadeValue::create(fromValue, toValue);
crossfadeValue->setPercentage(CSSPrimitiveValue::create(fraction, CSSPrimitiveValue::CSS_NUMBER));
- return create(StyleGeneratedImage::create(crossfadeValue.get()).get());
+ return create(crossfadeValue);
}
PassRefPtr<AnimatableValue> AnimatableImage::addWith(const AnimatableValue* value) const
@@ -92,7 +70,7 @@ PassRefPtr<AnimatableValue> AnimatableImage::addWith(const AnimatableValue* valu
bool AnimatableImage::equalTo(const AnimatableValue* value) const
{
- return StyleImage::imagesEquivalent(m_image.get(), toAnimatableImage(value)->m_image.get());
+ return m_value->equals(*toAnimatableImage(value)->m_value.get());
}
}
« no previous file with comments | « Source/core/animation/AnimatableImage.h ('k') | Source/core/animation/AnimatableValueTestHelper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698