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 | 34 |
37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCursorElement) | 35 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCursorElement) |
38 REGISTER_LOCAL_ANIMATED_PROPERTY(x) | |
39 REGISTER_LOCAL_ANIMATED_PROPERTY(y) | |
40 REGISTER_LOCAL_ANIMATED_PROPERTY(href) | 36 REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
41 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) | 37 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) |
42 END_REGISTER_ANIMATED_PROPERTIES | 38 END_REGISTER_ANIMATED_PROPERTIES |
43 | 39 |
44 inline SVGCursorElement::SVGCursorElement(Document& document) | 40 inline SVGCursorElement::SVGCursorElement(Document& document) |
45 : SVGElement(SVGNames::cursorTag, document) | 41 : SVGElement(SVGNames::cursorTag, document) |
46 , m_x(LengthModeWidth) | 42 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len
gthModeWidth))) |
47 , m_y(LengthModeHeight) | 43 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len
gthModeHeight))) |
48 { | 44 { |
49 ScriptWrappable::init(this); | 45 ScriptWrappable::init(this); |
| 46 |
| 47 addToPropertyMap(m_x); |
| 48 addToPropertyMap(m_y); |
50 registerAnimatedPropertiesForSVGCursorElement(); | 49 registerAnimatedPropertiesForSVGCursorElement(); |
51 } | 50 } |
52 | 51 |
53 PassRefPtr<SVGCursorElement> SVGCursorElement::create(Document& document) | 52 PassRefPtr<SVGCursorElement> SVGCursorElement::create(Document& document) |
54 { | 53 { |
55 return adoptRef(new SVGCursorElement(document)); | 54 return adoptRef(new SVGCursorElement(document)); |
56 } | 55 } |
57 | 56 |
58 SVGCursorElement::~SVGCursorElement() | 57 SVGCursorElement::~SVGCursorElement() |
59 { | 58 { |
(...skipping 14 matching lines...) Expand all Loading... |
74 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 73 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
75 } | 74 } |
76 | 75 |
77 void SVGCursorElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 76 void SVGCursorElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
78 { | 77 { |
79 SVGParsingError parseError = NoError; | 78 SVGParsingError parseError = NoError; |
80 | 79 |
81 if (!isSupportedAttribute(name)) | 80 if (!isSupportedAttribute(name)) |
82 SVGElement::parseAttribute(name, value); | 81 SVGElement::parseAttribute(name, value); |
83 else if (name == SVGNames::xAttr) | 82 else if (name == SVGNames::xAttr) |
84 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); | 83 m_x->setBaseValueAsString(value, AllowNegativeLengths, parseError); |
85 else if (name == SVGNames::yAttr) | 84 else if (name == SVGNames::yAttr) |
86 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError))
; | 85 m_y->setBaseValueAsString(value, AllowNegativeLengths, parseError); |
87 else if (SVGTests::parseAttribute(name, value) | 86 else if (SVGTests::parseAttribute(name, value) |
88 || SVGURIReference::parseAttribute(name, value)) { | 87 || SVGURIReference::parseAttribute(name, value)) { |
89 } else | 88 } else |
90 ASSERT_NOT_REACHED(); | 89 ASSERT_NOT_REACHED(); |
91 | 90 |
92 reportAttributeParsingError(parseError, name, value); | 91 reportAttributeParsingError(parseError, name, value); |
93 } | 92 } |
94 | 93 |
95 void SVGCursorElement::addClient(SVGElement* element) | 94 void SVGCursorElement::addClient(SVGElement* element) |
96 { | 95 { |
(...skipping 26 matching lines...) Expand all Loading... |
123 | 122 |
124 // Any change of a cursor specific attribute triggers this recalc. | 123 // Any change of a cursor specific attribute triggers this recalc. |
125 HashSet<SVGElement*>::const_iterator it = m_clients.begin(); | 124 HashSet<SVGElement*>::const_iterator it = m_clients.begin(); |
126 HashSet<SVGElement*>::const_iterator end = m_clients.end(); | 125 HashSet<SVGElement*>::const_iterator end = m_clients.end(); |
127 | 126 |
128 for (; it != end; ++it) | 127 for (; it != end; ++it) |
129 (*it)->setNeedsStyleRecalc(); | 128 (*it)->setNeedsStyleRecalc(); |
130 } | 129 } |
131 | 130 |
132 } | 131 } |
OLD | NEW |