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 "config.h" | 31 #include "config.h" |
32 #include "core/animation/animatable/AnimatableSVGPaint.h" | 32 #include "core/animation/animatable/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->paintTy
pe() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR) | 39 return (paintType() != SVG_PAINTTYPE_RGBCOLOR || svgPaint->paintType() != SV
G_PAINTTYPE_RGBCOLOR) |
40 && (visitedLinkPaintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR || svgPai
nt->visitedLinkPaintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR); | 40 && (visitedLinkPaintType() != SVG_PAINTTYPE_RGBCOLOR || svgPaint->visite
dLinkPaintType() != SVG_PAINTTYPE_RGBCOLOR); |
41 } | 41 } |
42 | 42 |
43 PassRefPtrWillBeRawPtr<AnimatableValue> AnimatableSVGPaint::interpolateTo(const
AnimatableValue* value, double fraction) const | 43 PassRefPtrWillBeRawPtr<AnimatableValue> AnimatableSVGPaint::interpolateTo(const
AnimatableValue* value, double fraction) const |
44 { | 44 { |
45 if (usesDefaultInterpolationWith(value)) | 45 if (usesDefaultInterpolationWith(value)) |
46 return defaultInterpolateTo(this, value, fraction); | 46 return defaultInterpolateTo(this, value, fraction); |
47 | 47 |
48 const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value); | 48 const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value); |
49 RefPtrWillBeRawPtr<AnimatableColor> color = toAnimatableColor(AnimatableValu
e::interpolate(m_color.get(), svgPaint->m_color.get(), fraction).get()); | 49 RefPtrWillBeRawPtr<AnimatableColor> color = toAnimatableColor(AnimatableValu
e::interpolate(m_color.get(), svgPaint->m_color.get(), fraction).get()); |
50 if (fraction < 0.5) | 50 if (fraction < 0.5) |
51 return create(paintType(), visitedLinkPaintType(), color, uri(), visited
LinkURI()); | 51 return create(paintType(), visitedLinkPaintType(), color, uri(), visited
LinkURI()); |
52 return create(svgPaint->paintType(), svgPaint->visitedLinkPaintType(), color
, svgPaint->uri(), svgPaint->visitedLinkURI()); | 52 return create(svgPaint->paintType(), svgPaint->visitedLinkPaintType(), color
, svgPaint->uri(), svgPaint->visitedLinkURI()); |
53 } | 53 } |
54 | 54 |
55 bool AnimatableSVGPaint::equalTo(const AnimatableValue* value) const | 55 bool AnimatableSVGPaint::equalTo(const AnimatableValue* value) const |
56 { | 56 { |
57 const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value); | 57 const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value); |
58 return paintType() == svgPaint->paintType() | 58 return paintType() == svgPaint->paintType() |
59 && visitedLinkPaintType() == svgPaint->visitedLinkPaintType() | 59 && visitedLinkPaintType() == svgPaint->visitedLinkPaintType() |
60 && color() == svgPaint->color() | 60 && color() == svgPaint->color() |
61 && uri() == svgPaint->uri() | 61 && uri() == svgPaint->uri() |
62 && visitedLinkURI() == svgPaint->visitedLinkURI(); | 62 && visitedLinkURI() == svgPaint->visitedLinkURI(); |
63 } | 63 } |
64 | 64 |
65 } | 65 } |
OLD | NEW |