OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * |
| 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are |
| 6 * met: |
| 7 * |
| 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the |
| 13 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. |
| 17 * |
| 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. |
| 29 */ |
| 30 |
| 31 #ifndef SVGMatrixTearOff_h |
| 32 #define SVGMatrixTearOff_h |
| 33 |
| 34 #include "bindings/v8/ScriptWrappable.h" |
| 35 #include "platform/transforms/AffineTransform.h" |
| 36 #include "wtf/RefCounted.h" |
| 37 |
| 38 namespace WebCore { |
| 39 |
| 40 class SVGTransformTearOff; |
| 41 |
| 42 // SVGMatrixTearOff wraps a AffineTransform for Javascript. |
| 43 // Its instance can either hold a static value, or this can be teared off from |
SVGTransform.matrix|. |
| 44 // This does not derive from NewSVGPropertyTearOff, as its instances are never t
ied to an animated property nor an XML attribute. |
| 45 class SVGMatrixTearOff FINAL : public RefCounted<SVGMatrixTearOff>, public Scrip
tWrappable { |
| 46 public: |
| 47 static PassRefPtr<SVGMatrixTearOff> create(const AffineTransform& value) |
| 48 { |
| 49 return adoptRef(new SVGMatrixTearOff(value)); |
| 50 } |
| 51 |
| 52 static PassRefPtr<SVGMatrixTearOff> create(SVGTransformTearOff* target) |
| 53 { |
| 54 return adoptRef(new SVGMatrixTearOff(target)); |
| 55 } |
| 56 |
| 57 ~SVGMatrixTearOff(); |
| 58 |
| 59 double a() { return value().a(); } |
| 60 double b() { return value().b(); } |
| 61 double c() { return value().c(); } |
| 62 double d() { return value().d(); } |
| 63 double e() { return value().e(); } |
| 64 double f() { return value().f(); } |
| 65 |
| 66 void setA(double, ExceptionState&); |
| 67 void setB(double, ExceptionState&); |
| 68 void setC(double, ExceptionState&); |
| 69 void setD(double, ExceptionState&); |
| 70 void setE(double, ExceptionState&); |
| 71 void setF(double, ExceptionState&); |
| 72 |
| 73 PassRefPtr<SVGMatrixTearOff> translate(double tx, double ty); |
| 74 PassRefPtr<SVGMatrixTearOff> scale(double); |
| 75 PassRefPtr<SVGMatrixTearOff> scaleNonUniform(double sx, double sy); |
| 76 PassRefPtr<SVGMatrixTearOff> rotate(double); |
| 77 PassRefPtr<SVGMatrixTearOff> flipX(); |
| 78 PassRefPtr<SVGMatrixTearOff> flipY(); |
| 79 PassRefPtr<SVGMatrixTearOff> skewX(double); |
| 80 PassRefPtr<SVGMatrixTearOff> skewY(double); |
| 81 PassRefPtr<SVGMatrixTearOff> multiply(PassRefPtr<SVGMatrixTearOff>); |
| 82 PassRefPtr<SVGMatrixTearOff> inverse(ExceptionState&); |
| 83 PassRefPtr<SVGMatrixTearOff> rotateFromVector(double x, double y, ExceptionS
tate&); |
| 84 |
| 85 SVGTransformTearOff* contextTransform() { return m_contextTransform; } |
| 86 |
| 87 const AffineTransform& value() const; |
| 88 |
| 89 private: |
| 90 SVGMatrixTearOff(const AffineTransform&); |
| 91 SVGMatrixTearOff(SVGTransformTearOff*); |
| 92 |
| 93 AffineTransform* mutableValue(); |
| 94 void commitChange(); |
| 95 |
| 96 AffineTransform m_staticValue; |
| 97 |
| 98 // FIXME: oilpan: This is raw-ptr to avoid reference cycles. Should be Membe
r in oilpan. |
| 99 SVGTransformTearOff* m_contextTransform; |
| 100 }; |
| 101 |
| 102 } // namespace WebCore |
| 103 |
| 104 #endif // SVGMatrixTearOff_h_ |
OLD | NEW |