OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 23 matching lines...) Expand all Loading... |
34 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::cxAttr, Cx, cx) | 34 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::cxAttr, Cx, cx) |
35 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::cyAttr, Cy, cy) | 35 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::cyAttr, Cy, cy) |
36 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::rAttr, R, r) | 36 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::rAttr, R, r) |
37 DEFINE_ANIMATED_BOOLEAN(SVGCircleElement, SVGNames::externalResourcesRequiredAtt
r, ExternalResourcesRequired, externalResourcesRequired) | 37 DEFINE_ANIMATED_BOOLEAN(SVGCircleElement, SVGNames::externalResourcesRequiredAtt
r, ExternalResourcesRequired, externalResourcesRequired) |
38 | 38 |
39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCircleElement) | 39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCircleElement) |
40 REGISTER_LOCAL_ANIMATED_PROPERTY(cx) | 40 REGISTER_LOCAL_ANIMATED_PROPERTY(cx) |
41 REGISTER_LOCAL_ANIMATED_PROPERTY(cy) | 41 REGISTER_LOCAL_ANIMATED_PROPERTY(cy) |
42 REGISTER_LOCAL_ANIMATED_PROPERTY(r) | 42 REGISTER_LOCAL_ANIMATED_PROPERTY(r) |
43 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | 43 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) |
44 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledTransformableElement) | 44 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
45 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) | |
46 END_REGISTER_ANIMATED_PROPERTIES | 45 END_REGISTER_ANIMATED_PROPERTIES |
47 | 46 |
48 inline SVGCircleElement::SVGCircleElement(const QualifiedName& tagName, Document
* document) | 47 inline SVGCircleElement::SVGCircleElement(const QualifiedName& tagName, Document
* document) |
49 : SVGStyledTransformableElement(tagName, document) | 48 : SVGGraphicsElement(tagName, document) |
50 , m_cx(LengthModeWidth) | 49 , m_cx(LengthModeWidth) |
51 , m_cy(LengthModeHeight) | 50 , m_cy(LengthModeHeight) |
52 , m_r(LengthModeOther) | 51 , m_r(LengthModeOther) |
53 { | 52 { |
54 ASSERT(hasTagName(SVGNames::circleTag)); | 53 ASSERT(hasTagName(SVGNames::circleTag)); |
55 ScriptWrappable::init(this); | 54 ScriptWrappable::init(this); |
56 registerAnimatedPropertiesForSVGCircleElement(); | 55 registerAnimatedPropertiesForSVGCircleElement(); |
57 } | 56 } |
58 | 57 |
59 PassRefPtr<SVGCircleElement> SVGCircleElement::create(const QualifiedName& tagNa
me, Document* document) | 58 PassRefPtr<SVGCircleElement> SVGCircleElement::create(const QualifiedName& tagNa
me, Document* document) |
(...skipping 13 matching lines...) Expand all Loading... |
73 supportedAttributes.add(SVGNames::rAttr); | 72 supportedAttributes.add(SVGNames::rAttr); |
74 } | 73 } |
75 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 74 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
76 } | 75 } |
77 | 76 |
78 void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 77 void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
79 { | 78 { |
80 SVGParsingError parseError = NoError; | 79 SVGParsingError parseError = NoError; |
81 | 80 |
82 if (!isSupportedAttribute(name)) | 81 if (!isSupportedAttribute(name)) |
83 SVGStyledTransformableElement::parseAttribute(name, value); | 82 SVGGraphicsElement::parseAttribute(name, value); |
84 else if (name == SVGNames::cxAttr) | 83 else if (name == SVGNames::cxAttr) |
85 setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; | 84 setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; |
86 else if (name == SVGNames::cyAttr) | 85 else if (name == SVGNames::cyAttr) |
87 setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); | 86 setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); |
88 else if (name == SVGNames::rAttr) | 87 else if (name == SVGNames::rAttr) |
89 setRBaseValue(SVGLength::construct(LengthModeOther, value, parseError, F
orbidNegativeLengths)); | 88 setRBaseValue(SVGLength::construct(LengthModeOther, value, parseError, F
orbidNegativeLengths)); |
90 else if (SVGTests::parseAttribute(name, value) | 89 else if (SVGTests::parseAttribute(name, value) |
91 || SVGLangSpace::parseAttribute(name, value) | 90 || SVGLangSpace::parseAttribute(name, value) |
92 || SVGExternalResourcesRequired::parseAttribute(name, value)) { | 91 || SVGExternalResourcesRequired::parseAttribute(name, value)) { |
93 } else | 92 } else |
94 ASSERT_NOT_REACHED(); | 93 ASSERT_NOT_REACHED(); |
95 | 94 |
96 reportAttributeParsingError(parseError, name, value); | 95 reportAttributeParsingError(parseError, name, value); |
97 } | 96 } |
98 | 97 |
99 void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName) | 98 void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName) |
100 { | 99 { |
101 if (!isSupportedAttribute(attrName)) { | 100 if (!isSupportedAttribute(attrName)) { |
102 SVGStyledTransformableElement::svgAttributeChanged(attrName); | 101 SVGGraphicsElement::svgAttributeChanged(attrName); |
103 return; | 102 return; |
104 } | 103 } |
105 | 104 |
106 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 105 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
107 | 106 |
108 bool isLengthAttribute = attrName == SVGNames::cxAttr | 107 bool isLengthAttribute = attrName == SVGNames::cxAttr |
109 || attrName == SVGNames::cyAttr | 108 || attrName == SVGNames::cyAttr |
110 || attrName == SVGNames::rAttr; | 109 || attrName == SVGNames::rAttr; |
111 | 110 |
112 if (isLengthAttribute) | 111 if (isLengthAttribute) |
(...skipping 26 matching lines...) Expand all Loading... |
139 || cy().isRelative() | 138 || cy().isRelative() |
140 || r().isRelative(); | 139 || r().isRelative(); |
141 } | 140 } |
142 | 141 |
143 RenderObject* SVGCircleElement::createRenderer(RenderStyle*) | 142 RenderObject* SVGCircleElement::createRenderer(RenderStyle*) |
144 { | 143 { |
145 return new (document()->renderArena()) RenderSVGEllipse(this); | 144 return new (document()->renderArena()) RenderSVGEllipse(this); |
146 } | 145 } |
147 | 146 |
148 } | 147 } |
OLD | NEW |