summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/core/animation/AnimatableSVGPaint.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/animation/AnimatableSVGPaint.cpp')
-rw-r--r--chromium/third_party/WebKit/Source/core/animation/AnimatableSVGPaint.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/chromium/third_party/WebKit/Source/core/animation/AnimatableSVGPaint.cpp b/chromium/third_party/WebKit/Source/core/animation/AnimatableSVGPaint.cpp
index 784c9d32558..94eca3cd587 100644
--- a/chromium/third_party/WebKit/Source/core/animation/AnimatableSVGPaint.cpp
+++ b/chromium/third_party/WebKit/Source/core/animation/AnimatableSVGPaint.cpp
@@ -33,32 +33,33 @@
namespace WebCore {
-PassRefPtr<AnimatableValue> AnimatableSVGPaint::interpolateTo(const AnimatableValue* value, double fraction) const
+bool AnimatableSVGPaint::usesDefaultInterpolationWith(const AnimatableValue* value) const
{
const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value);
- if (paintType() == SVGPaint::SVG_PAINTTYPE_RGBCOLOR && svgPaint->paintType() == SVGPaint::SVG_PAINTTYPE_RGBCOLOR) {
- ASSERT(uri().isNull());
- return AnimatableSVGPaint::create(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, m_color.interpolateTo(svgPaint->m_color, fraction), String());
- }
- return defaultInterpolateTo(this, value, fraction);
+ return (paintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR || svgPaint->paintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR)
+ && (visitedLinkPaintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR || svgPaint->visitedLinkPaintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR);
}
-PassRefPtr<AnimatableValue> AnimatableSVGPaint::addWith(const AnimatableValue* value) const
+PassRefPtrWillBeRawPtr<AnimatableValue> AnimatableSVGPaint::interpolateTo(const AnimatableValue* value, double fraction) const
{
+ if (usesDefaultInterpolationWith(value))
+ return defaultInterpolateTo(this, value, fraction);
+
const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value);
- if (paintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR || svgPaint->paintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR) {
- ASSERT(uri().isNull());
- return AnimatableSVGPaint::create(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, m_color.addWith(svgPaint->m_color), String());
- }
- return defaultAddWith(this, value);
+ RefPtrWillBeRawPtr<AnimatableColor> color = toAnimatableColor(AnimatableValue::interpolate(m_color.get(), svgPaint->m_color.get(), fraction).get());
+ if (fraction < 0.5)
+ return create(paintType(), visitedLinkPaintType(), color, uri(), visitedLinkURI());
+ return create(svgPaint->paintType(), svgPaint->visitedLinkPaintType(), color, svgPaint->uri(), svgPaint->visitedLinkURI());
}
bool AnimatableSVGPaint::equalTo(const AnimatableValue* value) const
{
const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value);
return paintType() == svgPaint->paintType()
+ && visitedLinkPaintType() == svgPaint->visitedLinkPaintType()
&& color() == svgPaint->color()
- && uri() == svgPaint->uri();
+ && uri() == svgPaint->uri()
+ && visitedLinkURI() == svgPaint->visitedLinkURI();
}
}