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

Unified 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: Fixed a crash 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 side-by-side diff with in-line comments
Download patch
« Source/core/svg/SVGScriptElement.h ('K') | « Source/core/svg/SVGScriptElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGScriptElement.cpp
diff --git a/Source/core/svg/SVGScriptElement.cpp b/Source/core/svg/SVGScriptElement.cpp
index 754f98d219e712f190eb9dab7c917a633ef4a444..b8e797efe3980b143f8f409d85505470128f1320 100644
--- a/Source/core/svg/SVGScriptElement.cpp
+++ b/Source/core/svg/SVGScriptElement.cpp
@@ -43,8 +43,8 @@ END_REGISTER_ANIMATED_PROPERTIES
inline SVGScriptElement::SVGScriptElement(const QualifiedName& tagName, Document* document, bool wasInsertedByParser, bool alreadyStarted)
: SVGElement(tagName, document)
- , ScriptElement(this, wasInsertedByParser, alreadyStarted)
, m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired)
+ , m_scriptElement(ScriptElement::create(this, wasInsertedByParser, alreadyStarted))
{
ASSERT(hasTagName(SVGNames::scriptTag));
ScriptWrappable::init(this);
@@ -106,7 +106,8 @@ void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName)
return;
if (SVGURIReference::isKnownAttribute(attrName)) {
- handleSourceAttribute(href());
+ if (m_scriptElement)
+ m_scriptElement->handleSourceAttribute(href());
return;
}
@@ -119,7 +120,8 @@ void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName)
Node::InsertionNotificationRequest SVGScriptElement::insertedInto(ContainerNode* rootParent)
{
SVGElement::insertedInto(rootParent);
- ScriptElement::insertedInto(rootParent);
+ if (m_scriptElement)
+ m_scriptElement->insertedInto(rootParent);
if (rootParent->inDocument())
SVGExternalResourcesRequired::insertedIntoDocument(this);
return InsertionDone;
@@ -128,7 +130,8 @@ Node::InsertionNotificationRequest SVGScriptElement::insertedInto(ContainerNode*
void SVGScriptElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
- ScriptElement::childrenChanged();
+ if (m_scriptElement)
+ m_scriptElement->childrenChanged();
}
bool SVGScriptElement::isURLAttribute(const Attribute& attribute) const
@@ -206,7 +209,7 @@ bool SVGScriptElement::hasSourceAttribute() const
PassRefPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren()
{
- return adoptRef(new SVGScriptElement(tagQName(), document(), false, alreadyStarted()));
+ return adoptRef(new SVGScriptElement(tagQName(), document(), false, m_scriptElement && m_scriptElement->alreadyStarted()));
}
}
« Source/core/svg/SVGScriptElement.h ('K') | « Source/core/svg/SVGScriptElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698