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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 PassRefPtr<SVGEllipseElement> SVGEllipseElement::create(Document& document) | 59 PassRefPtr<SVGEllipseElement> SVGEllipseElement::create(Document& document) |
60 { | 60 { |
61 return adoptRef(new SVGEllipseElement(document)); | 61 return adoptRef(new SVGEllipseElement(document)); |
62 } | 62 } |
63 | 63 |
64 bool SVGEllipseElement::isSupportedAttribute(const QualifiedName& attrName) | 64 bool SVGEllipseElement::isSupportedAttribute(const QualifiedName& attrName) |
65 { | 65 { |
66 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 66 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
67 if (supportedAttributes.isEmpty()) { | 67 if (supportedAttributes.isEmpty()) { |
68 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::rxAttr); | 71 supportedAttributes.add(SVGNames::rxAttr); |
73 supportedAttributes.add(SVGNames::ryAttr); | 72 supportedAttributes.add(SVGNames::ryAttr); |
74 } | 73 } |
75 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 74 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
76 } | 75 } |
77 | 76 |
78 void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) | 77 void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) |
79 { | 78 { |
80 SVGParsingError parseError = NoError; | 79 SVGParsingError parseError = NoError; |
81 | 80 |
82 if (!isSupportedAttribute(name)) | 81 if (!isSupportedAttribute(name)) |
83 SVGGeometryElement::parseAttribute(name, value); | 82 SVGGeometryElement::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::rxAttr) | 87 else if (name == SVGNames::rxAttr) |
89 setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError,
ForbidNegativeLengths)); | 88 setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError,
ForbidNegativeLengths)); |
90 else if (name == SVGNames::ryAttr) | 89 else if (name == SVGNames::ryAttr) |
91 setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError,
ForbidNegativeLengths)); | 90 setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError,
ForbidNegativeLengths)); |
92 else if (SVGLangSpace::parseAttribute(name, value) | 91 else if (SVGExternalResourcesRequired::parseAttribute(name, value)) { |
93 || SVGExternalResourcesRequired::parseAttribute(name, value)) { | |
94 } else | 92 } else |
95 ASSERT_NOT_REACHED(); | 93 ASSERT_NOT_REACHED(); |
96 | 94 |
97 reportAttributeParsingError(parseError, name, value); | 95 reportAttributeParsingError(parseError, name, value); |
98 } | 96 } |
99 | 97 |
100 void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) | 98 void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) |
101 { | 99 { |
102 if (!isSupportedAttribute(attrName)) { | 100 if (!isSupportedAttribute(attrName)) { |
103 SVGGeometryElement::svgAttributeChanged(attrName); | 101 SVGGeometryElement::svgAttributeChanged(attrName); |
(...skipping 13 matching lines...) Expand all Loading... |
117 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 115 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); |
118 if (!renderer) | 116 if (!renderer) |
119 return; | 117 return; |
120 | 118 |
121 if (isLengthAttribute) { | 119 if (isLengthAttribute) { |
122 renderer->setNeedsShapeUpdate(); | 120 renderer->setNeedsShapeUpdate(); |
123 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 121 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
124 return; | 122 return; |
125 } | 123 } |
126 | 124 |
127 if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired
::isKnownAttribute(attrName)) { | 125 if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) { |
128 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 126 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
129 return; | 127 return; |
130 } | 128 } |
131 | 129 |
132 ASSERT_NOT_REACHED(); | 130 ASSERT_NOT_REACHED(); |
133 } | 131 } |
134 | 132 |
135 bool SVGEllipseElement::selfHasRelativeLengths() const | 133 bool SVGEllipseElement::selfHasRelativeLengths() const |
136 { | 134 { |
137 return cxCurrentValue().isRelative() | 135 return cxCurrentValue().isRelative() |
138 || cyCurrentValue().isRelative() | 136 || cyCurrentValue().isRelative() |
139 || rxCurrentValue().isRelative() | 137 || rxCurrentValue().isRelative() |
140 || ryCurrentValue().isRelative(); | 138 || ryCurrentValue().isRelative(); |
141 } | 139 } |
142 | 140 |
143 RenderObject* SVGEllipseElement::createRenderer(RenderStyle*) | 141 RenderObject* SVGEllipseElement::createRenderer(RenderStyle*) |
144 { | 142 { |
145 return new RenderSVGEllipse(this); | 143 return new RenderSVGEllipse(this); |
146 } | 144 } |
147 | 145 |
148 } | 146 } |
OLD | NEW |