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 15 matching lines...) Expand all Loading... |
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 SVGMatrixTearOff_h | 31 #ifndef SVGMatrixTearOff_h |
32 #define SVGMatrixTearOff_h | 32 #define SVGMatrixTearOff_h |
33 | 33 |
34 #include "bindings/core/v8/ExceptionState.h" | 34 #include "bindings/core/v8/ExceptionState.h" |
35 #include "bindings/core/v8/ScriptWrappable.h" | 35 #include "bindings/core/v8/ScriptWrappable.h" |
| 36 #include "platform/heap/Handle.h" |
36 #include "platform/transforms/AffineTransform.h" | 37 #include "platform/transforms/AffineTransform.h" |
37 #include "wtf/RefCounted.h" | 38 #include "wtf/RefCounted.h" |
38 | 39 |
39 namespace blink { | 40 namespace blink { |
40 | 41 |
41 class SVGTransformTearOff; | 42 class SVGTransformTearOff; |
42 | 43 |
43 // SVGMatrixTearOff wraps a AffineTransform for Javascript. | 44 // SVGMatrixTearOff wraps a AffineTransform for Javascript. |
44 // Its instance can either hold a static value, or this can be teared off from |
SVGTransform.matrix|. | 45 // Its instance can either hold a static value, or this can be teared off from |
SVGTransform.matrix|. |
45 // This does not derive from SVGPropertyTearOff, as its instances are never tied
to an animated property nor an XML attribute. | 46 // This does not derive from SVGPropertyTearOff, as its instances are never tied
to an animated property nor an XML attribute. |
46 class SVGMatrixTearOff final : public RefCounted<SVGMatrixTearOff>, public Scrip
tWrappable { | 47 class SVGMatrixTearOff final : public RefCountedWillBeGarbageCollectedFinalized<
SVGMatrixTearOff>, public ScriptWrappable { |
47 DEFINE_WRAPPERTYPEINFO(); | 48 DEFINE_WRAPPERTYPEINFO(); |
48 public: | 49 public: |
49 static PassRefPtr<SVGMatrixTearOff> create(const AffineTransform& value) | 50 static PassRefPtrWillBeRawPtr<SVGMatrixTearOff> create(const AffineTransform
& value) |
50 { | 51 { |
51 return adoptRef(new SVGMatrixTearOff(value)); | 52 return adoptRefWillBeNoop(new SVGMatrixTearOff(value)); |
52 } | 53 } |
53 | 54 |
54 static PassRefPtr<SVGMatrixTearOff> create(SVGTransformTearOff* target) | 55 static PassRefPtrWillBeRawPtr<SVGMatrixTearOff> create(SVGTransformTearOff*
target) |
55 { | 56 { |
56 return adoptRef(new SVGMatrixTearOff(target)); | 57 return adoptRefWillBeNoop(new SVGMatrixTearOff(target)); |
57 } | 58 } |
58 | 59 |
59 ~SVGMatrixTearOff(); | 60 ~SVGMatrixTearOff(); |
60 | 61 |
61 double a() { return value().a(); } | 62 double a() { return value().a(); } |
62 double b() { return value().b(); } | 63 double b() { return value().b(); } |
63 double c() { return value().c(); } | 64 double c() { return value().c(); } |
64 double d() { return value().d(); } | 65 double d() { return value().d(); } |
65 double e() { return value().e(); } | 66 double e() { return value().e(); } |
66 double f() { return value().f(); } | 67 double f() { return value().f(); } |
67 | 68 |
68 void setA(double, ExceptionState&); | 69 void setA(double, ExceptionState&); |
69 void setB(double, ExceptionState&); | 70 void setB(double, ExceptionState&); |
70 void setC(double, ExceptionState&); | 71 void setC(double, ExceptionState&); |
71 void setD(double, ExceptionState&); | 72 void setD(double, ExceptionState&); |
72 void setE(double, ExceptionState&); | 73 void setE(double, ExceptionState&); |
73 void setF(double, ExceptionState&); | 74 void setF(double, ExceptionState&); |
74 | 75 |
75 PassRefPtr<SVGMatrixTearOff> translate(double tx, double ty); | 76 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> translate(double tx, double ty); |
76 PassRefPtr<SVGMatrixTearOff> scale(double); | 77 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> scale(double); |
77 PassRefPtr<SVGMatrixTearOff> scaleNonUniform(double sx, double sy); | 78 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> scaleNonUniform(double sx, double s
y); |
78 PassRefPtr<SVGMatrixTearOff> rotate(double); | 79 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> rotate(double); |
79 PassRefPtr<SVGMatrixTearOff> flipX(); | 80 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> flipX(); |
80 PassRefPtr<SVGMatrixTearOff> flipY(); | 81 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> flipY(); |
81 PassRefPtr<SVGMatrixTearOff> skewX(double); | 82 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> skewX(double); |
82 PassRefPtr<SVGMatrixTearOff> skewY(double); | 83 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> skewY(double); |
83 PassRefPtr<SVGMatrixTearOff> multiply(PassRefPtr<SVGMatrixTearOff>); | 84 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> multiply(PassRefPtrWillBeRawPtr<SVG
MatrixTearOff>); |
84 PassRefPtr<SVGMatrixTearOff> inverse(ExceptionState&); | 85 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> inverse(ExceptionState&); |
85 PassRefPtr<SVGMatrixTearOff> rotateFromVector(double x, double y, ExceptionS
tate&); | 86 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> rotateFromVector(double x, double y
, ExceptionState&); |
86 | 87 |
87 SVGTransformTearOff* contextTransform() { return m_contextTransform; } | 88 SVGTransformTearOff* contextTransform() { return m_contextTransform; } |
88 | 89 |
89 const AffineTransform& value() const; | 90 const AffineTransform& value() const; |
90 | 91 |
| 92 virtual void trace(Visitor*); |
| 93 |
91 private: | 94 private: |
92 SVGMatrixTearOff(const AffineTransform&); | 95 explicit SVGMatrixTearOff(const AffineTransform&); |
93 SVGMatrixTearOff(SVGTransformTearOff*); | 96 explicit SVGMatrixTearOff(SVGTransformTearOff*); |
94 | 97 |
95 AffineTransform* mutableValue(); | 98 AffineTransform* mutableValue(); |
96 void commitChange(); | 99 void commitChange(); |
97 | 100 |
98 AffineTransform m_staticValue; | 101 AffineTransform m_staticValue; |
99 | 102 |
100 // FIXME: oilpan: This is raw-ptr to avoid reference cycles. Should be Membe
r in oilpan. | 103 RawPtrWillBeMember<SVGTransformTearOff> m_contextTransform; |
101 SVGTransformTearOff* m_contextTransform; | |
102 }; | 104 }; |
103 | 105 |
104 } // namespace blink | 106 } // namespace blink |
105 | 107 |
106 #endif // SVGMatrixTearOff_h | 108 #endif // SVGMatrixTearOff_h |
OLD | NEW |