| 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, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // Animated property definitions | 32 // Animated property definitions |
| 33 DEFINE_ANIMATED_BOOLEAN(SVGViewElement, SVGNames::externalResourcesRequiredAttr,
ExternalResourcesRequired, externalResourcesRequired) | 33 DEFINE_ANIMATED_BOOLEAN(SVGViewElement, SVGNames::externalResourcesRequiredAttr,
ExternalResourcesRequired, externalResourcesRequired) |
| 34 DEFINE_ANIMATED_RECT(SVGViewElement, SVGNames::viewBoxAttr, ViewBox, viewBox) | 34 DEFINE_ANIMATED_RECT(SVGViewElement, SVGNames::viewBoxAttr, ViewBox, viewBox) |
| 35 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGViewElement, SVGNames::preserveAspectRati
oAttr, PreserveAspectRatio, preserveAspectRatio) | 35 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGViewElement, SVGNames::preserveAspectRati
oAttr, PreserveAspectRatio, preserveAspectRatio) |
| 36 | 36 |
| 37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGViewElement) | 37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGViewElement) |
| 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 SVGViewElement::SVGViewElement(const QualifiedName& tagName, Document* do
cument) | 44 inline SVGViewElement::SVGViewElement(const QualifiedName& tagName, Document* do
cument) |
| 45 : SVGStyledElement(tagName, document) | 45 : SVGElement(tagName, document) |
| 46 , m_zoomAndPan(SVGZoomAndPanMagnify) | 46 , m_zoomAndPan(SVGZoomAndPanMagnify) |
| 47 , m_viewTarget(SVGNames::viewTargetAttr) | 47 , m_viewTarget(SVGNames::viewTargetAttr) |
| 48 { | 48 { |
| 49 ASSERT(hasTagName(SVGNames::viewTag)); | 49 ASSERT(hasTagName(SVGNames::viewTag)); |
| 50 ScriptWrappable::init(this); | 50 ScriptWrappable::init(this); |
| 51 registerAnimatedPropertiesForSVGViewElement(); | 51 registerAnimatedPropertiesForSVGViewElement(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 PassRefPtr<SVGViewElement> SVGViewElement::create(const QualifiedName& tagName,
Document* document) | 54 PassRefPtr<SVGViewElement> SVGViewElement::create(const QualifiedName& tagName,
Document* document) |
| 55 { | 55 { |
| 56 return adoptRef(new SVGViewElement(tagName, document)); | 56 return adoptRef(new SVGViewElement(tagName, document)); |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool SVGViewElement::isSupportedAttribute(const QualifiedName& attrName) | 59 bool SVGViewElement::isSupportedAttribute(const QualifiedName& attrName) |
| 60 { | 60 { |
| 61 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 61 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 62 if (supportedAttributes.isEmpty()) { | 62 if (supportedAttributes.isEmpty()) { |
| 63 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | 63 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); |
| 64 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); | 64 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); |
| 65 SVGZoomAndPan::addSupportedAttributes(supportedAttributes); | 65 SVGZoomAndPan::addSupportedAttributes(supportedAttributes); |
| 66 supportedAttributes.add(SVGNames::viewTargetAttr); | 66 supportedAttributes.add(SVGNames::viewTargetAttr); |
| 67 } | 67 } |
| 68 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 68 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 71 void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
| 72 { | 72 { |
| 73 if (!isSupportedAttribute(name)) { | 73 if (!isSupportedAttribute(name)) { |
| 74 SVGStyledElement::parseAttribute(name, value); | 74 SVGElement::parseAttribute(name, value); |
| 75 return; | 75 return; |
| 76 } | 76 } |
| 77 | 77 |
| 78 if (name == SVGNames::viewTargetAttr) { | 78 if (name == SVGNames::viewTargetAttr) { |
| 79 viewTarget().reset(value); | 79 viewTarget().reset(value); |
| 80 return; | 80 return; |
| 81 } | 81 } |
| 82 | 82 |
| 83 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | 83 if (SVGExternalResourcesRequired::parseAttribute(name, value)) |
| 84 return; | 84 return; |
| 85 if (SVGFitToViewBox::parseAttribute(this, name, value)) | 85 if (SVGFitToViewBox::parseAttribute(this, name, value)) |
| 86 return; | 86 return; |
| 87 if (SVGZoomAndPan::parseAttribute(this, name, value)) | 87 if (SVGZoomAndPan::parseAttribute(this, name, value)) |
| 88 return; | 88 return; |
| 89 | 89 |
| 90 ASSERT_NOT_REACHED(); | 90 ASSERT_NOT_REACHED(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 } | 93 } |
| OLD | NEW |