Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: Source/core/svg/SVGScriptElement.cpp

Issue 643703006: SVGElement::parseAttribute resolves property via property map (Step 2.4) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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)) { 62 if (SVGURIReference::isKnownAttribute(attrName)) {
63 SVGElement::InvalidationGuard invalidationGuard(this);
64 m_loader->handleSourceAttribute(hrefString());
65 } else {
87 SVGElement::svgAttributeChanged(attrName); 66 SVGElement::svgAttributeChanged(attrName);
88 return;
89 } 67 }
90
91 SVGElement::InvalidationGuard invalidationGuard(this);
92
93 if (attrName == SVGNames::typeAttr || attrName == HTMLNames::onerrorAttr)
94 return;
95
96 if (SVGURIReference::isKnownAttribute(attrName)) {
97 m_loader->handleSourceAttribute(hrefString());
98 return;
99 }
100
101 ASSERT_NOT_REACHED();
102 } 68 }
103 69
104 Node::InsertionNotificationRequest SVGScriptElement::insertedInto(ContainerNode* rootParent) 70 Node::InsertionNotificationRequest SVGScriptElement::insertedInto(ContainerNode* rootParent)
105 { 71 {
106 SVGElement::insertedInto(rootParent); 72 SVGElement::insertedInto(rootParent);
107 return InsertionShouldCallDidNotifySubtreeInsertions; 73 return InsertionShouldCallDidNotifySubtreeInsertions;
108 } 74 }
109 75
110 void SVGScriptElement::didNotifySubtreeInsertionsToDocument() 76 void SVGScriptElement::didNotifySubtreeInsertionsToDocument()
111 { 77 {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 bool SVGScriptElement::isAnimatableAttribute(const QualifiedName& name) const 171 bool SVGScriptElement::isAnimatableAttribute(const QualifiedName& name) const
206 { 172 {
207 if (name == SVGNames::typeAttr) 173 if (name == SVGNames::typeAttr)
208 return false; 174 return false;
209 175
210 return SVGElement::isAnimatableAttribute(name); 176 return SVGElement::isAnimatableAttribute(name);
211 } 177 }
212 #endif 178 #endif
213 179
214 } 180 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698