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