Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / svg / SVGTransformTearOff.cpp
blob3fe9dccc310b3aba64326e67883dd2621a5bfc2c
1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
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.
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.
31 #include "config.h"
32 #include "core/svg/SVGTransformTearOff.h"
34 #include "bindings/core/v8/ExceptionState.h"
35 #include "core/dom/ExceptionCode.h"
36 #include "core/svg/SVGElement.h"
38 namespace blink {
40 SVGTransformTearOff::SVGTransformTearOff(PassRefPtrWillBeRawPtr<SVGTransform> target, SVGElement* contextElement, PropertyIsAnimValType propertyIsAnimVal, const QualifiedName& attributeName)
41 : SVGPropertyTearOff<SVGTransform>(target, contextElement, propertyIsAnimVal, attributeName)
45 SVGTransformTearOff::~SVGTransformTearOff()
49 DEFINE_TRACE(SVGTransformTearOff)
51 visitor->trace(m_matrixTearoff);
52 SVGPropertyTearOff<SVGTransform>::trace(visitor);
55 SVGMatrixTearOff* SVGTransformTearOff::matrix()
57 if (!m_matrixTearoff) {
58 m_matrixTearoff = SVGMatrixTearOff::create(this);
61 return m_matrixTearoff.get();
64 void SVGTransformTearOff::setMatrix(PassRefPtrWillBeRawPtr<SVGMatrixTearOff> matrix, ExceptionState& exceptionState)
66 if (isImmutable()) {
67 exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
68 return;
71 target()->setMatrix(matrix->value());
72 commitChange();
75 void SVGTransformTearOff::setTranslate(float tx, float ty, ExceptionState& exceptionState)
77 if (isImmutable()) {
78 exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
79 return;
82 target()->setTranslate(tx, ty);
83 commitChange();
86 void SVGTransformTearOff::setScale(float sx, float sy, ExceptionState& exceptionState)
88 if (isImmutable()) {
89 exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
90 return;
93 target()->setScale(sx, sy);
94 commitChange();
97 void SVGTransformTearOff::setRotate(float angle, float cx, float cy, ExceptionState& exceptionState)
99 if (isImmutable()) {
100 exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
101 return;
104 target()->setRotate(angle, cx, cy);
105 commitChange();
108 void SVGTransformTearOff::setSkewX(float x, ExceptionState& exceptionState)
110 if (isImmutable()) {
111 exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
112 return;
115 target()->setSkewX(x);
116 commitChange();
119 void SVGTransformTearOff::setSkewY(float y, ExceptionState& exceptionState)
121 if (isImmutable()) {
122 exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
123 return;
126 target()->setSkewY(y);
127 commitChange();