| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 #include "core/svg/SVGSymbolElement.h" | 23 #include "core/svg/SVGSymbolElement.h" |
| 24 | 24 |
| 25 #include "SVGNames.h" | 25 #include "SVGNames.h" |
| 26 #include "core/rendering/svg/RenderSVGHiddenContainer.h" | 26 #include "core/rendering/svg/RenderSVGHiddenContainer.h" |
| 27 #include "core/svg/SVGElementInstance.h" | 27 #include "core/svg/SVGElementInstance.h" |
| 28 | 28 |
| 29 namespace WebCore { | 29 namespace WebCore { |
| 30 | 30 |
| 31 // Animated property definitions | 31 // Animated property definitions |
| 32 DEFINE_ANIMATED_BOOLEAN(SVGSymbolElement, SVGNames::externalResourcesRequiredAtt
r, ExternalResourcesRequired, externalResourcesRequired) | |
| 33 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGSymbolElement, SVGNames::preserveAspectRa
tioAttr, PreserveAspectRatio, preserveAspectRatio) | 32 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGSymbolElement, SVGNames::preserveAspectRa
tioAttr, PreserveAspectRatio, preserveAspectRatio) |
| 34 DEFINE_ANIMATED_RECT(SVGSymbolElement, SVGNames::viewBoxAttr, ViewBox, viewBox) | 33 DEFINE_ANIMATED_RECT(SVGSymbolElement, SVGNames::viewBoxAttr, ViewBox, viewBox) |
| 35 | 34 |
| 36 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSymbolElement) | 35 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSymbolElement) |
| 37 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
| 38 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) | 36 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) |
| 39 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) | 37 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) |
| 40 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) | 38 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) |
| 41 END_REGISTER_ANIMATED_PROPERTIES | 39 END_REGISTER_ANIMATED_PROPERTIES |
| 42 | 40 |
| 43 inline SVGSymbolElement::SVGSymbolElement(Document& document) | 41 inline SVGSymbolElement::SVGSymbolElement(Document& document) |
| 44 : SVGElement(SVGNames::symbolTag, document) | 42 : SVGElement(SVGNames::symbolTag, document) |
| 45 { | 43 { |
| 46 ScriptWrappable::init(this); | 44 ScriptWrappable::init(this); |
| 47 registerAnimatedPropertiesForSVGSymbolElement(); | 45 registerAnimatedPropertiesForSVGSymbolElement(); |
| 48 } | 46 } |
| 49 | 47 |
| 50 PassRefPtr<SVGSymbolElement> SVGSymbolElement::create(Document& document) | 48 PassRefPtr<SVGSymbolElement> SVGSymbolElement::create(Document& document) |
| 51 { | 49 { |
| 52 return adoptRef(new SVGSymbolElement(document)); | 50 return adoptRef(new SVGSymbolElement(document)); |
| 53 } | 51 } |
| 54 | 52 |
| 55 bool SVGSymbolElement::isSupportedAttribute(const QualifiedName& attrName) | 53 bool SVGSymbolElement::isSupportedAttribute(const QualifiedName& attrName) |
| 56 { | 54 { |
| 57 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 55 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 58 if (supportedAttributes.isEmpty()) { | 56 if (supportedAttributes.isEmpty()) |
| 59 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | |
| 60 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); | 57 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); |
| 61 } | 58 |
| 62 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 59 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 63 } | 60 } |
| 64 | 61 |
| 65 void SVGSymbolElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 62 void SVGSymbolElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
| 66 { | 63 { |
| 67 if (!isSupportedAttribute(name)) { | 64 if (!isSupportedAttribute(name)) { |
| 68 SVGElement::parseAttribute(name, value); | 65 SVGElement::parseAttribute(name, value); |
| 69 return; | 66 return; |
| 70 } | 67 } |
| 71 | 68 |
| 72 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | |
| 73 return; | |
| 74 if (SVGFitToViewBox::parseAttribute(this, name, value)) | 69 if (SVGFitToViewBox::parseAttribute(this, name, value)) |
| 75 return; | 70 return; |
| 76 | 71 |
| 77 ASSERT_NOT_REACHED(); | 72 ASSERT_NOT_REACHED(); |
| 78 } | 73 } |
| 79 | 74 |
| 80 void SVGSymbolElement::svgAttributeChanged(const QualifiedName& attrName) | 75 void SVGSymbolElement::svgAttributeChanged(const QualifiedName& attrName) |
| 81 { | 76 { |
| 82 if (!isSupportedAttribute(attrName)) { | 77 if (!isSupportedAttribute(attrName)) { |
| 83 SVGElement::svgAttributeChanged(attrName); | 78 SVGElement::svgAttributeChanged(attrName); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 95 { | 90 { |
| 96 return hasAttribute(SVGNames::viewBoxAttr); | 91 return hasAttribute(SVGNames::viewBoxAttr); |
| 97 } | 92 } |
| 98 | 93 |
| 99 RenderObject* SVGSymbolElement::createRenderer(RenderStyle*) | 94 RenderObject* SVGSymbolElement::createRenderer(RenderStyle*) |
| 100 { | 95 { |
| 101 return new RenderSVGHiddenContainer(this); | 96 return new RenderSVGHiddenContainer(this); |
| 102 } | 97 } |
| 103 | 98 |
| 104 } | 99 } |
| OLD | NEW |