OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 SVGScriptElement::~SVGScriptElement() | 43 SVGScriptElement::~SVGScriptElement() |
44 { | 44 { |
45 } | 45 } |
46 | 46 |
47 PassRefPtrWillBeRawPtr<SVGScriptElement> SVGScriptElement::create(Document& docu
ment, bool insertedByParser) | 47 PassRefPtrWillBeRawPtr<SVGScriptElement> SVGScriptElement::create(Document& docu
ment, bool insertedByParser) |
48 { | 48 { |
49 return adoptRefWillBeNoop(new SVGScriptElement(document, insertedByParser, f
alse)); | 49 return adoptRefWillBeNoop(new SVGScriptElement(document, insertedByParser, f
alse)); |
50 } | 50 } |
51 | 51 |
52 bool SVGScriptElement::isSupportedAttribute(const QualifiedName& attrName) | |
53 { | |
54 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | |
55 if (supportedAttributes.isEmpty()) { | |
56 SVGURIReference::addSupportedAttributes(supportedAttributes); | |
57 supportedAttributes.add(SVGNames::typeAttr); | |
58 supportedAttributes.add(HTMLNames::onerrorAttr); | |
59 } | |
60 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | |
61 } | |
62 | |
63 void SVGScriptElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 52 void SVGScriptElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
64 { | 53 { |
65 if (!isSupportedAttribute(name)) { | 54 if (name == HTMLNames::onerrorAttr) |
66 SVGElement::parseAttribute(name, value); | |
67 return; | |
68 } | |
69 | |
70 SVGParsingError parseError = NoError; | |
71 if (name == SVGNames::typeAttr) | |
72 return; | |
73 | |
74 if (name == HTMLNames::onerrorAttr) { | |
75 setAttributeEventListener(EventTypeNames::error, createAttributeEventLis
tener(this, name, value, eventParameterName())); | 55 setAttributeEventListener(EventTypeNames::error, createAttributeEventLis
tener(this, name, value, eventParameterName())); |
76 } else if (SVGURIReference::parseAttribute(name, value, parseError)) { | 56 else |
77 } else { | 57 parseAttributeNew(name, value); |
78 ASSERT_NOT_REACHED(); | |
79 } | |
80 | |
81 reportAttributeParsingError(parseError, name, value); | |
82 } | 58 } |
83 | 59 |
84 void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName) | 60 void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName) |
85 { | 61 { |
86 if (!isSupportedAttribute(attrName)) { | |
87 SVGElement::svgAttributeChanged(attrName); | |
88 return; | |
89 } | |
90 | |
91 SVGElement::InvalidationGuard invalidationGuard(this); | |
92 | |
93 if (attrName == SVGNames::typeAttr || attrName == HTMLNames::onerrorAttr) | |
94 return; | |
95 | |
96 if (SVGURIReference::isKnownAttribute(attrName)) { | 62 if (SVGURIReference::isKnownAttribute(attrName)) { |
| 63 SVGElement::InvalidationGuard invalidationGuard(this); |
97 m_loader->handleSourceAttribute(hrefString()); | 64 m_loader->handleSourceAttribute(hrefString()); |
98 return; | 65 return; |
99 } | 66 } |
100 | 67 |
101 ASSERT_NOT_REACHED(); | 68 SVGElement::svgAttributeChanged(attrName); |
102 } | 69 } |
103 | 70 |
104 Node::InsertionNotificationRequest SVGScriptElement::insertedInto(ContainerNode*
rootParent) | 71 Node::InsertionNotificationRequest SVGScriptElement::insertedInto(ContainerNode*
rootParent) |
105 { | 72 { |
106 SVGElement::insertedInto(rootParent); | 73 SVGElement::insertedInto(rootParent); |
107 return InsertionShouldCallDidNotifySubtreeInsertions; | 74 return InsertionShouldCallDidNotifySubtreeInsertions; |
108 } | 75 } |
109 | 76 |
110 void SVGScriptElement::didNotifySubtreeInsertionsToDocument() | 77 void SVGScriptElement::didNotifySubtreeInsertionsToDocument() |
111 { | 78 { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 bool SVGScriptElement::isAnimatableAttribute(const QualifiedName& name) const | 172 bool SVGScriptElement::isAnimatableAttribute(const QualifiedName& name) const |
206 { | 173 { |
207 if (name == SVGNames::typeAttr) | 174 if (name == SVGNames::typeAttr) |
208 return false; | 175 return false; |
209 | 176 |
210 return SVGElement::isAnimatableAttribute(name); | 177 return SVGElement::isAnimatableAttribute(name); |
211 } | 178 } |
212 #endif | 179 #endif |
213 | 180 |
214 } | 181 } |
OLD | NEW |