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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 PassRefPtr<SVGCircleElement> SVGCircleElement::create(const QualifiedName& tagNa
me, Document* document) | 58 PassRefPtr<SVGCircleElement> SVGCircleElement::create(const QualifiedName& tagNa
me, Document* document) |
59 { | 59 { |
60 return adoptRef(new SVGCircleElement(tagName, document)); | 60 return adoptRef(new SVGCircleElement(tagName, document)); |
61 } | 61 } |
62 | 62 |
63 bool SVGCircleElement::isSupportedAttribute(const QualifiedName& attrName) | 63 bool SVGCircleElement::isSupportedAttribute(const QualifiedName& attrName) |
64 { | 64 { |
65 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 65 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
66 if (supportedAttributes.isEmpty()) { | 66 if (supportedAttributes.isEmpty()) { |
67 SVGTests::addSupportedAttributes(supportedAttributes); | |
68 SVGLangSpace::addSupportedAttributes(supportedAttributes); | 67 SVGLangSpace::addSupportedAttributes(supportedAttributes); |
69 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | 68 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); |
70 supportedAttributes.add(SVGNames::cxAttr); | 69 supportedAttributes.add(SVGNames::cxAttr); |
71 supportedAttributes.add(SVGNames::cyAttr); | 70 supportedAttributes.add(SVGNames::cyAttr); |
72 supportedAttributes.add(SVGNames::rAttr); | 71 supportedAttributes.add(SVGNames::rAttr); |
73 } | 72 } |
74 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 73 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
75 } | 74 } |
76 | 75 |
77 void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 76 void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
78 { | 77 { |
79 SVGParsingError parseError = NoError; | 78 SVGParsingError parseError = NoError; |
80 | 79 |
81 if (!isSupportedAttribute(name)) | 80 if (!isSupportedAttribute(name)) |
82 SVGGraphicsElement::parseAttribute(name, value); | 81 SVGGraphicsElement::parseAttribute(name, value); |
83 else if (name == SVGNames::cxAttr) | 82 else if (name == SVGNames::cxAttr) |
84 setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; | 83 setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; |
85 else if (name == SVGNames::cyAttr) | 84 else if (name == SVGNames::cyAttr) |
86 setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); | 85 setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); |
87 else if (name == SVGNames::rAttr) | 86 else if (name == SVGNames::rAttr) |
88 setRBaseValue(SVGLength::construct(LengthModeOther, value, parseError, F
orbidNegativeLengths)); | 87 setRBaseValue(SVGLength::construct(LengthModeOther, value, parseError, F
orbidNegativeLengths)); |
89 else if (SVGTests::parseAttribute(name, value) | 88 else if (SVGLangSpace::parseAttribute(name, value) |
90 || SVGLangSpace::parseAttribute(name, value) | |
91 || SVGExternalResourcesRequired::parseAttribute(name, value)) { | 89 || SVGExternalResourcesRequired::parseAttribute(name, value)) { |
92 } else | 90 } else |
93 ASSERT_NOT_REACHED(); | 91 ASSERT_NOT_REACHED(); |
94 | 92 |
95 reportAttributeParsingError(parseError, name, value); | 93 reportAttributeParsingError(parseError, name, value); |
96 } | 94 } |
97 | 95 |
98 void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName) | 96 void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName) |
99 { | 97 { |
100 if (!isSupportedAttribute(attrName)) { | 98 if (!isSupportedAttribute(attrName)) { |
101 SVGGraphicsElement::svgAttributeChanged(attrName); | 99 SVGGraphicsElement::svgAttributeChanged(attrName); |
102 return; | 100 return; |
103 } | 101 } |
104 | 102 |
105 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 103 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
106 | 104 |
107 bool isLengthAttribute = attrName == SVGNames::cxAttr | 105 bool isLengthAttribute = attrName == SVGNames::cxAttr |
108 || attrName == SVGNames::cyAttr | 106 || attrName == SVGNames::cyAttr |
109 || attrName == SVGNames::rAttr; | 107 || attrName == SVGNames::rAttr; |
110 | 108 |
111 if (isLengthAttribute) | 109 if (isLengthAttribute) |
112 updateRelativeLengthsInformation(); | 110 updateRelativeLengthsInformation(); |
113 | 111 |
114 if (SVGTests::handleAttributeChange(this, attrName)) | |
115 return; | |
116 | |
117 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 112 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); |
118 if (!renderer) | 113 if (!renderer) |
119 return; | 114 return; |
120 | 115 |
121 if (isLengthAttribute) { | 116 if (isLengthAttribute) { |
122 renderer->setNeedsShapeUpdate(); | 117 renderer->setNeedsShapeUpdate(); |
123 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 118 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
124 return; | 119 return; |
125 } | 120 } |
126 | 121 |
(...skipping 11 matching lines...) Expand all Loading... |
138 || cy().isRelative() | 133 || cy().isRelative() |
139 || r().isRelative(); | 134 || r().isRelative(); |
140 } | 135 } |
141 | 136 |
142 RenderObject* SVGCircleElement::createRenderer(RenderStyle*) | 137 RenderObject* SVGCircleElement::createRenderer(RenderStyle*) |
143 { | 138 { |
144 return new (document()->renderArena()) RenderSVGEllipse(this); | 139 return new (document()->renderArena()) RenderSVGEllipse(this); |
145 } | 140 } |
146 | 141 |
147 } | 142 } |
OLD | NEW |