| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 PassRefPtr<SVGEllipseElement> SVGEllipseElement::create(const QualifiedName& tag
Name, Document* document) | 61 PassRefPtr<SVGEllipseElement> SVGEllipseElement::create(const QualifiedName& tag
Name, Document* document) |
| 62 { | 62 { |
| 63 return adoptRef(new SVGEllipseElement(tagName, document)); | 63 return adoptRef(new SVGEllipseElement(tagName, document)); |
| 64 } | 64 } |
| 65 | 65 |
| 66 bool SVGEllipseElement::isSupportedAttribute(const QualifiedName& attrName) | 66 bool SVGEllipseElement::isSupportedAttribute(const QualifiedName& attrName) |
| 67 { | 67 { |
| 68 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 68 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 69 if (supportedAttributes.isEmpty()) { | 69 if (supportedAttributes.isEmpty()) { |
| 70 SVGTests::addSupportedAttributes(supportedAttributes); | |
| 71 SVGLangSpace::addSupportedAttributes(supportedAttributes); | 70 SVGLangSpace::addSupportedAttributes(supportedAttributes); |
| 72 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | 71 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); |
| 73 supportedAttributes.add(SVGNames::cxAttr); | 72 supportedAttributes.add(SVGNames::cxAttr); |
| 74 supportedAttributes.add(SVGNames::cyAttr); | 73 supportedAttributes.add(SVGNames::cyAttr); |
| 75 supportedAttributes.add(SVGNames::rxAttr); | 74 supportedAttributes.add(SVGNames::rxAttr); |
| 76 supportedAttributes.add(SVGNames::ryAttr); | 75 supportedAttributes.add(SVGNames::ryAttr); |
| 77 } | 76 } |
| 78 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 77 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 79 } | 78 } |
| 80 | 79 |
| 81 void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) | 80 void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) |
| 82 { | 81 { |
| 83 SVGParsingError parseError = NoError; | 82 SVGParsingError parseError = NoError; |
| 84 | 83 |
| 85 if (!isSupportedAttribute(name)) | 84 if (!isSupportedAttribute(name)) |
| 86 SVGGraphicsElement::parseAttribute(name, value); | 85 SVGGraphicsElement::parseAttribute(name, value); |
| 87 else if (name == SVGNames::cxAttr) | 86 else if (name == SVGNames::cxAttr) |
| 88 setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; | 87 setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; |
| 89 else if (name == SVGNames::cyAttr) | 88 else if (name == SVGNames::cyAttr) |
| 90 setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); | 89 setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); |
| 91 else if (name == SVGNames::rxAttr) | 90 else if (name == SVGNames::rxAttr) |
| 92 setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError,
ForbidNegativeLengths)); | 91 setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError,
ForbidNegativeLengths)); |
| 93 else if (name == SVGNames::ryAttr) | 92 else if (name == SVGNames::ryAttr) |
| 94 setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError,
ForbidNegativeLengths)); | 93 setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError,
ForbidNegativeLengths)); |
| 95 else if (SVGTests::parseAttribute(name, value) | 94 else if (SVGLangSpace::parseAttribute(name, value) |
| 96 || SVGLangSpace::parseAttribute(name, value) | |
| 97 || SVGExternalResourcesRequired::parseAttribute(name, value)) { | 95 || SVGExternalResourcesRequired::parseAttribute(name, value)) { |
| 98 } else | 96 } else |
| 99 ASSERT_NOT_REACHED(); | 97 ASSERT_NOT_REACHED(); |
| 100 | 98 |
| 101 reportAttributeParsingError(parseError, name, value); | 99 reportAttributeParsingError(parseError, name, value); |
| 102 } | 100 } |
| 103 | 101 |
| 104 void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) | 102 void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) |
| 105 { | 103 { |
| 106 if (!isSupportedAttribute(attrName)) { | 104 if (!isSupportedAttribute(attrName)) { |
| 107 SVGGraphicsElement::svgAttributeChanged(attrName); | 105 SVGGraphicsElement::svgAttributeChanged(attrName); |
| 108 return; | 106 return; |
| 109 } | 107 } |
| 110 | 108 |
| 111 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 109 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
| 112 | 110 |
| 113 bool isLengthAttribute = attrName == SVGNames::cxAttr | 111 bool isLengthAttribute = attrName == SVGNames::cxAttr |
| 114 || attrName == SVGNames::cyAttr | 112 || attrName == SVGNames::cyAttr |
| 115 || attrName == SVGNames::rxAttr | 113 || attrName == SVGNames::rxAttr |
| 116 || attrName == SVGNames::ryAttr; | 114 || attrName == SVGNames::ryAttr; |
| 117 | 115 |
| 118 if (isLengthAttribute) | 116 if (isLengthAttribute) |
| 119 updateRelativeLengthsInformation(); | 117 updateRelativeLengthsInformation(); |
| 120 | |
| 121 if (SVGTests::handleAttributeChange(this, attrName)) | |
| 122 return; | |
| 123 | 118 |
| 124 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 119 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); |
| 125 if (!renderer) | 120 if (!renderer) |
| 126 return; | 121 return; |
| 127 | 122 |
| 128 if (isLengthAttribute) { | 123 if (isLengthAttribute) { |
| 129 renderer->setNeedsShapeUpdate(); | 124 renderer->setNeedsShapeUpdate(); |
| 130 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 125 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
| 131 return; | 126 return; |
| 132 } | 127 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 146 || rx().isRelative() | 141 || rx().isRelative() |
| 147 || ry().isRelative(); | 142 || ry().isRelative(); |
| 148 } | 143 } |
| 149 | 144 |
| 150 RenderObject* SVGEllipseElement::createRenderer(RenderStyle*) | 145 RenderObject* SVGEllipseElement::createRenderer(RenderStyle*) |
| 151 { | 146 { |
| 152 return new (document()->renderArena()) RenderSVGEllipse(this); | 147 return new (document()->renderArena()) RenderSVGEllipse(this); |
| 153 } | 148 } |
| 154 | 149 |
| 155 } | 150 } |
| OLD | NEW |