| 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 16 matching lines...) Expand all Loading... |
| 27 #include "core/rendering/svg/RenderSVGResource.h" | 27 #include "core/rendering/svg/RenderSVGResource.h" |
| 28 #include "core/svg/SVGElementInstance.h" | 28 #include "core/svg/SVGElementInstance.h" |
| 29 #include "core/svg/SVGLength.h" | 29 #include "core/svg/SVGLength.h" |
| 30 | 30 |
| 31 namespace WebCore { | 31 namespace WebCore { |
| 32 | 32 |
| 33 // Animated property definitions | 33 // Animated property definitions |
| 34 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::cxAttr, Cx, cx) | 34 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::cxAttr, Cx, cx) |
| 35 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::cyAttr, Cy, cy) | 35 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::cyAttr, Cy, cy) |
| 36 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::rAttr, R, r) | 36 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::rAttr, R, r) |
| 37 DEFINE_ANIMATED_BOOLEAN(SVGCircleElement, SVGNames::externalResourcesRequiredAtt
r, ExternalResourcesRequired, externalResourcesRequired) | |
| 38 | 37 |
| 39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCircleElement) | 38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCircleElement) |
| 40 REGISTER_LOCAL_ANIMATED_PROPERTY(cx) | 39 REGISTER_LOCAL_ANIMATED_PROPERTY(cx) |
| 41 REGISTER_LOCAL_ANIMATED_PROPERTY(cy) | 40 REGISTER_LOCAL_ANIMATED_PROPERTY(cy) |
| 42 REGISTER_LOCAL_ANIMATED_PROPERTY(r) | 41 REGISTER_LOCAL_ANIMATED_PROPERTY(r) |
| 43 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
| 44 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) | 42 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
| 45 END_REGISTER_ANIMATED_PROPERTIES | 43 END_REGISTER_ANIMATED_PROPERTIES |
| 46 | 44 |
| 47 inline SVGCircleElement::SVGCircleElement(const QualifiedName& tagName, Document
& document) | 45 inline SVGCircleElement::SVGCircleElement(const QualifiedName& tagName, Document
& document) |
| 48 : SVGGraphicsElement(tagName, document) | 46 : SVGGraphicsElement(tagName, document) |
| 49 , m_cx(LengthModeWidth) | 47 , m_cx(LengthModeWidth) |
| 50 , m_cy(LengthModeHeight) | 48 , m_cy(LengthModeHeight) |
| 51 , m_r(LengthModeOther) | 49 , m_r(LengthModeOther) |
| 52 { | 50 { |
| 53 ASSERT(hasTagName(SVGNames::circleTag)); | 51 ASSERT(hasTagName(SVGNames::circleTag)); |
| 54 ScriptWrappable::init(this); | 52 ScriptWrappable::init(this); |
| 55 registerAnimatedPropertiesForSVGCircleElement(); | 53 registerAnimatedPropertiesForSVGCircleElement(); |
| 56 } | 54 } |
| 57 | 55 |
| 58 PassRefPtr<SVGCircleElement> SVGCircleElement::create(const QualifiedName& tagNa
me, Document& document) | 56 PassRefPtr<SVGCircleElement> SVGCircleElement::create(const QualifiedName& tagNa
me, Document& document) |
| 59 { | 57 { |
| 60 return adoptRef(new SVGCircleElement(tagName, document)); | 58 return adoptRef(new SVGCircleElement(tagName, document)); |
| 61 } | 59 } |
| 62 | 60 |
| 63 bool SVGCircleElement::isSupportedAttribute(const QualifiedName& attrName) | 61 bool SVGCircleElement::isSupportedAttribute(const QualifiedName& attrName) |
| 64 { | 62 { |
| 65 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 63 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 66 if (supportedAttributes.isEmpty()) { | 64 if (supportedAttributes.isEmpty()) { |
| 67 SVGLangSpace::addSupportedAttributes(supportedAttributes); | 65 SVGLangSpace::addSupportedAttributes(supportedAttributes); |
| 68 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | |
| 69 supportedAttributes.add(SVGNames::cxAttr); | 66 supportedAttributes.add(SVGNames::cxAttr); |
| 70 supportedAttributes.add(SVGNames::cyAttr); | 67 supportedAttributes.add(SVGNames::cyAttr); |
| 71 supportedAttributes.add(SVGNames::rAttr); | 68 supportedAttributes.add(SVGNames::rAttr); |
| 72 } | 69 } |
| 73 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 70 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 74 } | 71 } |
| 75 | 72 |
| 76 void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 73 void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
| 77 { | 74 { |
| 78 SVGParsingError parseError = NoError; | 75 SVGParsingError parseError = NoError; |
| 79 | 76 |
| 80 if (!isSupportedAttribute(name)) | 77 if (!isSupportedAttribute(name)) |
| 81 SVGGraphicsElement::parseAttribute(name, value); | 78 SVGGraphicsElement::parseAttribute(name, value); |
| 82 else if (name == SVGNames::cxAttr) | 79 else if (name == SVGNames::cxAttr) |
| 83 setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; | 80 setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; |
| 84 else if (name == SVGNames::cyAttr) | 81 else if (name == SVGNames::cyAttr) |
| 85 setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); | 82 setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); |
| 86 else if (name == SVGNames::rAttr) | 83 else if (name == SVGNames::rAttr) |
| 87 setRBaseValue(SVGLength::construct(LengthModeOther, value, parseError, F
orbidNegativeLengths)); | 84 setRBaseValue(SVGLength::construct(LengthModeOther, value, parseError, F
orbidNegativeLengths)); |
| 88 else if (SVGLangSpace::parseAttribute(name, value) | 85 else if (SVGLangSpace::parseAttribute(name, value)) { |
| 89 || SVGExternalResourcesRequired::parseAttribute(name, value)) { | |
| 90 } else | 86 } else |
| 91 ASSERT_NOT_REACHED(); | 87 ASSERT_NOT_REACHED(); |
| 92 | 88 |
| 93 reportAttributeParsingError(parseError, name, value); | 89 reportAttributeParsingError(parseError, name, value); |
| 94 } | 90 } |
| 95 | 91 |
| 96 void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName) | 92 void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName) |
| 97 { | 93 { |
| 98 if (!isSupportedAttribute(attrName)) { | 94 if (!isSupportedAttribute(attrName)) { |
| 99 SVGGraphicsElement::svgAttributeChanged(attrName); | 95 SVGGraphicsElement::svgAttributeChanged(attrName); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 112 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 108 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); |
| 113 if (!renderer) | 109 if (!renderer) |
| 114 return; | 110 return; |
| 115 | 111 |
| 116 if (isLengthAttribute) { | 112 if (isLengthAttribute) { |
| 117 renderer->setNeedsShapeUpdate(); | 113 renderer->setNeedsShapeUpdate(); |
| 118 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 114 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
| 119 return; | 115 return; |
| 120 } | 116 } |
| 121 | 117 |
| 122 if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired
::isKnownAttribute(attrName)) { | 118 if (SVGLangSpace::isKnownAttribute(attrName)) { |
| 123 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 119 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
| 124 return; | 120 return; |
| 125 } | 121 } |
| 126 | 122 |
| 127 ASSERT_NOT_REACHED(); | 123 ASSERT_NOT_REACHED(); |
| 128 } | 124 } |
| 129 | 125 |
| 130 bool SVGCircleElement::selfHasRelativeLengths() const | 126 bool SVGCircleElement::selfHasRelativeLengths() const |
| 131 { | 127 { |
| 132 return cxCurrentValue().isRelative() | 128 return cxCurrentValue().isRelative() |
| 133 || cyCurrentValue().isRelative() | 129 || cyCurrentValue().isRelative() |
| 134 || rCurrentValue().isRelative(); | 130 || rCurrentValue().isRelative(); |
| 135 } | 131 } |
| 136 | 132 |
| 137 RenderObject* SVGCircleElement::createRenderer(RenderStyle*) | 133 RenderObject* SVGCircleElement::createRenderer(RenderStyle*) |
| 138 { | 134 { |
| 139 return new RenderSVGEllipse(this); | 135 return new RenderSVGEllipse(this); |
| 140 } | 136 } |
| 141 | 137 |
| 142 } | 138 } |
| OLD | NEW |