| 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/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(SVGEllipseElement, SVGNames::cxAttr, Cx, cx) | 33 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::cxAttr, Cx, cx) | 
| 34 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::cyAttr, Cy, cy) | 34 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::cyAttr, Cy, cy) | 
| 35 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::rxAttr, Rx, rx) | 35 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::rxAttr, Rx, rx) | 
| 36 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::ryAttr, Ry, ry) | 36 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::ryAttr, Ry, ry) | 
| 37 DEFINE_ANIMATED_BOOLEAN(SVGEllipseElement, SVGNames::externalResourcesRequiredAt
     tr, ExternalResourcesRequired, externalResourcesRequired) |  | 
| 38 | 37 | 
| 39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGEllipseElement) | 38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGEllipseElement) | 
| 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(rx) | 41     REGISTER_LOCAL_ANIMATED_PROPERTY(rx) | 
| 43     REGISTER_LOCAL_ANIMATED_PROPERTY(ry) | 42     REGISTER_LOCAL_ANIMATED_PROPERTY(ry) | 
| 44     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) |  | 
| 45     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) | 43     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) | 
| 46 END_REGISTER_ANIMATED_PROPERTIES | 44 END_REGISTER_ANIMATED_PROPERTIES | 
| 47 | 45 | 
| 48 inline SVGEllipseElement::SVGEllipseElement(Document& document) | 46 inline SVGEllipseElement::SVGEllipseElement(Document& document) | 
| 49     : SVGGeometryElement(SVGNames::ellipseTag, document) | 47     : SVGGeometryElement(SVGNames::ellipseTag, document) | 
| 50     , m_cx(LengthModeWidth) | 48     , m_cx(LengthModeWidth) | 
| 51     , m_cy(LengthModeHeight) | 49     , m_cy(LengthModeHeight) | 
| 52     , m_rx(LengthModeWidth) | 50     , m_rx(LengthModeWidth) | 
| 53     , m_ry(LengthModeHeight) | 51     , m_ry(LengthModeHeight) | 
| 54 { | 52 { | 
| 55     ScriptWrappable::init(this); | 53     ScriptWrappable::init(this); | 
| 56     registerAnimatedPropertiesForSVGEllipseElement(); | 54     registerAnimatedPropertiesForSVGEllipseElement(); | 
| 57 } | 55 } | 
| 58 | 56 | 
| 59 PassRefPtr<SVGEllipseElement> SVGEllipseElement::create(Document& document) | 57 PassRefPtr<SVGEllipseElement> SVGEllipseElement::create(Document& document) | 
| 60 { | 58 { | 
| 61     return adoptRef(new SVGEllipseElement(document)); | 59     return adoptRef(new SVGEllipseElement(document)); | 
| 62 } | 60 } | 
| 63 | 61 | 
| 64 bool SVGEllipseElement::isSupportedAttribute(const QualifiedName& attrName) | 62 bool SVGEllipseElement::isSupportedAttribute(const QualifiedName& attrName) | 
| 65 { | 63 { | 
| 66     DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 64     DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 
| 67     if (supportedAttributes.isEmpty()) { | 65     if (supportedAttributes.isEmpty()) { | 
| 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::rxAttr); | 68         supportedAttributes.add(SVGNames::rxAttr); | 
| 72         supportedAttributes.add(SVGNames::ryAttr); | 69         supportedAttributes.add(SVGNames::ryAttr); | 
| 73     } | 70     } | 
| 74     return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 71     return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 
| 75 } | 72 } | 
| 76 | 73 | 
| 77 void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt
     ring& value) | 74 void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt
     ring& value) | 
| 78 { | 75 { | 
| 79     SVGParsingError parseError = NoError; | 76     SVGParsingError parseError = NoError; | 
| 80 | 77 | 
| 81     if (!isSupportedAttribute(name)) | 78     if (!isSupportedAttribute(name)) | 
| 82         SVGGeometryElement::parseAttribute(name, value); | 79         SVGGeometryElement::parseAttribute(name, value); | 
| 83     else if (name == SVGNames::cxAttr) | 80     else if (name == SVGNames::cxAttr) | 
| 84         setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
     ; | 81         setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
     ; | 
| 85     else if (name == SVGNames::cyAttr) | 82     else if (name == SVGNames::cyAttr) | 
| 86         setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
     ); | 83         setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
     ); | 
| 87     else if (name == SVGNames::rxAttr) | 84     else if (name == SVGNames::rxAttr) | 
| 88         setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, 
     ForbidNegativeLengths)); | 85         setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, 
     ForbidNegativeLengths)); | 
| 89     else if (name == SVGNames::ryAttr) | 86     else if (name == SVGNames::ryAttr) | 
| 90         setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError,
      ForbidNegativeLengths)); | 87         setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError,
      ForbidNegativeLengths)); | 
| 91     else if (SVGExternalResourcesRequired::parseAttribute(name, value)) { | 88     else | 
| 92     } else |  | 
| 93         ASSERT_NOT_REACHED(); | 89         ASSERT_NOT_REACHED(); | 
| 94 | 90 | 
| 95     reportAttributeParsingError(parseError, name, value); | 91     reportAttributeParsingError(parseError, name, value); | 
| 96 } | 92 } | 
| 97 | 93 | 
| 98 void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) | 94 void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) | 
| 99 { | 95 { | 
| 100     if (!isSupportedAttribute(attrName)) { | 96     if (!isSupportedAttribute(attrName)) { | 
| 101         SVGGeometryElement::svgAttributeChanged(attrName); | 97         SVGGeometryElement::svgAttributeChanged(attrName); | 
| 102         return; | 98         return; | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 115     RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 111     RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 
| 116     if (!renderer) | 112     if (!renderer) | 
| 117         return; | 113         return; | 
| 118 | 114 | 
| 119     if (isLengthAttribute) { | 115     if (isLengthAttribute) { | 
| 120         renderer->setNeedsShapeUpdate(); | 116         renderer->setNeedsShapeUpdate(); | 
| 121         RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 117         RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 
| 122         return; | 118         return; | 
| 123     } | 119     } | 
| 124 | 120 | 
| 125     if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) { |  | 
| 126         RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |  | 
| 127         return; |  | 
| 128     } |  | 
| 129 |  | 
| 130     ASSERT_NOT_REACHED(); | 121     ASSERT_NOT_REACHED(); | 
| 131 } | 122 } | 
| 132 | 123 | 
| 133 bool SVGEllipseElement::selfHasRelativeLengths() const | 124 bool SVGEllipseElement::selfHasRelativeLengths() const | 
| 134 { | 125 { | 
| 135     return cxCurrentValue().isRelative() | 126     return cxCurrentValue().isRelative() | 
| 136         || cyCurrentValue().isRelative() | 127         || cyCurrentValue().isRelative() | 
| 137         || rxCurrentValue().isRelative() | 128         || rxCurrentValue().isRelative() | 
| 138         || ryCurrentValue().isRelative(); | 129         || ryCurrentValue().isRelative(); | 
| 139 } | 130 } | 
| 140 | 131 | 
| 141 RenderObject* SVGEllipseElement::createRenderer(RenderStyle*) | 132 RenderObject* SVGEllipseElement::createRenderer(RenderStyle*) | 
| 142 { | 133 { | 
| 143     return new RenderSVGEllipse(this); | 134     return new RenderSVGEllipse(this); | 
| 144 } | 135 } | 
| 145 | 136 | 
| 146 } | 137 } | 
| OLD | NEW | 
|---|