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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 REGISTER_LOCAL_ANIMATED_PROPERTY(y) | 44 REGISTER_LOCAL_ANIMATED_PROPERTY(y) |
45 REGISTER_LOCAL_ANIMATED_PROPERTY(width) | 45 REGISTER_LOCAL_ANIMATED_PROPERTY(width) |
46 REGISTER_LOCAL_ANIMATED_PROPERTY(height) | 46 REGISTER_LOCAL_ANIMATED_PROPERTY(height) |
47 REGISTER_LOCAL_ANIMATED_PROPERTY(rx) | 47 REGISTER_LOCAL_ANIMATED_PROPERTY(rx) |
48 REGISTER_LOCAL_ANIMATED_PROPERTY(ry) | 48 REGISTER_LOCAL_ANIMATED_PROPERTY(ry) |
49 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | 49 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) |
50 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) | 50 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
51 END_REGISTER_ANIMATED_PROPERTIES | 51 END_REGISTER_ANIMATED_PROPERTIES |
52 | 52 |
53 inline SVGRectElement::SVGRectElement(const QualifiedName& tagName, Document& do
cument) | 53 inline SVGRectElement::SVGRectElement(const QualifiedName& tagName, Document& do
cument) |
54 : SVGGraphicsElement(tagName, document) | 54 : SVGGeometryElement(tagName, document) |
55 , m_x(LengthModeWidth) | 55 , m_x(LengthModeWidth) |
56 , m_y(LengthModeHeight) | 56 , m_y(LengthModeHeight) |
57 , m_width(LengthModeWidth) | 57 , m_width(LengthModeWidth) |
58 , m_height(LengthModeHeight) | 58 , m_height(LengthModeHeight) |
59 , m_rx(LengthModeWidth) | 59 , m_rx(LengthModeWidth) |
60 , m_ry(LengthModeHeight) | 60 , m_ry(LengthModeHeight) |
61 { | 61 { |
62 ASSERT(hasTagName(SVGNames::rectTag)); | 62 ASSERT(hasTagName(SVGNames::rectTag)); |
63 ScriptWrappable::init(this); | 63 ScriptWrappable::init(this); |
64 registerAnimatedPropertiesForSVGRectElement(); | 64 registerAnimatedPropertiesForSVGRectElement(); |
(...skipping 18 matching lines...) Expand all Loading... |
83 supportedAttributes.add(SVGNames::ryAttr); | 83 supportedAttributes.add(SVGNames::ryAttr); |
84 } | 84 } |
85 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 85 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
86 } | 86 } |
87 | 87 |
88 void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 88 void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
89 { | 89 { |
90 SVGParsingError parseError = NoError; | 90 SVGParsingError parseError = NoError; |
91 | 91 |
92 if (!isSupportedAttribute(name)) | 92 if (!isSupportedAttribute(name)) |
93 SVGGraphicsElement::parseAttribute(name, value); | 93 SVGGeometryElement::parseAttribute(name, value); |
94 else if (name == SVGNames::xAttr) | 94 else if (name == SVGNames::xAttr) |
95 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); | 95 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); |
96 else if (name == SVGNames::yAttr) | 96 else if (name == SVGNames::yAttr) |
97 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError))
; | 97 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError))
; |
98 else if (name == SVGNames::rxAttr) | 98 else if (name == SVGNames::rxAttr) |
99 setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError,
ForbidNegativeLengths)); | 99 setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError,
ForbidNegativeLengths)); |
100 else if (name == SVGNames::ryAttr) | 100 else if (name == SVGNames::ryAttr) |
101 setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError,
ForbidNegativeLengths)); | 101 setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError,
ForbidNegativeLengths)); |
102 else if (name == SVGNames::widthAttr) | 102 else if (name == SVGNames::widthAttr) |
103 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro
r, ForbidNegativeLengths)); | 103 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro
r, ForbidNegativeLengths)); |
104 else if (name == SVGNames::heightAttr) | 104 else if (name == SVGNames::heightAttr) |
105 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr
ror, ForbidNegativeLengths)); | 105 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr
ror, ForbidNegativeLengths)); |
106 else if (SVGLangSpace::parseAttribute(name, value) | 106 else if (SVGLangSpace::parseAttribute(name, value) |
107 || SVGExternalResourcesRequired::parseAttribute(name, value)) { | 107 || SVGExternalResourcesRequired::parseAttribute(name, value)) { |
108 } else | 108 } else |
109 ASSERT_NOT_REACHED(); | 109 ASSERT_NOT_REACHED(); |
110 | 110 |
111 reportAttributeParsingError(parseError, name, value); | 111 reportAttributeParsingError(parseError, name, value); |
112 } | 112 } |
113 | 113 |
114 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName) | 114 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName) |
115 { | 115 { |
116 if (!isSupportedAttribute(attrName)) { | 116 if (!isSupportedAttribute(attrName)) { |
117 SVGGraphicsElement::svgAttributeChanged(attrName); | 117 SVGGeometryElement::svgAttributeChanged(attrName); |
118 return; | 118 return; |
119 } | 119 } |
120 | 120 |
121 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 121 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
122 | 122 |
123 bool isLengthAttribute = attrName == SVGNames::xAttr | 123 bool isLengthAttribute = attrName == SVGNames::xAttr |
124 || attrName == SVGNames::yAttr | 124 || attrName == SVGNames::yAttr |
125 || attrName == SVGNames::widthAttr | 125 || attrName == SVGNames::widthAttr |
126 || attrName == SVGNames::heightAttr | 126 || attrName == SVGNames::heightAttr |
127 || attrName == SVGNames::rxAttr | 127 || attrName == SVGNames::rxAttr |
(...skipping 29 matching lines...) Expand all Loading... |
157 || rxCurrentValue().isRelative() | 157 || rxCurrentValue().isRelative() |
158 || ryCurrentValue().isRelative(); | 158 || ryCurrentValue().isRelative(); |
159 } | 159 } |
160 | 160 |
161 RenderObject* SVGRectElement::createRenderer(RenderStyle*) | 161 RenderObject* SVGRectElement::createRenderer(RenderStyle*) |
162 { | 162 { |
163 return new RenderSVGRect(this); | 163 return new RenderSVGRect(this); |
164 } | 164 } |
165 | 165 |
166 } | 166 } |
OLD | NEW |