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 10 matching lines...) Expand all Loading... |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
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 SVGTransformList_h | 31 #ifndef SVGPath_h |
32 #define SVGTransformList_h | 32 #define SVGPath_h |
33 | 33 |
34 #include "bindings/core/v8/ScriptWrappable.h" | 34 #include "core/svg/properties/SVGProperty.h" |
35 #include "core/svg/SVGTransform.h" | |
36 #include "core/svg/properties/SVGListPropertyHelper.h" | |
37 | 35 |
38 namespace blink { | 36 namespace blink { |
39 | 37 |
40 class SVGTransformListTearOff; | 38 class ExceptionState; |
| 39 class SVGPathByteStream; |
41 | 40 |
42 class SVGTransformList final : public SVGListPropertyHelper<SVGTransformList, SV
GTransform> { | 41 class SVGPath : public SVGPropertyBase { |
43 public: | 42 public: |
44 typedef SVGTransformListTearOff TearOffType; | 43 typedef void TearOffType; |
45 | 44 |
46 static PassRefPtrWillBeRawPtr<SVGTransformList> create() | 45 static PassRefPtrWillBeRawPtr<SVGPath> create() |
47 { | 46 { |
48 return adoptRefWillBeNoop(new SVGTransformList()); | 47 return adoptRefWillBeNoop(new SVGPath()); |
49 } | 48 } |
50 | 49 |
51 static PassRefPtrWillBeRawPtr<SVGTransformList> create(SVGTransformType, con
st String&); | 50 ~SVGPath() override; |
52 | 51 |
53 ~SVGTransformList() override; | 52 const SVGPathByteStream& byteStream() const; |
54 | 53 SVGPathByteStream& mutableByteStream(); |
55 PassRefPtrWillBeRawPtr<SVGTransform> consolidate(); | |
56 | |
57 bool concatenate(AffineTransform& result) const; | |
58 | 54 |
59 // SVGPropertyBase: | 55 // SVGPropertyBase: |
| 56 PassRefPtrWillBeRawPtr<SVGPath> clone() const; |
60 PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const String&) con
st override; | 57 PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const String&) con
st override; |
61 String valueAsString() const override; | 58 String valueAsString() const override; |
62 void setValueAsString(const String&, ExceptionState&); | 59 void setValueAsString(const String&, ExceptionState&); |
63 bool parse(const UChar*& ptr, const UChar* end); | |
64 bool parse(const LChar*& ptr, const LChar* end); | |
65 | 60 |
66 void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) override; | 61 void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) override; |
67 void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned
repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> fromValue, PassRefPtrWillB
eRawPtr<SVGPropertyBase> toValue, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEn
dOfDurationValue, SVGElement*) override; | 62 void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned
repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> fromValue, PassRefPtrWillB
eRawPtr<SVGPropertyBase> toValue, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEn
dOfDurationValue, SVGElement*) override; |
68 float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGEleme
nt*) override; | 63 float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGEleme
nt*) override; |
69 | 64 |
70 static AnimatedPropertyType classType() { return AnimatedTransformList; } | 65 static AnimatedPropertyType classType() { return AnimatedPath; } |
71 | 66 |
72 private: | 67 private: |
73 SVGTransformList(); | 68 SVGPath(); |
| 69 explicit SVGPath(PassOwnPtr<SVGPathByteStream>); |
74 | 70 |
75 template <typename CharType> | 71 OwnPtr<SVGPathByteStream> m_byteStream; |
76 bool parseInternal(const CharType*& ptr, const CharType* end); | |
77 }; | 72 }; |
78 | 73 |
| 74 inline PassRefPtrWillBeRawPtr<SVGPath> toSVGPath(PassRefPtrWillBeRawPtr<SVGPrope
rtyBase> passBase) |
| 75 { |
| 76 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase; |
| 77 ASSERT(base->type() == SVGPath::classType()); |
| 78 return static_pointer_cast<SVGPath>(base.release()); |
| 79 } |
| 80 |
79 } // namespace blink | 81 } // namespace blink |
80 | 82 |
81 #endif // SVGTransformList_h | 83 #endif |
OLD | NEW |