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

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

Issue 62083002: Remove support for the externalResourcesRequired attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebaseline test Created 6 years, 11 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
« no previous file with comments | « Source/core/svg/SVGScriptElement.h ('k') | Source/core/svg/SVGScriptElement.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 18 matching lines...) Expand all
29 #include "core/dom/Document.h" 29 #include "core/dom/Document.h"
30 #include "core/dom/ScriptLoader.h" 30 #include "core/dom/ScriptLoader.h"
31 #include "core/events/ThreadLocalEventNames.h" 31 #include "core/events/ThreadLocalEventNames.h"
32 #include "core/svg/SVGElementInstance.h" 32 #include "core/svg/SVGElementInstance.h"
33 #include "core/svg/properties/SVGAnimatedStaticPropertyTearOff.h" 33 #include "core/svg/properties/SVGAnimatedStaticPropertyTearOff.h"
34 34
35 namespace WebCore { 35 namespace WebCore {
36 36
37 // Animated property definitions 37 // Animated property definitions
38 DEFINE_ANIMATED_STRING(SVGScriptElement, XLinkNames::hrefAttr, Href, href) 38 DEFINE_ANIMATED_STRING(SVGScriptElement, XLinkNames::hrefAttr, Href, href)
39 DEFINE_ANIMATED_BOOLEAN(SVGScriptElement, SVGNames::externalResourcesRequiredAtt r, ExternalResourcesRequired, externalResourcesRequired)
40 39
41 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGScriptElement) 40 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGScriptElement)
42 REGISTER_LOCAL_ANIMATED_PROPERTY(href) 41 REGISTER_LOCAL_ANIMATED_PROPERTY(href)
43 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
44 END_REGISTER_ANIMATED_PROPERTIES 42 END_REGISTER_ANIMATED_PROPERTIES
45 43
46 inline SVGScriptElement::SVGScriptElement(Document& document, bool wasInsertedBy Parser, bool alreadyStarted) 44 inline SVGScriptElement::SVGScriptElement(Document& document, bool wasInsertedBy Parser, bool alreadyStarted)
47 : SVGElement(SVGNames::scriptTag, document) 45 : SVGElement(SVGNames::scriptTag, document)
48 , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired) 46 , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired)
49 , m_loader(ScriptLoader::create(this, wasInsertedByParser, alreadyStarted)) 47 , m_loader(ScriptLoader::create(this, wasInsertedByParser, alreadyStarted))
50 { 48 {
51 ScriptWrappable::init(this); 49 ScriptWrappable::init(this);
52 registerAnimatedPropertiesForSVGScriptElement(); 50 registerAnimatedPropertiesForSVGScriptElement();
53 } 51 }
54 52
55 PassRefPtr<SVGScriptElement> SVGScriptElement::create(Document& document, bool i nsertedByParser) 53 PassRefPtr<SVGScriptElement> SVGScriptElement::create(Document& document, bool i nsertedByParser)
56 { 54 {
57 return adoptRef(new SVGScriptElement(document, insertedByParser, false)); 55 return adoptRef(new SVGScriptElement(document, insertedByParser, false));
58 } 56 }
59 57
60 bool SVGScriptElement::isSupportedAttribute(const QualifiedName& attrName) 58 bool SVGScriptElement::isSupportedAttribute(const QualifiedName& attrName)
61 { 59 {
62 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 60 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
63 if (supportedAttributes.isEmpty()) { 61 if (supportedAttributes.isEmpty()) {
64 SVGURIReference::addSupportedAttributes(supportedAttributes); 62 SVGURIReference::addSupportedAttributes(supportedAttributes);
65 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes );
66 supportedAttributes.add(SVGNames::typeAttr); 63 supportedAttributes.add(SVGNames::typeAttr);
67 supportedAttributes.add(HTMLNames::onerrorAttr); 64 supportedAttributes.add(HTMLNames::onerrorAttr);
68 } 65 }
69 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 66 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
70 } 67 }
71 68
72 void SVGScriptElement::parseAttribute(const QualifiedName& name, const AtomicStr ing& value) 69 void SVGScriptElement::parseAttribute(const QualifiedName& name, const AtomicStr ing& value)
73 { 70 {
74 if (!isSupportedAttribute(name)) { 71 if (!isSupportedAttribute(name)) {
75 SVGElement::parseAttribute(name, value); 72 SVGElement::parseAttribute(name, value);
76 return; 73 return;
77 } 74 }
78 75
79 if (name == SVGNames::typeAttr) { 76 if (name == SVGNames::typeAttr) {
80 setType(value); 77 setType(value);
81 return; 78 return;
82 } 79 }
83 80
84 if (name == HTMLNames::onerrorAttr) { 81 if (name == HTMLNames::onerrorAttr) {
85 setAttributeEventListener(EventTypeNames::error, createAttributeEventLis tener(this, name, value)); 82 setAttributeEventListener(EventTypeNames::error, createAttributeEventLis tener(this, name, value));
86 return; 83 return;
87 } 84 }
88 85
89 if (SVGURIReference::parseAttribute(name, value)) 86 if (SVGURIReference::parseAttribute(name, value))
90 return; 87 return;
91 if (SVGExternalResourcesRequired::parseAttribute(name, value))
92 return;
93 88
94 ASSERT_NOT_REACHED(); 89 ASSERT_NOT_REACHED();
95 } 90 }
96 91
97 void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName) 92 void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName)
98 { 93 {
99 if (!isSupportedAttribute(attrName)) { 94 if (!isSupportedAttribute(attrName)) {
100 SVGElement::svgAttributeChanged(attrName); 95 SVGElement::svgAttributeChanged(attrName);
101 return; 96 return;
102 } 97 }
103 98
104 SVGElementInstance::InvalidationGuard invalidationGuard(this); 99 SVGElementInstance::InvalidationGuard invalidationGuard(this);
105 100
106 if (attrName == SVGNames::typeAttr || attrName == HTMLNames::onerrorAttr) 101 if (attrName == SVGNames::typeAttr || attrName == HTMLNames::onerrorAttr)
107 return; 102 return;
108 103
109 if (SVGURIReference::isKnownAttribute(attrName)) { 104 if (SVGURIReference::isKnownAttribute(attrName)) {
110 m_loader->handleSourceAttribute(hrefCurrentValue()); 105 m_loader->handleSourceAttribute(hrefCurrentValue());
111 return; 106 return;
112 } 107 }
113 108
114 if (SVGExternalResourcesRequired::handleAttributeChange(this, attrName))
115 return;
116
117 ASSERT_NOT_REACHED(); 109 ASSERT_NOT_REACHED();
118 } 110 }
119 111
120 Node::InsertionNotificationRequest SVGScriptElement::insertedInto(ContainerNode* rootParent) 112 Node::InsertionNotificationRequest SVGScriptElement::insertedInto(ContainerNode* rootParent)
121 { 113 {
122 SVGElement::insertedInto(rootParent); 114 SVGElement::insertedInto(rootParent);
123 return InsertionShouldCallDidNotifySubtreeInsertions; 115 return InsertionShouldCallDidNotifySubtreeInsertions;
124 } 116 }
125 117
126 void SVGScriptElement::didNotifySubtreeInsertionsToDocument() 118 void SVGScriptElement::didNotifySubtreeInsertionsToDocument()
127 { 119 {
128 m_loader->didNotifySubtreeInsertionsToDocument(); 120 m_loader->didNotifySubtreeInsertionsToDocument();
129 SVGExternalResourcesRequired::insertedIntoDocument(this); 121
122 if (!m_loader->isParserInserted()) {
123 m_loader->setHaveFiredLoadEvent(true);
124 sendSVGLoadEventIfPossibleAsynchronously();
125 }
130 } 126 }
131 127
132 void SVGScriptElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) 128 void SVGScriptElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
133 { 129 {
134 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil dCountDelta); 130 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil dCountDelta);
135 m_loader->childrenChanged(); 131 m_loader->childrenChanged();
136 } 132 }
137 133
138 bool SVGScriptElement::isURLAttribute(const Attribute& attribute) const 134 bool SVGScriptElement::isURLAttribute(const Attribute& attribute) const
139 { 135 {
140 return attribute.name() == AtomicString(sourceAttributeValue()); 136 return attribute.name() == AtomicString(sourceAttributeValue());
141 } 137 }
142 138
143 void SVGScriptElement::finishParsingChildren() 139 void SVGScriptElement::finishParsingChildren()
144 { 140 {
145 SVGElement::finishParsingChildren(); 141 SVGElement::finishParsingChildren();
146 SVGExternalResourcesRequired::finishParsingChildren(); 142 m_loader->setHaveFiredLoadEvent(true);
147 } 143 }
148 144
149 String SVGScriptElement::type() const 145 String SVGScriptElement::type() const
150 { 146 {
151 return m_type; 147 return m_type;
152 } 148 }
153 149
154 void SVGScriptElement::setType(const String& type) 150 void SVGScriptElement::setType(const String& type)
155 { 151 {
156 m_type = type; 152 m_type = type;
157 } 153 }
158 154
155 bool SVGScriptElement::haveLoadedRequiredResources()
156 {
157 return m_loader->haveFiredLoadEvent();
158 }
159
159 String SVGScriptElement::sourceAttributeValue() const 160 String SVGScriptElement::sourceAttributeValue() const
160 { 161 {
161 return hrefCurrentValue(); 162 return hrefCurrentValue();
162 } 163 }
163 164
164 String SVGScriptElement::charsetAttributeValue() const 165 String SVGScriptElement::charsetAttributeValue() const
165 { 166 {
166 return String(); 167 return String();
167 } 168 }
168 169
(...skipping 30 matching lines...) Expand all
199 bool SVGScriptElement::hasSourceAttribute() const 200 bool SVGScriptElement::hasSourceAttribute() const
200 { 201 {
201 return hasAttribute(XLinkNames::hrefAttr); 202 return hasAttribute(XLinkNames::hrefAttr);
202 } 203 }
203 204
204 PassRefPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren() 205 PassRefPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren()
205 { 206 {
206 return adoptRef(new SVGScriptElement(document(), false, m_loader->alreadySta rted())); 207 return adoptRef(new SVGScriptElement(document(), false, m_loader->alreadySta rted()));
207 } 208 }
208 209
209 void SVGScriptElement::setHaveFiredLoadEvent(bool haveFiredLoadEvent) 210 void SVGScriptElement::dispatchLoadEvent()
210 { 211 {
211 m_loader->setHaveFiredLoadEvent(haveFiredLoadEvent); 212 dispatchEvent(Event::create(EventTypeNames::load));
212 }
213
214 bool SVGScriptElement::isParserInserted() const
215 {
216 return m_loader->isParserInserted();
217 }
218
219 bool SVGScriptElement::haveFiredLoadEvent() const
220 {
221 return m_loader->haveFiredLoadEvent();
222 }
223
224 Timer<SVGElement>* SVGScriptElement::svgLoadEventTimer()
225 {
226 return &m_svgLoadEventTimer;
227 } 213 }
228 214
229 } 215 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGScriptElement.h ('k') | Source/core/svg/SVGScriptElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698