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

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

Issue 18676002: Refactoring: Decouple ScriptElement from HTMLScriptElement and SVGScriptElement. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed points Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGScriptElement.h ('k') | no next file » | 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 26 matching lines...) Expand all
37 DEFINE_ANIMATED_STRING(SVGScriptElement, XLinkNames::hrefAttr, Href, href) 37 DEFINE_ANIMATED_STRING(SVGScriptElement, XLinkNames::hrefAttr, Href, href)
38 DEFINE_ANIMATED_BOOLEAN(SVGScriptElement, SVGNames::externalResourcesRequiredAtt r, ExternalResourcesRequired, externalResourcesRequired) 38 DEFINE_ANIMATED_BOOLEAN(SVGScriptElement, SVGNames::externalResourcesRequiredAtt r, ExternalResourcesRequired, externalResourcesRequired)
39 39
40 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGScriptElement) 40 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGScriptElement)
41 REGISTER_LOCAL_ANIMATED_PROPERTY(href) 41 REGISTER_LOCAL_ANIMATED_PROPERTY(href)
42 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) 42 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
43 END_REGISTER_ANIMATED_PROPERTIES 43 END_REGISTER_ANIMATED_PROPERTIES
44 44
45 inline SVGScriptElement::SVGScriptElement(const QualifiedName& tagName, Document * document, bool wasInsertedByParser, bool alreadyStarted) 45 inline SVGScriptElement::SVGScriptElement(const QualifiedName& tagName, Document * document, bool wasInsertedByParser, bool alreadyStarted)
46 : SVGElement(tagName, document) 46 : SVGElement(tagName, document)
47 , ScriptElement(this, wasInsertedByParser, alreadyStarted)
48 , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired) 47 , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired)
48 , m_scriptElement(ScriptElement::create(this, wasInsertedByParser, alreadySt arted))
49 { 49 {
50 ASSERT(hasTagName(SVGNames::scriptTag)); 50 ASSERT(hasTagName(SVGNames::scriptTag));
51 ScriptWrappable::init(this); 51 ScriptWrappable::init(this);
52 registerAnimatedPropertiesForSVGScriptElement(); 52 registerAnimatedPropertiesForSVGScriptElement();
53 } 53 }
54 54
55 PassRefPtr<SVGScriptElement> SVGScriptElement::create(const QualifiedName& tagNa me, Document* document, bool insertedByParser) 55 PassRefPtr<SVGScriptElement> SVGScriptElement::create(const QualifiedName& tagNa me, Document* document, bool insertedByParser)
56 { 56 {
57 return adoptRef(new SVGScriptElement(tagName, document, insertedByParser, fa lse)); 57 return adoptRef(new SVGScriptElement(tagName, document, insertedByParser, fa lse));
58 } 58 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 SVGElement::svgAttributeChanged(attrName); 100 SVGElement::svgAttributeChanged(attrName);
101 return; 101 return;
102 } 102 }
103 103
104 SVGElementInstance::InvalidationGuard invalidationGuard(this); 104 SVGElementInstance::InvalidationGuard invalidationGuard(this);
105 105
106 if (attrName == SVGNames::typeAttr || attrName == HTMLNames::onerrorAttr) 106 if (attrName == SVGNames::typeAttr || attrName == HTMLNames::onerrorAttr)
107 return; 107 return;
108 108
109 if (SVGURIReference::isKnownAttribute(attrName)) { 109 if (SVGURIReference::isKnownAttribute(attrName)) {
110 handleSourceAttribute(href()); 110 m_scriptElement->handleSourceAttribute(href());
111 return; 111 return;
112 } 112 }
113 113
114 if (SVGExternalResourcesRequired::handleAttributeChange(this, attrName)) 114 if (SVGExternalResourcesRequired::handleAttributeChange(this, attrName))
115 return; 115 return;
116 116
117 ASSERT_NOT_REACHED(); 117 ASSERT_NOT_REACHED();
118 } 118 }
119 119
120 Node::InsertionNotificationRequest SVGScriptElement::insertedInto(ContainerNode* rootParent) 120 Node::InsertionNotificationRequest SVGScriptElement::insertedInto(ContainerNode* rootParent)
121 { 121 {
122 SVGElement::insertedInto(rootParent); 122 SVGElement::insertedInto(rootParent);
123 ScriptElement::insertedInto(rootParent); 123 m_scriptElement->insertedInto(rootParent);
124 if (rootParent->inDocument()) 124 if (rootParent->inDocument())
125 SVGExternalResourcesRequired::insertedIntoDocument(this); 125 SVGExternalResourcesRequired::insertedIntoDocument(this);
126 return InsertionDone; 126 return InsertionDone;
127 } 127 }
128 128
129 void SVGScriptElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) 129 void SVGScriptElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
130 { 130 {
131 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil dCountDelta); 131 SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, chil dCountDelta);
132 ScriptElement::childrenChanged(); 132 m_scriptElement->childrenChanged();
133 } 133 }
134 134
135 bool SVGScriptElement::isURLAttribute(const Attribute& attribute) const 135 bool SVGScriptElement::isURLAttribute(const Attribute& attribute) const
136 { 136 {
137 return attribute.name() == sourceAttributeValue(); 137 return attribute.name() == sourceAttributeValue();
138 } 138 }
139 139
140 void SVGScriptElement::finishParsingChildren() 140 void SVGScriptElement::finishParsingChildren()
141 { 141 {
142 SVGElement::finishParsingChildren(); 142 SVGElement::finishParsingChildren();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 return false; 200 return false;
201 } 201 }
202 202
203 bool SVGScriptElement::hasSourceAttribute() const 203 bool SVGScriptElement::hasSourceAttribute() const
204 { 204 {
205 return hasAttribute(XLinkNames::hrefAttr); 205 return hasAttribute(XLinkNames::hrefAttr);
206 } 206 }
207 207
208 PassRefPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren() 208 PassRefPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren()
209 { 209 {
210 return adoptRef(new SVGScriptElement(tagQName(), document(), false, alreadyS tarted())); 210 return adoptRef(new SVGScriptElement(tagQName(), document(), false, m_script Element->alreadyStarted()));
211 }
212
213 void SVGScriptElement::setHaveFiredLoadEvent(bool haveFiredLoadEvent)
214 {
215 m_scriptElement->setHaveFiredLoadEvent(haveFiredLoadEvent);
216 }
217
218 bool SVGScriptElement::isParserInserted() const
219 {
220 return m_scriptElement->isParserInserted();
221 }
222
223 bool SVGScriptElement::haveFiredLoadEvent() const
224 {
225 return m_scriptElement->haveFiredLoadEvent();
226 }
227
228 Timer<SVGElement>* SVGScriptElement::svgLoadEventTimer()
229 {
230 return &m_svgLoadEventTimer;
211 } 231 }
212 232
213 } 233 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGScriptElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698