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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 PassRefPtr<SVGCircleElement> SVGCircleElement::create(Document& document) | 56 PassRefPtr<SVGCircleElement> SVGCircleElement::create(Document& document) |
57 { | 57 { |
58 return adoptRef(new SVGCircleElement(document)); | 58 return adoptRef(new SVGCircleElement(document)); |
59 } | 59 } |
60 | 60 |
61 bool SVGCircleElement::isSupportedAttribute(const QualifiedName& attrName) | 61 bool SVGCircleElement::isSupportedAttribute(const QualifiedName& attrName) |
62 { | 62 { |
63 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 63 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
64 if (supportedAttributes.isEmpty()) { | 64 if (supportedAttributes.isEmpty()) { |
65 SVGLangSpace::addSupportedAttributes(supportedAttributes); | |
66 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | 65 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); |
67 supportedAttributes.add(SVGNames::cxAttr); | 66 supportedAttributes.add(SVGNames::cxAttr); |
68 supportedAttributes.add(SVGNames::cyAttr); | 67 supportedAttributes.add(SVGNames::cyAttr); |
69 supportedAttributes.add(SVGNames::rAttr); | 68 supportedAttributes.add(SVGNames::rAttr); |
70 } | 69 } |
71 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 70 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
72 } | 71 } |
73 | 72 |
74 void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 73 void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
75 { | 74 { |
76 SVGParsingError parseError = NoError; | 75 SVGParsingError parseError = NoError; |
77 | 76 |
78 if (!isSupportedAttribute(name)) | 77 if (!isSupportedAttribute(name)) |
79 SVGGeometryElement::parseAttribute(name, value); | 78 SVGGeometryElement::parseAttribute(name, value); |
80 else if (name == SVGNames::cxAttr) | 79 else if (name == SVGNames::cxAttr) |
81 setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; | 80 setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; |
82 else if (name == SVGNames::cyAttr) | 81 else if (name == SVGNames::cyAttr) |
83 setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); | 82 setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); |
84 else if (name == SVGNames::rAttr) | 83 else if (name == SVGNames::rAttr) |
85 setRBaseValue(SVGLength::construct(LengthModeOther, value, parseError, F
orbidNegativeLengths)); | 84 setRBaseValue(SVGLength::construct(LengthModeOther, value, parseError, F
orbidNegativeLengths)); |
86 else if (SVGLangSpace::parseAttribute(name, value) | 85 else if (SVGExternalResourcesRequired::parseAttribute(name, value)) { |
87 || SVGExternalResourcesRequired::parseAttribute(name, value)) { | |
88 } else | 86 } else |
89 ASSERT_NOT_REACHED(); | 87 ASSERT_NOT_REACHED(); |
90 | 88 |
91 reportAttributeParsingError(parseError, name, value); | 89 reportAttributeParsingError(parseError, name, value); |
92 } | 90 } |
93 | 91 |
94 void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName) | 92 void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName) |
95 { | 93 { |
96 if (!isSupportedAttribute(attrName)) { | 94 if (!isSupportedAttribute(attrName)) { |
97 SVGGeometryElement::svgAttributeChanged(attrName); | 95 SVGGeometryElement::svgAttributeChanged(attrName); |
(...skipping 12 matching lines...) Expand all Loading... |
110 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 108 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); |
111 if (!renderer) | 109 if (!renderer) |
112 return; | 110 return; |
113 | 111 |
114 if (isLengthAttribute) { | 112 if (isLengthAttribute) { |
115 renderer->setNeedsShapeUpdate(); | 113 renderer->setNeedsShapeUpdate(); |
116 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 114 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
117 return; | 115 return; |
118 } | 116 } |
119 | 117 |
120 if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired
::isKnownAttribute(attrName)) { | 118 if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) { |
121 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 119 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
122 return; | 120 return; |
123 } | 121 } |
124 | 122 |
125 ASSERT_NOT_REACHED(); | 123 ASSERT_NOT_REACHED(); |
126 } | 124 } |
127 | 125 |
128 bool SVGCircleElement::selfHasRelativeLengths() const | 126 bool SVGCircleElement::selfHasRelativeLengths() const |
129 { | 127 { |
130 return cxCurrentValue().isRelative() | 128 return cxCurrentValue().isRelative() |
131 || cyCurrentValue().isRelative() | 129 || cyCurrentValue().isRelative() |
132 || rCurrentValue().isRelative(); | 130 || rCurrentValue().isRelative(); |
133 } | 131 } |
134 | 132 |
135 RenderObject* SVGCircleElement::createRenderer(RenderStyle*) | 133 RenderObject* SVGCircleElement::createRenderer(RenderStyle*) |
136 { | 134 { |
137 return new RenderSVGEllipse(this); | 135 return new RenderSVGEllipse(this); |
138 } | 136 } |
139 | 137 |
140 } | 138 } |
OLD | NEW |