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 28 matching lines...) Expand all Loading... |
39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGLineElement) | 39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGLineElement) |
40 REGISTER_LOCAL_ANIMATED_PROPERTY(x1) | 40 REGISTER_LOCAL_ANIMATED_PROPERTY(x1) |
41 REGISTER_LOCAL_ANIMATED_PROPERTY(y1) | 41 REGISTER_LOCAL_ANIMATED_PROPERTY(y1) |
42 REGISTER_LOCAL_ANIMATED_PROPERTY(x2) | 42 REGISTER_LOCAL_ANIMATED_PROPERTY(x2) |
43 REGISTER_LOCAL_ANIMATED_PROPERTY(y2) | 43 REGISTER_LOCAL_ANIMATED_PROPERTY(y2) |
44 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | 44 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) |
45 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) | 45 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
46 END_REGISTER_ANIMATED_PROPERTIES | 46 END_REGISTER_ANIMATED_PROPERTIES |
47 | 47 |
48 inline SVGLineElement::SVGLineElement(const QualifiedName& tagName, Document& do
cument) | 48 inline SVGLineElement::SVGLineElement(const QualifiedName& tagName, Document& do
cument) |
49 : SVGGraphicsElement(tagName, document) | 49 : SVGGeometryElement(tagName, document) |
50 , m_x1(LengthModeWidth) | 50 , m_x1(LengthModeWidth) |
51 , m_y1(LengthModeHeight) | 51 , m_y1(LengthModeHeight) |
52 , m_x2(LengthModeWidth) | 52 , m_x2(LengthModeWidth) |
53 , m_y2(LengthModeHeight) | 53 , m_y2(LengthModeHeight) |
54 { | 54 { |
55 ASSERT(hasTagName(SVGNames::lineTag)); | 55 ASSERT(hasTagName(SVGNames::lineTag)); |
56 ScriptWrappable::init(this); | 56 ScriptWrappable::init(this); |
57 registerAnimatedPropertiesForSVGLineElement(); | 57 registerAnimatedPropertiesForSVGLineElement(); |
58 } | 58 } |
59 | 59 |
(...skipping 14 matching lines...) Expand all Loading... |
74 supportedAttributes.add(SVGNames::y2Attr); | 74 supportedAttributes.add(SVGNames::y2Attr); |
75 } | 75 } |
76 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 76 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
77 } | 77 } |
78 | 78 |
79 void SVGLineElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 79 void SVGLineElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
80 { | 80 { |
81 SVGParsingError parseError = NoError; | 81 SVGParsingError parseError = NoError; |
82 | 82 |
83 if (!isSupportedAttribute(name)) | 83 if (!isSupportedAttribute(name)) |
84 SVGGraphicsElement::parseAttribute(name, value); | 84 SVGGeometryElement::parseAttribute(name, value); |
85 else if (name == SVGNames::x1Attr) | 85 else if (name == SVGNames::x1Attr) |
86 setX1BaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; | 86 setX1BaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; |
87 else if (name == SVGNames::y1Attr) | 87 else if (name == SVGNames::y1Attr) |
88 setY1BaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); | 88 setY1BaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); |
89 else if (name == SVGNames::x2Attr) | 89 else if (name == SVGNames::x2Attr) |
90 setX2BaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; | 90 setX2BaseValue(SVGLength::construct(LengthModeWidth, value, parseError))
; |
91 else if (name == SVGNames::y2Attr) | 91 else if (name == SVGNames::y2Attr) |
92 setY2BaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); | 92 setY2BaseValue(SVGLength::construct(LengthModeHeight, value, parseError)
); |
93 else if (SVGLangSpace::parseAttribute(name, value) | 93 else if (SVGLangSpace::parseAttribute(name, value) |
94 || SVGExternalResourcesRequired::parseAttribute(name, value)) { | 94 || SVGExternalResourcesRequired::parseAttribute(name, value)) { |
95 } else | 95 } else |
96 ASSERT_NOT_REACHED(); | 96 ASSERT_NOT_REACHED(); |
97 | 97 |
98 reportAttributeParsingError(parseError, name, value); | 98 reportAttributeParsingError(parseError, name, value); |
99 } | 99 } |
100 | 100 |
101 void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName) | 101 void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName) |
102 { | 102 { |
103 if (!isSupportedAttribute(attrName)) { | 103 if (!isSupportedAttribute(attrName)) { |
104 SVGGraphicsElement::svgAttributeChanged(attrName); | 104 SVGGeometryElement::svgAttributeChanged(attrName); |
105 return; | 105 return; |
106 } | 106 } |
107 | 107 |
108 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 108 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
109 | 109 |
110 bool isLengthAttribute = attrName == SVGNames::x1Attr | 110 bool isLengthAttribute = attrName == SVGNames::x1Attr |
111 || attrName == SVGNames::y1Attr | 111 || attrName == SVGNames::y1Attr |
112 || attrName == SVGNames::x2Attr | 112 || attrName == SVGNames::x2Attr |
113 || attrName == SVGNames::y2Attr; | 113 || attrName == SVGNames::y2Attr; |
114 | 114 |
(...skipping 20 matching lines...) Expand all Loading... |
135 | 135 |
136 bool SVGLineElement::selfHasRelativeLengths() const | 136 bool SVGLineElement::selfHasRelativeLengths() const |
137 { | 137 { |
138 return x1CurrentValue().isRelative() | 138 return x1CurrentValue().isRelative() |
139 || y1CurrentValue().isRelative() | 139 || y1CurrentValue().isRelative() |
140 || x2CurrentValue().isRelative() | 140 || x2CurrentValue().isRelative() |
141 || y2CurrentValue().isRelative(); | 141 || y2CurrentValue().isRelative(); |
142 } | 142 } |
143 | 143 |
144 } | 144 } |
OLD | NEW |