| 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 12 matching lines...) Expand all Loading... |
| 23 #include "core/svg/SVGViewElement.h" | 23 #include "core/svg/SVGViewElement.h" |
| 24 | 24 |
| 25 #include "SVGNames.h" | 25 #include "SVGNames.h" |
| 26 #include "core/svg/SVGFitToViewBox.h" | 26 #include "core/svg/SVGFitToViewBox.h" |
| 27 #include "core/svg/SVGStringList.h" | 27 #include "core/svg/SVGStringList.h" |
| 28 #include "core/svg/SVGZoomAndPan.h" | 28 #include "core/svg/SVGZoomAndPan.h" |
| 29 | 29 |
| 30 namespace WebCore { | 30 namespace WebCore { |
| 31 | 31 |
| 32 // Animated property definitions | 32 // Animated property definitions |
| 33 DEFINE_ANIMATED_BOOLEAN(SVGViewElement, SVGNames::externalResourcesRequiredAttr,
ExternalResourcesRequired, externalResourcesRequired) | |
| 34 DEFINE_ANIMATED_RECT(SVGViewElement, SVGNames::viewBoxAttr, ViewBox, viewBox) | 33 DEFINE_ANIMATED_RECT(SVGViewElement, SVGNames::viewBoxAttr, ViewBox, viewBox) |
| 35 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGViewElement, SVGNames::preserveAspectRati
oAttr, PreserveAspectRatio, preserveAspectRatio) | 34 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGViewElement, SVGNames::preserveAspectRati
oAttr, PreserveAspectRatio, preserveAspectRatio) |
| 36 | 35 |
| 37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGViewElement) | 36 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGViewElement) |
| 38 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
| 39 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) | 37 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) |
| 40 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) | 38 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) |
| 41 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) | 39 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) |
| 42 END_REGISTER_ANIMATED_PROPERTIES | 40 END_REGISTER_ANIMATED_PROPERTIES |
| 43 | 41 |
| 44 inline SVGViewElement::SVGViewElement(const QualifiedName& tagName, Document& do
cument) | 42 inline SVGViewElement::SVGViewElement(const QualifiedName& tagName, Document& do
cument) |
| 45 : SVGElement(tagName, document) | 43 : SVGElement(tagName, document) |
| 46 , m_zoomAndPan(SVGZoomAndPanMagnify) | 44 , m_zoomAndPan(SVGZoomAndPanMagnify) |
| 47 , m_viewTarget(SVGNames::viewTargetAttr) | 45 , m_viewTarget(SVGNames::viewTargetAttr) |
| 48 { | 46 { |
| 49 ASSERT(hasTagName(SVGNames::viewTag)); | 47 ASSERT(hasTagName(SVGNames::viewTag)); |
| 50 ScriptWrappable::init(this); | 48 ScriptWrappable::init(this); |
| 51 registerAnimatedPropertiesForSVGViewElement(); | 49 registerAnimatedPropertiesForSVGViewElement(); |
| 52 } | 50 } |
| 53 | 51 |
| 54 PassRefPtr<SVGViewElement> SVGViewElement::create(const QualifiedName& tagName,
Document& document) | 52 PassRefPtr<SVGViewElement> SVGViewElement::create(const QualifiedName& tagName,
Document& document) |
| 55 { | 53 { |
| 56 return adoptRef(new SVGViewElement(tagName, document)); | 54 return adoptRef(new SVGViewElement(tagName, document)); |
| 57 } | 55 } |
| 58 | 56 |
| 59 bool SVGViewElement::isSupportedAttribute(const QualifiedName& attrName) | 57 bool SVGViewElement::isSupportedAttribute(const QualifiedName& attrName) |
| 60 { | 58 { |
| 61 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 59 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 62 if (supportedAttributes.isEmpty()) { | 60 if (supportedAttributes.isEmpty()) { |
| 63 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | |
| 64 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); | 61 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); |
| 65 SVGZoomAndPan::addSupportedAttributes(supportedAttributes); | 62 SVGZoomAndPan::addSupportedAttributes(supportedAttributes); |
| 66 supportedAttributes.add(SVGNames::viewTargetAttr); | 63 supportedAttributes.add(SVGNames::viewTargetAttr); |
| 67 } | 64 } |
| 68 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 65 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 69 } | 66 } |
| 70 | 67 |
| 71 void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 68 void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
| 72 { | 69 { |
| 73 if (!isSupportedAttribute(name)) { | 70 if (!isSupportedAttribute(name)) { |
| 74 SVGElement::parseAttribute(name, value); | 71 SVGElement::parseAttribute(name, value); |
| 75 return; | 72 return; |
| 76 } | 73 } |
| 77 | 74 |
| 78 if (name == SVGNames::viewTargetAttr) { | 75 if (name == SVGNames::viewTargetAttr) { |
| 79 viewTarget().reset(value); | 76 viewTarget().reset(value); |
| 80 return; | 77 return; |
| 81 } | 78 } |
| 82 | 79 |
| 83 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | |
| 84 return; | |
| 85 if (SVGFitToViewBox::parseAttribute(this, name, value)) | 80 if (SVGFitToViewBox::parseAttribute(this, name, value)) |
| 86 return; | 81 return; |
| 87 if (SVGZoomAndPan::parseAttribute(this, name, value)) | 82 if (SVGZoomAndPan::parseAttribute(this, name, value)) |
| 88 return; | 83 return; |
| 89 | 84 |
| 90 ASSERT_NOT_REACHED(); | 85 ASSERT_NOT_REACHED(); |
| 91 } | 86 } |
| 92 | 87 |
| 93 } | 88 } |
| OLD | NEW |