| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef SVGPoint_h | 31 #ifndef SVGPoint_h |
| 32 #define SVGPoint_h | 32 #define SVGPoint_h |
| 33 | 33 |
| 34 #include "core/svg/properties/NewSVGProperty.h" | 34 #include "core/svg/properties/SVGProperty.h" |
| 35 #include "platform/geometry/FloatPoint.h" | 35 #include "platform/geometry/FloatPoint.h" |
| 36 | 36 |
| 37 namespace WebCore { | 37 namespace WebCore { |
| 38 | 38 |
| 39 class AffineTransform; | 39 class AffineTransform; |
| 40 class SVGPointTearOff; | 40 class SVGPointTearOff; |
| 41 | 41 |
| 42 class SVGPoint : public NewSVGPropertyBase { | 42 class SVGPoint : public SVGPropertyBase { |
| 43 public: | 43 public: |
| 44 typedef SVGPointTearOff TearOffType; | 44 typedef SVGPointTearOff TearOffType; |
| 45 | 45 |
| 46 static PassRefPtr<SVGPoint> create() | 46 static PassRefPtr<SVGPoint> create() |
| 47 { | 47 { |
| 48 return adoptRef(new SVGPoint()); | 48 return adoptRef(new SVGPoint()); |
| 49 } | 49 } |
| 50 | 50 |
| 51 static PassRefPtr<SVGPoint> create(const FloatPoint& point) | 51 static PassRefPtr<SVGPoint> create(const FloatPoint& point) |
| 52 { | 52 { |
| 53 return adoptRef(new SVGPoint(point)); | 53 return adoptRef(new SVGPoint(point)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 PassRefPtr<SVGPoint> clone() const; | 56 PassRefPtr<SVGPoint> clone() const; |
| 57 virtual PassRefPtr<NewSVGPropertyBase> cloneForAnimation(const String&) cons
t OVERRIDE; | 57 virtual PassRefPtr<SVGPropertyBase> cloneForAnimation(const String&) const O
VERRIDE; |
| 58 | 58 |
| 59 const FloatPoint& value() const { return m_value; } | 59 const FloatPoint& value() const { return m_value; } |
| 60 void setValue(const FloatPoint& value) { m_value = value; } | 60 void setValue(const FloatPoint& value) { m_value = value; } |
| 61 | 61 |
| 62 float x() const { return m_value.x(); } | 62 float x() const { return m_value.x(); } |
| 63 float y() const { return m_value.y(); } | 63 float y() const { return m_value.y(); } |
| 64 void setX(float f) { m_value.setX(f); } | 64 void setX(float f) { m_value.setX(f); } |
| 65 void setY(float f) { m_value.setY(f); } | 65 void setY(float f) { m_value.setY(f); } |
| 66 | 66 |
| 67 FloatPoint matrixTransform(const AffineTransform&) const; | 67 FloatPoint matrixTransform(const AffineTransform&) const; |
| 68 | 68 |
| 69 bool operator==(const SVGPoint&) const; | 69 bool operator==(const SVGPoint&) const; |
| 70 bool operator!=(const SVGPoint& other) const { return !operator==(other); } | 70 bool operator!=(const SVGPoint& other) const { return !operator==(other); } |
| 71 | 71 |
| 72 virtual String valueAsString() const OVERRIDE; | 72 virtual String valueAsString() const OVERRIDE; |
| 73 void setValueAsString(const String&, ExceptionState&); | 73 void setValueAsString(const String&, ExceptionState&); |
| 74 | 74 |
| 75 virtual void add(PassRefPtr<NewSVGPropertyBase>, SVGElement*) OVERRIDE; | 75 virtual void add(PassRefPtr<SVGPropertyBase>, SVGElement*) OVERRIDE; |
| 76 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage,
unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> from, PassRefPtr<NewSVGProp
ertyBase> to, PassRefPtr<NewSVGPropertyBase> toAtEndOfDurationValue, SVGElement*
contextElement) OVERRIDE; | 76 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage,
unsigned repeatCount, PassRefPtr<SVGPropertyBase> from, PassRefPtr<SVGPropertyBa
se> to, PassRefPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement* contextE
lement) OVERRIDE; |
| 77 virtual float calculateDistance(PassRefPtr<NewSVGPropertyBase> to, SVGElemen
t* contextElement) OVERRIDE; | 77 virtual float calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElement*
contextElement) OVERRIDE; |
| 78 | 78 |
| 79 static AnimatedPropertyType classType() { return AnimatedPoint; } | 79 static AnimatedPropertyType classType() { return AnimatedPoint; } |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 SVGPoint(); | 82 SVGPoint(); |
| 83 explicit SVGPoint(const FloatPoint&); | 83 explicit SVGPoint(const FloatPoint&); |
| 84 | 84 |
| 85 template<typename CharType> | 85 template<typename CharType> |
| 86 void parse(const CharType*& ptr, const CharType* end, ExceptionState&); | 86 void parse(const CharType*& ptr, const CharType* end, ExceptionState&); |
| 87 | 87 |
| 88 FloatPoint m_value; | 88 FloatPoint m_value; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 inline PassRefPtr<SVGPoint> toSVGPoint(PassRefPtr<NewSVGPropertyBase> passBase) | 91 inline PassRefPtr<SVGPoint> toSVGPoint(PassRefPtr<SVGPropertyBase> passBase) |
| 92 { | 92 { |
| 93 RefPtr<NewSVGPropertyBase> base = passBase; | 93 RefPtr<SVGPropertyBase> base = passBase; |
| 94 ASSERT(base->type() == SVGPoint::classType()); | 94 ASSERT(base->type() == SVGPoint::classType()); |
| 95 return static_pointer_cast<SVGPoint>(base.release()); | 95 return static_pointer_cast<SVGPoint>(base.release()); |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace WebCore | 98 } // namespace WebCore |
| 99 | 99 |
| 100 #endif // SVGPoint_h | 100 #endif // SVGPoint_h |
| OLD | NEW |