| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 supportedAttributes.add(SVGNames::yAttr); | 53 supportedAttributes.add(SVGNames::yAttr); |
| 54 supportedAttributes.add(SVGNames::dxAttr); | 54 supportedAttributes.add(SVGNames::dxAttr); |
| 55 supportedAttributes.add(SVGNames::dyAttr); | 55 supportedAttributes.add(SVGNames::dyAttr); |
| 56 supportedAttributes.add(SVGNames::rotateAttr); | 56 supportedAttributes.add(SVGNames::rotateAttr); |
| 57 } | 57 } |
| 58 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 58 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void SVGTextPositioningElement::parseAttribute(const QualifiedName& name, const
AtomicString& value) | 61 void SVGTextPositioningElement::parseAttribute(const QualifiedName& name, const
AtomicString& value) |
| 62 { | 62 { |
| 63 if (!isSupportedAttribute(name)) { | 63 parseAttributeNew(name, value); |
| 64 SVGTextContentElement::parseAttribute(name, value); | |
| 65 return; | |
| 66 } | |
| 67 | |
| 68 SVGParsingError parseError = NoError; | |
| 69 | |
| 70 if (name == SVGNames::xAttr) | |
| 71 m_x->setBaseValueAsString(value, parseError); | |
| 72 else if (name == SVGNames::yAttr) | |
| 73 m_y->setBaseValueAsString(value, parseError); | |
| 74 else if (name == SVGNames::dxAttr) | |
| 75 m_dx->setBaseValueAsString(value, parseError); | |
| 76 else if (name == SVGNames::dyAttr) | |
| 77 m_dy->setBaseValueAsString(value, parseError); | |
| 78 else if (name == SVGNames::rotateAttr) | |
| 79 m_rotate->setBaseValueAsString(value, parseError); | |
| 80 else | |
| 81 ASSERT_NOT_REACHED(); | |
| 82 | |
| 83 reportAttributeParsingError(parseError, name, value); | |
| 84 } | 64 } |
| 85 | 65 |
| 86 void SVGTextPositioningElement::svgAttributeChanged(const QualifiedName& attrNam
e) | 66 void SVGTextPositioningElement::svgAttributeChanged(const QualifiedName& attrNam
e) |
| 87 { | 67 { |
| 88 if (!isSupportedAttribute(attrName)) { | 68 if (!isSupportedAttribute(attrName)) { |
| 89 SVGTextContentElement::svgAttributeChanged(attrName); | 69 SVGTextContentElement::svgAttributeChanged(attrName); |
| 90 return; | 70 return; |
| 91 } | 71 } |
| 92 | 72 |
| 93 SVGElement::InvalidationGuard invalidationGuard(this); | 73 SVGElement::InvalidationGuard invalidationGuard(this); |
| 94 | 74 |
| 95 bool updateRelativeLengths = attrName == SVGNames::xAttr | 75 bool updateRelativeLengths = attrName == SVGNames::xAttr |
| 96 || attrName == SVGNames::yAttr | 76 || attrName == SVGNames::yAttr |
| 97 || attrName == SVGNames::dxAttr | 77 || attrName == SVGNames::dxAttr |
| 98 || attrName == SVGNames::dyAttr; | 78 || attrName == SVGNames::dyAttr; |
| 99 | 79 |
| 100 if (updateRelativeLengths) | 80 if (updateRelativeLengths) |
| 101 updateRelativeLengthsInformation(); | 81 updateRelativeLengthsInformation(); |
| 102 | 82 |
| 103 RenderObject* renderer = this->renderer(); | 83 RenderObject* renderer = this->renderer(); |
| 104 if (!renderer) | 84 if (!renderer) |
| 105 return; | 85 return; |
| 106 | 86 |
| 107 if (updateRelativeLengths || attrName == SVGNames::rotateAttr) { | 87 ASSERT(updateRelativeLengths || attrName == SVGNames::rotateAttr); |
| 108 if (RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAnce
stor(renderer)) | |
| 109 textRenderer->setNeedsPositioningValuesUpdate(); | |
| 110 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | |
| 111 return; | |
| 112 } | |
| 113 | 88 |
| 114 ASSERT_NOT_REACHED(); | 89 if (RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor
(renderer)) |
| 90 textRenderer->setNeedsPositioningValuesUpdate(); |
| 91 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
| 115 } | 92 } |
| 116 | 93 |
| 117 SVGTextPositioningElement* SVGTextPositioningElement::elementFromRenderer(Render
Object* renderer) | 94 SVGTextPositioningElement* SVGTextPositioningElement::elementFromRenderer(Render
Object* renderer) |
| 118 { | 95 { |
| 119 if (!renderer) | 96 if (!renderer) |
| 120 return 0; | 97 return 0; |
| 121 | 98 |
| 122 if (!renderer->isSVGText() && !renderer->isSVGInline()) | 99 if (!renderer->isSVGText() && !renderer->isSVGInline()) |
| 123 return 0; | 100 return 0; |
| 124 | 101 |
| 125 Node* node = renderer->node(); | 102 Node* node = renderer->node(); |
| 126 ASSERT(node); | 103 ASSERT(node); |
| 127 ASSERT(node->isSVGElement()); | 104 ASSERT(node->isSVGElement()); |
| 128 | 105 |
| 129 return isSVGTextPositioningElement(*node) ? toSVGTextPositioningElement(node
) : 0; | 106 return isSVGTextPositioningElement(*node) ? toSVGTextPositioningElement(node
) : 0; |
| 130 } | 107 } |
| 131 | 108 |
| 132 } | 109 } |
| OLD | NEW |