| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // Animated property definitions | 32 // Animated property definitions |
| 33 DEFINE_ANIMATED_BOOLEAN(SVGSymbolElement, SVGNames::externalResourcesRequiredAtt
r, ExternalResourcesRequired, externalResourcesRequired) | 33 DEFINE_ANIMATED_BOOLEAN(SVGSymbolElement, SVGNames::externalResourcesRequiredAtt
r, ExternalResourcesRequired, externalResourcesRequired) |
| 34 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGSymbolElement, SVGNames::preserveAspectRa
tioAttr, PreserveAspectRatio, preserveAspectRatio) | 34 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGSymbolElement, SVGNames::preserveAspectRa
tioAttr, PreserveAspectRatio, preserveAspectRatio) |
| 35 DEFINE_ANIMATED_RECT(SVGSymbolElement, SVGNames::viewBoxAttr, ViewBox, viewBox) | 35 DEFINE_ANIMATED_RECT(SVGSymbolElement, SVGNames::viewBoxAttr, ViewBox, viewBox) |
| 36 | 36 |
| 37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSymbolElement) | 37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSymbolElement) |
| 38 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | 38 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) |
| 39 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) | 39 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) |
| 40 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) | 40 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) |
| 41 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledElement) | 41 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) |
| 42 END_REGISTER_ANIMATED_PROPERTIES | 42 END_REGISTER_ANIMATED_PROPERTIES |
| 43 | 43 |
| 44 inline SVGSymbolElement::SVGSymbolElement(const QualifiedName& tagName, Document
* document) | 44 inline SVGSymbolElement::SVGSymbolElement(const QualifiedName& tagName, Document
* document) |
| 45 : SVGStyledElement(tagName, document) | 45 : SVGElement(tagName, document) |
| 46 { | 46 { |
| 47 ASSERT(hasTagName(SVGNames::symbolTag)); | 47 ASSERT(hasTagName(SVGNames::symbolTag)); |
| 48 ScriptWrappable::init(this); | 48 ScriptWrappable::init(this); |
| 49 registerAnimatedPropertiesForSVGSymbolElement(); | 49 registerAnimatedPropertiesForSVGSymbolElement(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 PassRefPtr<SVGSymbolElement> SVGSymbolElement::create(const QualifiedName& tagNa
me, Document* document) | 52 PassRefPtr<SVGSymbolElement> SVGSymbolElement::create(const QualifiedName& tagNa
me, Document* document) |
| 53 { | 53 { |
| 54 return adoptRef(new SVGSymbolElement(tagName, document)); | 54 return adoptRef(new SVGSymbolElement(tagName, document)); |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool SVGSymbolElement::isSupportedAttribute(const QualifiedName& attrName) | 57 bool SVGSymbolElement::isSupportedAttribute(const QualifiedName& attrName) |
| 58 { | 58 { |
| 59 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 59 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 60 if (supportedAttributes.isEmpty()) { | 60 if (supportedAttributes.isEmpty()) { |
| 61 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | 61 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); |
| 62 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); | 62 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); |
| 63 } | 63 } |
| 64 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 64 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void SVGSymbolElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 67 void SVGSymbolElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
| 68 { | 68 { |
| 69 if (!isSupportedAttribute(name)) { | 69 if (!isSupportedAttribute(name)) { |
| 70 SVGStyledElement::parseAttribute(name, value); | 70 SVGElement::parseAttribute(name, value); |
| 71 return; | 71 return; |
| 72 } | 72 } |
| 73 | 73 |
| 74 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | 74 if (SVGExternalResourcesRequired::parseAttribute(name, value)) |
| 75 return; | 75 return; |
| 76 if (SVGFitToViewBox::parseAttribute(this, name, value)) | 76 if (SVGFitToViewBox::parseAttribute(this, name, value)) |
| 77 return; | 77 return; |
| 78 | 78 |
| 79 ASSERT_NOT_REACHED(); | 79 ASSERT_NOT_REACHED(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void SVGSymbolElement::svgAttributeChanged(const QualifiedName& attrName) | 82 void SVGSymbolElement::svgAttributeChanged(const QualifiedName& attrName) |
| 83 { | 83 { |
| 84 if (!isSupportedAttribute(attrName)) { | 84 if (!isSupportedAttribute(attrName)) { |
| 85 SVGStyledElement::svgAttributeChanged(attrName); | 85 SVGElement::svgAttributeChanged(attrName); |
| 86 return; | 86 return; |
| 87 } | 87 } |
| 88 | 88 |
| 89 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 89 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
| 90 | 90 |
| 91 // Every other property change is ignored. | 91 // Every other property change is ignored. |
| 92 if (attrName == SVGNames::viewBoxAttr) | 92 if (attrName == SVGNames::viewBoxAttr) |
| 93 updateRelativeLengthsInformation(); | 93 updateRelativeLengthsInformation(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 bool SVGSymbolElement::selfHasRelativeLengths() const | 96 bool SVGSymbolElement::selfHasRelativeLengths() const |
| 97 { | 97 { |
| 98 return hasAttribute(SVGNames::viewBoxAttr); | 98 return hasAttribute(SVGNames::viewBoxAttr); |
| 99 } | 99 } |
| 100 | 100 |
| 101 RenderObject* SVGSymbolElement::createRenderer(RenderStyle*) | 101 RenderObject* SVGSymbolElement::createRenderer(RenderStyle*) |
| 102 { | 102 { |
| 103 return new RenderSVGHiddenContainer(this); | 103 return new RenderSVGHiddenContainer(this); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } | 106 } |
| OLD | NEW |