OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 SVGNumberList newList; | 101 SVGNumberList newList; |
102 newList.parse(attr->value()); | 102 newList.parse(attr->value()); |
103 detachAnimatedRotateListWrappers(newList.size()); | 103 detachAnimatedRotateListWrappers(newList.size()); |
104 setRotateBaseValue(newList); | 104 setRotateBaseValue(newList); |
105 return; | 105 return; |
106 } | 106 } |
107 | 107 |
108 ASSERT_NOT_REACHED(); | 108 ASSERT_NOT_REACHED(); |
109 } | 109 } |
110 | 110 |
111 static inline void updatePositioningValuesInRenderer(RenderObject* renderer) | |
112 { | |
113 RenderSVGText* textRenderer = 0; | |
114 | |
115 if (renderer->isSVGText()) | |
116 textRenderer = toRenderSVGText(renderer); | |
117 else { | |
118 // Locate RenderSVGText parent renderer. | |
119 RenderObject* parent = renderer->parent(); | |
120 while (parent && !parent->isSVGText()) | |
121 parent = parent->parent(); | |
122 | |
123 if (parent) { | |
124 ASSERT(parent->isSVGText()); | |
125 textRenderer = toRenderSVGText(parent); | |
126 } | |
127 } | |
128 | |
129 if (!textRenderer) | |
130 return; | |
131 | |
132 textRenderer->setNeedsPositioningValuesUpdate(); | |
133 } | |
134 | |
135 void SVGTextPositioningElement::svgAttributeChanged(const QualifiedName& attrNam
e) | 111 void SVGTextPositioningElement::svgAttributeChanged(const QualifiedName& attrNam
e) |
136 { | 112 { |
137 if (!isSupportedAttribute(attrName)) { | 113 if (!isSupportedAttribute(attrName)) { |
138 SVGTextContentElement::svgAttributeChanged(attrName); | 114 SVGTextContentElement::svgAttributeChanged(attrName); |
139 return; | 115 return; |
140 } | 116 } |
141 | 117 |
142 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 118 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
143 | 119 |
144 bool updateRelativeLengths = attrName == SVGNames::xAttr | 120 bool updateRelativeLengths = attrName == SVGNames::xAttr |
145 || attrName == SVGNames::yAttr | 121 || attrName == SVGNames::yAttr |
146 || attrName == SVGNames::dxAttr | 122 || attrName == SVGNames::dxAttr |
147 || attrName == SVGNames::dyAttr; | 123 || attrName == SVGNames::dyAttr; |
148 | 124 |
149 if (updateRelativeLengths) | 125 if (updateRelativeLengths) |
150 updateRelativeLengthsInformation(); | 126 updateRelativeLengthsInformation(); |
151 | 127 |
152 RenderObject* renderer = this->renderer(); | 128 RenderObject* renderer = this->renderer(); |
153 if (!renderer) | 129 if (!renderer) |
154 return; | 130 return; |
155 | 131 |
156 if (updateRelativeLengths || attrName == SVGNames::rotateAttr) { | 132 if (updateRelativeLengths || attrName == SVGNames::rotateAttr) { |
157 updatePositioningValuesInRenderer(renderer); | 133 if (RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAnce
stor(renderer)) |
| 134 textRenderer->setNeedsPositioningValuesUpdate(); |
158 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 135 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
159 return; | 136 return; |
160 } | 137 } |
161 | 138 |
162 ASSERT_NOT_REACHED(); | 139 ASSERT_NOT_REACHED(); |
163 } | 140 } |
164 | 141 |
165 void SVGTextPositioningElement::childrenChanged(bool changedByParser, Node* befo
reChange, Node* afterChange, int childCountDelta) | |
166 { | |
167 SVGTextContentElement::childrenChanged(changedByParser, beforeChange, afterC
hange, childCountDelta); | |
168 | |
169 if (changedByParser) | |
170 return; | |
171 | |
172 if (RenderObject* object = renderer()) | |
173 updatePositioningValuesInRenderer(object); | |
174 } | |
175 | |
176 void SVGTextPositioningElement::synchronizeProperty(const QualifiedName& attrNam
e) | 142 void SVGTextPositioningElement::synchronizeProperty(const QualifiedName& attrNam
e) |
177 { | 143 { |
178 if (attrName == anyQName()) { | 144 if (attrName == anyQName()) { |
179 synchronizeX(); | 145 synchronizeX(); |
180 synchronizeY(); | 146 synchronizeY(); |
181 synchronizeDx(); | 147 synchronizeDx(); |
182 synchronizeDy(); | 148 synchronizeDy(); |
183 synchronizeRotate(); | 149 synchronizeRotate(); |
184 SVGTextContentElement::synchronizeProperty(attrName); | 150 SVGTextContentElement::synchronizeProperty(attrName); |
185 return; | 151 return; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 #endif | 214 #endif |
249 && !node->hasTagName(SVGNames::trefTag)) | 215 && !node->hasTagName(SVGNames::trefTag)) |
250 return 0; | 216 return 0; |
251 | 217 |
252 return static_cast<SVGTextPositioningElement*>(node); | 218 return static_cast<SVGTextPositioningElement*>(node); |
253 } | 219 } |
254 | 220 |
255 } | 221 } |
256 | 222 |
257 #endif // ENABLE(SVG) | 223 #endif // ENABLE(SVG) |
OLD | NEW |