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