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 12 matching lines...) Expand all Loading... |
23 #include "core/svg/SVGCursorElement.h" | 23 #include "core/svg/SVGCursorElement.h" |
24 | 24 |
25 #include "SVGNames.h" | 25 #include "SVGNames.h" |
26 #include "XLinkNames.h" | 26 #include "XLinkNames.h" |
27 #include "core/dom/Document.h" | 27 #include "core/dom/Document.h" |
28 #include "core/svg/SVGElementInstance.h" | 28 #include "core/svg/SVGElementInstance.h" |
29 | 29 |
30 namespace WebCore { | 30 namespace WebCore { |
31 | 31 |
32 // Animated property definitions | 32 // Animated property definitions |
33 DEFINE_ANIMATED_LENGTH(SVGCursorElement, SVGNames::xAttr, X, x) | |
34 DEFINE_ANIMATED_LENGTH(SVGCursorElement, SVGNames::yAttr, Y, y) | |
35 DEFINE_ANIMATED_STRING(SVGCursorElement, XLinkNames::hrefAttr, Href, href) | 33 DEFINE_ANIMATED_STRING(SVGCursorElement, XLinkNames::hrefAttr, Href, href) |
36 DEFINE_ANIMATED_BOOLEAN(SVGCursorElement, SVGNames::externalResourcesRequiredAtt
r, ExternalResourcesRequired, externalResourcesRequired) | 34 DEFINE_ANIMATED_BOOLEAN(SVGCursorElement, SVGNames::externalResourcesRequiredAtt
r, ExternalResourcesRequired, externalResourcesRequired) |
37 | 35 |
38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCursorElement) | 36 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCursorElement) |
39 REGISTER_LOCAL_ANIMATED_PROPERTY(x) | |
40 REGISTER_LOCAL_ANIMATED_PROPERTY(y) | |
41 REGISTER_LOCAL_ANIMATED_PROPERTY(href) | 37 REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
42 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | 38 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) |
43 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) | 39 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) |
44 END_REGISTER_ANIMATED_PROPERTIES | 40 END_REGISTER_ANIMATED_PROPERTIES |
45 | 41 |
46 inline SVGCursorElement::SVGCursorElement(Document& document) | 42 inline SVGCursorElement::SVGCursorElement(Document& document) |
47 : SVGElement(SVGNames::cursorTag, document) | 43 : SVGElement(SVGNames::cursorTag, document) |
48 , m_x(LengthModeWidth) | 44 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth))) |
49 , m_y(LengthModeHeight) | 45 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight))) |
50 { | 46 { |
51 ScriptWrappable::init(this); | 47 ScriptWrappable::init(this); |
| 48 |
| 49 addToPropertyMap(m_x); |
| 50 addToPropertyMap(m_y); |
52 registerAnimatedPropertiesForSVGCursorElement(); | 51 registerAnimatedPropertiesForSVGCursorElement(); |
53 } | 52 } |
54 | 53 |
55 PassRefPtr<SVGCursorElement> SVGCursorElement::create(Document& document) | 54 PassRefPtr<SVGCursorElement> SVGCursorElement::create(Document& document) |
56 { | 55 { |
57 return adoptRef(new SVGCursorElement(document)); | 56 return adoptRef(new SVGCursorElement(document)); |
58 } | 57 } |
59 | 58 |
60 SVGCursorElement::~SVGCursorElement() | 59 SVGCursorElement::~SVGCursorElement() |
61 { | 60 { |
(...skipping 15 matching lines...) Expand all Loading... |
77 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 76 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
78 } | 77 } |
79 | 78 |
80 void SVGCursorElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 79 void SVGCursorElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
81 { | 80 { |
82 SVGParsingError parseError = NoError; | 81 SVGParsingError parseError = NoError; |
83 | 82 |
84 if (!isSupportedAttribute(name)) | 83 if (!isSupportedAttribute(name)) |
85 SVGElement::parseAttribute(name, value); | 84 SVGElement::parseAttribute(name, value); |
86 else if (name == SVGNames::xAttr) | 85 else if (name == SVGNames::xAttr) |
87 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); | 86 m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); |
88 else if (name == SVGNames::yAttr) | 87 else if (name == SVGNames::yAttr) |
89 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError))
; | 88 m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); |
90 else if (SVGTests::parseAttribute(name, value) | 89 else if (SVGTests::parseAttribute(name, value) |
91 || SVGExternalResourcesRequired::parseAttribute(name, value) | 90 || SVGExternalResourcesRequired::parseAttribute(name, value) |
92 || SVGURIReference::parseAttribute(name, value)) { | 91 || SVGURIReference::parseAttribute(name, value)) { |
93 } else | 92 } else |
94 ASSERT_NOT_REACHED(); | 93 ASSERT_NOT_REACHED(); |
95 | 94 |
96 reportAttributeParsingError(parseError, name, value); | 95 reportAttributeParsingError(parseError, name, value); |
97 } | 96 } |
98 | 97 |
99 void SVGCursorElement::addClient(SVGElement* element) | 98 void SVGCursorElement::addClient(SVGElement* element) |
(...skipping 27 matching lines...) Expand all Loading... |
127 | 126 |
128 // Any change of a cursor specific attribute triggers this recalc. | 127 // Any change of a cursor specific attribute triggers this recalc. |
129 HashSet<SVGElement*>::const_iterator it = m_clients.begin(); | 128 HashSet<SVGElement*>::const_iterator it = m_clients.begin(); |
130 HashSet<SVGElement*>::const_iterator end = m_clients.end(); | 129 HashSet<SVGElement*>::const_iterator end = m_clients.end(); |
131 | 130 |
132 for (; it != end; ++it) | 131 for (; it != end; ++it) |
133 (*it)->setNeedsStyleRecalc(); | 132 (*it)->setNeedsStyleRecalc(); |
134 } | 133 } |
135 | 134 |
136 } | 135 } |
OLD | NEW |