Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Samsung Electronics. 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 | 5 * modification, are permitted provided that the following conditions are |
| 6 * are met: | 6 * met: |
| 7 * 1. Redistributions of source code must retain the above copyright | |
| 8 * notice, this list of conditions and the following disclaimer. | |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | |
| 10 * notice, this list of conditions and the following disclaimer in the | |
| 11 * documentation and/or other materials provided with the distribution. | |
| 12 * | 7 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | 8 * * Redistributions of source code must retain the above copyright |
| 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | 9 * notice, this list of conditions and the following disclaimer. |
| 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 10 * * Redistributions in binary form must reproduce the above |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | 11 * copyright notice, this list of conditions and the following disclaimer |
| 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 12 * in the documentation and/or other materials provided with the |
| 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 13 * distribution. |
| 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 14 * * Neither the name of Google Inc. nor the names of its |
| 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 15 * contributors may be used to endorse or promote products derived from |
| 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 16 * this software without specific prior written permission. |
| 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 17 * |
| 23 * THE POSSIBILITY OF SUCH DAMAGE. | 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 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. | |
| 24 */ | 29 */ |
| 25 | 30 |
| 26 #ifndef SVGPoint_h | 31 #ifndef SVGPoint_h |
| 27 #define SVGPoint_h | 32 #define SVGPoint_h |
| 28 | 33 |
| 29 #include "platform/geometry/FloatRect.h" | 34 #include "core/svg/properties/NewSVGProperty.h" |
| 35 #include "platform/geometry/FloatPoint.h" | |
| 30 | 36 |
| 31 namespace WebCore { | 37 namespace WebCore { |
| 32 | 38 |
| 33 typedef FloatPoint SVGPoint; | 39 class AffineTransform; |
| 40 class SVGPointTearOff; | |
| 41 | |
| 42 class SVGPoint : public NewSVGPropertyBase { | |
| 43 public: | |
| 44 typedef SVGPointTearOff TearOffType; | |
| 45 | |
| 46 static PassRefPtr<SVGPoint> create() | |
| 47 { | |
| 48 return adoptRef(new SVGPoint()); | |
| 49 } | |
| 50 | |
| 51 static PassRefPtr<SVGPoint> create(const FloatPoint& point) | |
| 52 { | |
| 53 return adoptRef(new SVGPoint(point)); | |
| 54 } | |
| 55 | |
| 56 PassRefPtr<SVGPoint> clone() const; | |
| 57 virtual PassRefPtr<NewSVGPropertyBase> cloneForAnimation(const String&) cons t OVERRIDE; | |
| 58 | |
| 59 const FloatPoint& value() const { return m_value; } | |
| 60 void setValue(const FloatPoint& v) { m_value = v; } | |
|
haraken
2014/01/17 11:50:18
v => value
| |
| 61 | |
| 62 float x() const { return m_value.x(); } | |
| 63 float y() const { return m_value.y(); } | |
| 64 void setX(float f) { m_value.setX(f); } | |
| 65 void setY(float f) { m_value.setY(f); } | |
| 66 | |
| 67 FloatPoint matrixTransform(const AffineTransform&) const; | |
| 68 | |
| 69 bool operator==(const SVGPoint&) const; | |
| 70 bool operator!=(const SVGPoint& other) const { return !operator==(other); } | |
| 71 | |
| 72 virtual String valueAsString() const OVERRIDE; | |
| 73 void setValueAsString(const String&, ExceptionState&); | |
| 74 | |
| 75 virtual void add(PassRefPtr<NewSVGPropertyBase>, SVGElement*) OVERRIDE; | |
| 76 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> from, PassRefPtr<NewSVGProp ertyBase> to, PassRefPtr<NewSVGPropertyBase> toAtEndOfDurationValue, SVGElement* contextElement) OVERRIDE; | |
| 77 virtual float calculateDistance(PassRefPtr<NewSVGPropertyBase> to, SVGElemen t* contextElement) OVERRIDE; | |
| 78 | |
| 79 static AnimatedPropertyType classType() { return AnimatedPoint; } | |
| 80 | |
| 81 private: | |
| 82 SVGPoint(); | |
| 83 SVGPoint(const FloatPoint&); | |
|
haraken
2014/01/17 11:50:18
Add explicit.
kouhei (in TOK)
2014/01/20 01:10:26
Done.
| |
| 84 | |
| 85 template<typename CharType> | |
| 86 void parse(const CharType*& ptr, const CharType* end, ExceptionState&); | |
| 87 | |
| 88 FloatPoint m_value; | |
| 89 }; | |
| 90 | |
| 91 inline PassRefPtr<SVGPoint> toSVGPoint(PassRefPtr<NewSVGPropertyBase> passBase) | |
| 92 { | |
| 93 RefPtr<NewSVGPropertyBase> base = passBase; | |
| 94 ASSERT(base->type() == SVGPoint::classType()); | |
| 95 return static_pointer_cast<SVGPoint>(base.release()); | |
| 96 } | |
| 34 | 97 |
| 35 } // namespace WebCore | 98 } // namespace WebCore |
| 36 | 99 |
| 37 #endif // SVGPoint_h | 100 #endif // SVGPoint_h |
| OLD | NEW |