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