| 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 21 matching lines...) Expand all Loading... |
| 32 #include "core/animation/AnimatableSVGPaint.h" | 32 #include "core/animation/AnimatableSVGPaint.h" |
| 33 | 33 |
| 34 namespace WebCore { | 34 namespace WebCore { |
| 35 | 35 |
| 36 bool AnimatableSVGPaint::usesDefaultInterpolationWith(const AnimatableValue* val
ue) const | 36 bool AnimatableSVGPaint::usesDefaultInterpolationWith(const AnimatableValue* val
ue) const |
| 37 { | 37 { |
| 38 const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value); | 38 const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value); |
| 39 return paintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR || svgPaint->paintTyp
e() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR; | 39 return paintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR || svgPaint->paintTyp
e() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR; |
| 40 } | 40 } |
| 41 | 41 |
| 42 PassRefPtr<AnimatableValue> AnimatableSVGPaint::interpolateTo(const AnimatableVa
lue* value, double fraction) const | 42 PassRefPtrWillBeRawPtr<AnimatableValue> AnimatableSVGPaint::interpolateTo(const
AnimatableValue* value, double fraction) const |
| 43 { | 43 { |
| 44 const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value); | 44 const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value); |
| 45 if (paintType() == SVGPaint::SVG_PAINTTYPE_RGBCOLOR && svgPaint->paintType()
== SVGPaint::SVG_PAINTTYPE_RGBCOLOR) { | 45 if (paintType() == SVGPaint::SVG_PAINTTYPE_RGBCOLOR && svgPaint->paintType()
== SVGPaint::SVG_PAINTTYPE_RGBCOLOR) { |
| 46 ASSERT(uri().isNull()); | 46 ASSERT(uri().isNull()); |
| 47 return AnimatableSVGPaint::create(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, m_co
lor.interpolateTo(svgPaint->m_color, fraction), String()); | 47 return AnimatableSVGPaint::create(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, m_co
lor.interpolateTo(svgPaint->m_color, fraction), String()); |
| 48 } | 48 } |
| 49 return defaultInterpolateTo(this, value, fraction); | 49 return defaultInterpolateTo(this, value, fraction); |
| 50 } | 50 } |
| 51 | 51 |
| 52 PassRefPtr<AnimatableValue> AnimatableSVGPaint::addWith(const AnimatableValue* v
alue) const | 52 PassRefPtrWillBeRawPtr<AnimatableValue> AnimatableSVGPaint::addWith(const Animat
ableValue* value) const |
| 53 { | 53 { |
| 54 const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value); | 54 const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value); |
| 55 if (paintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR || svgPaint->paintType()
!= SVGPaint::SVG_PAINTTYPE_RGBCOLOR) { | 55 if (paintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR || svgPaint->paintType()
!= SVGPaint::SVG_PAINTTYPE_RGBCOLOR) { |
| 56 ASSERT(uri().isNull()); | 56 ASSERT(uri().isNull()); |
| 57 return AnimatableSVGPaint::create(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, m_co
lor.addWith(svgPaint->m_color), String()); | 57 return AnimatableSVGPaint::create(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, m_co
lor.addWith(svgPaint->m_color), String()); |
| 58 } | 58 } |
| 59 return defaultAddWith(this, value); | 59 return defaultAddWith(this, value); |
| 60 } | 60 } |
| 61 | 61 |
| 62 bool AnimatableSVGPaint::equalTo(const AnimatableValue* value) const | 62 bool AnimatableSVGPaint::equalTo(const AnimatableValue* value) const |
| 63 { | 63 { |
| 64 const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value); | 64 const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value); |
| 65 return paintType() == svgPaint->paintType() | 65 return paintType() == svgPaint->paintType() |
| 66 && color() == svgPaint->color() | 66 && color() == svgPaint->color() |
| 67 && uri() == svgPaint->uri(); | 67 && uri() == svgPaint->uri(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void AnimatableSVGPaint::trace(Visitor* visitor) |
| 71 { |
| 72 AnimatableValue::trace(visitor); |
| 70 } | 73 } |
| 74 |
| 75 } |
| OLD | NEW |