Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: Source/core/svg/SVGTransformTearOff.cpp

Issue 153883003: [SVG] SVGAnimatedTransform{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: haraken review Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 11 matching lines...) Expand all
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 #include "config.h" 31 #include "config.h"
32 32 #include "core/svg/SVGTransformTearOff.h"
33 #include "core/svg/SVGRectTearOff.h"
34 33
35 #include "bindings/v8/ExceptionState.h" 34 #include "bindings/v8/ExceptionState.h"
36 #include "core/dom/ExceptionCode.h" 35 #include "core/dom/ExceptionCode.h"
37 36
38 namespace WebCore { 37 namespace WebCore {
39 38
40 SVGRectTearOff::SVGRectTearOff(PassRefPtr<SVGRect> target, SVGElement* contextEl ement, PropertyIsAnimValType propertyIsAnimVal, const QualifiedName& attributeNa me) 39 SVGTransformTearOff::SVGTransformTearOff(PassRefPtr<SVGTransform> target, SVGEle ment* contextElement, PropertyIsAnimValType propertyIsAnimVal, const QualifiedNa me& attributeName)
41 : NewSVGPropertyTearOff<SVGRect>(target, contextElement, propertyIsAnimVal, attributeName) 40 : NewSVGPropertyTearOff<SVGTransform>(target, contextElement, propertyIsAnim Val, attributeName)
42 { 41 {
43 ScriptWrappable::init(this); 42 ScriptWrappable::init(this);
44 } 43 }
45 44
46 void SVGRectTearOff::setX(float f, ExceptionState& exceptionState) 45 SVGTransformTearOff::~SVGTransformTearOff()
46 {
47 }
48
49 SVGMatrixTearOff* SVGTransformTearOff::matrix()
50 {
51 if (!m_matrixTearoff) {
52 m_matrixTearoff = SVGMatrixTearOff::create(this);
53 }
54
55 return m_matrixTearoff.get();
56 }
57
58 void SVGTransformTearOff::setMatrix(PassRefPtr<SVGMatrixTearOff> matrix, Excepti onState& exceptionState)
47 { 59 {
48 if (isImmutable()) { 60 if (isImmutable()) {
49 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only."); 61 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only.");
50 return; 62 return;
51 } 63 }
52 64
53 target()->setX(f); 65 target()->setMatrix(matrix->value());
54 commitChange(); 66 commitChange();
55 } 67 }
56 68
57 void SVGRectTearOff::setY(float f, ExceptionState& exceptionState) 69 void SVGTransformTearOff::setTranslate(float tx, float ty, ExceptionState& excep tionState)
58 { 70 {
59 if (isImmutable()) { 71 if (isImmutable()) {
60 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only."); 72 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only.");
61 return; 73 return;
62 } 74 }
63 75
64 target()->setY(f); 76 target()->setTranslate(tx, ty);
65 commitChange(); 77 commitChange();
66 } 78 }
67 79
68 void SVGRectTearOff::setWidth(float f, ExceptionState& exceptionState) 80 void SVGTransformTearOff::setScale(float sx, float sy, ExceptionState& exception State)
69 { 81 {
70 if (isImmutable()) { 82 if (isImmutable()) {
71 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only."); 83 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only.");
72 return; 84 return;
73 } 85 }
74 86
75 target()->setWidth(f); 87 target()->setScale(sx, sy);
76 commitChange(); 88 commitChange();
77 } 89 }
78 90
79 void SVGRectTearOff::setHeight(float f, ExceptionState& exceptionState) 91 void SVGTransformTearOff::setRotate(float angle, float cx, float cy, ExceptionSt ate& exceptionState)
80 { 92 {
81 if (isImmutable()) { 93 if (isImmutable()) {
82 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only."); 94 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only.");
83 return; 95 return;
84 } 96 }
85 97
86 target()->setHeight(f); 98 target()->setRotate(angle, cx, cy);
87 commitChange(); 99 commitChange();
88 } 100 }
89 101
102 void SVGTransformTearOff::setSkewX(float x, ExceptionState& exceptionState)
103 {
104 if (isImmutable()) {
105 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only.");
106 return;
107 }
108
109 target()->setSkewX(x);
110 commitChange();
111 }
112
113 void SVGTransformTearOff::setSkewY(float y, ExceptionState& exceptionState)
114 {
115 if (isImmutable()) {
116 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only.");
117 return;
118 }
119
120 target()->setSkewY(y);
121 commitChange();
122 }
123
90 } 124 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698