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 13 matching lines...) Expand all Loading... |
24 | 24 |
25 #include "core/rendering/svg/RenderSVGRect.h" | 25 #include "core/rendering/svg/RenderSVGRect.h" |
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 inline SVGRectElement::SVGRectElement(Document& document) | 32 inline SVGRectElement::SVGRectElement(Document& document) |
33 : SVGGeometryElement(SVGNames::rectTag, document) | 33 : SVGGeometryElement(SVGNames::rectTag, document) |
34 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth))) | 34 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth), AllowNegativeLengths)) |
35 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight))) | 35 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight), AllowNegativeLengths)) |
36 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth))) | 36 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr
eate(LengthModeWidth), ForbidNegativeLengths)) |
37 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight))) | 37 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength::
create(LengthModeHeight), ForbidNegativeLengths)) |
38 , m_rx(SVGAnimatedLength::create(this, SVGNames::rxAttr, SVGLength::create(L
engthModeWidth))) | 38 , m_rx(SVGAnimatedLength::create(this, SVGNames::rxAttr, SVGLength::create(L
engthModeWidth), ForbidNegativeLengths)) |
39 , m_ry(SVGAnimatedLength::create(this, SVGNames::ryAttr, SVGLength::create(L
engthModeHeight))) | 39 , m_ry(SVGAnimatedLength::create(this, SVGNames::ryAttr, SVGLength::create(L
engthModeHeight), ForbidNegativeLengths)) |
40 { | 40 { |
41 ScriptWrappable::init(this); | 41 ScriptWrappable::init(this); |
42 | 42 |
43 addToPropertyMap(m_x); | 43 addToPropertyMap(m_x); |
44 addToPropertyMap(m_y); | 44 addToPropertyMap(m_y); |
45 addToPropertyMap(m_width); | 45 addToPropertyMap(m_width); |
46 addToPropertyMap(m_height); | 46 addToPropertyMap(m_height); |
47 addToPropertyMap(m_rx); | 47 addToPropertyMap(m_rx); |
48 addToPropertyMap(m_ry); | 48 addToPropertyMap(m_ry); |
49 } | 49 } |
(...skipping 17 matching lines...) Expand all Loading... |
67 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 67 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
68 } | 68 } |
69 | 69 |
70 void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 70 void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
71 { | 71 { |
72 SVGParsingError parseError = NoError; | 72 SVGParsingError parseError = NoError; |
73 | 73 |
74 if (!isSupportedAttribute(name)) | 74 if (!isSupportedAttribute(name)) |
75 SVGGeometryElement::parseAttribute(name, value); | 75 SVGGeometryElement::parseAttribute(name, value); |
76 else if (name == SVGNames::xAttr) | 76 else if (name == SVGNames::xAttr) |
77 m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 77 m_x->setBaseValueAsString(value, parseError); |
78 else if (name == SVGNames::yAttr) | 78 else if (name == SVGNames::yAttr) |
79 m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); | 79 m_y->setBaseValueAsString(value, parseError); |
80 else if (name == SVGNames::rxAttr) | 80 else if (name == SVGNames::rxAttr) |
81 m_rx->setBaseValueAsString(value, ForbidNegativeLengths, parseError); | 81 m_rx->setBaseValueAsString(value, parseError); |
82 else if (name == SVGNames::ryAttr) | 82 else if (name == SVGNames::ryAttr) |
83 m_ry->setBaseValueAsString(value, ForbidNegativeLengths, parseError); | 83 m_ry->setBaseValueAsString(value, parseError); |
84 else if (name == SVGNames::widthAttr) | 84 else if (name == SVGNames::widthAttr) |
85 m_width->setBaseValueAsString(value, ForbidNegativeLengths, parseError); | 85 m_width->setBaseValueAsString(value, parseError); |
86 else if (name == SVGNames::heightAttr) | 86 else if (name == SVGNames::heightAttr) |
87 m_height->setBaseValueAsString(value, ForbidNegativeLengths, parseError)
; | 87 m_height->setBaseValueAsString(value, parseError); |
88 else | 88 else |
89 ASSERT_NOT_REACHED(); | 89 ASSERT_NOT_REACHED(); |
90 | 90 |
91 reportAttributeParsingError(parseError, name, value); | 91 reportAttributeParsingError(parseError, name, value); |
92 } | 92 } |
93 | 93 |
94 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName) | 94 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName) |
95 { | 95 { |
96 if (!isSupportedAttribute(attrName)) { | 96 if (!isSupportedAttribute(attrName)) { |
97 SVGGeometryElement::svgAttributeChanged(attrName); | 97 SVGGeometryElement::svgAttributeChanged(attrName); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 || m_rx->currentValue()->isRelative() | 132 || m_rx->currentValue()->isRelative() |
133 || m_ry->currentValue()->isRelative(); | 133 || m_ry->currentValue()->isRelative(); |
134 } | 134 } |
135 | 135 |
136 RenderObject* SVGRectElement::createRenderer(RenderStyle*) | 136 RenderObject* SVGRectElement::createRenderer(RenderStyle*) |
137 { | 137 { |
138 return new RenderSVGRect(this); | 138 return new RenderSVGRect(this); |
139 } | 139 } |
140 | 140 |
141 } | 141 } |
OLD | NEW |