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

Unified Diff: Source/core/html/HTMLScriptElement.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLScriptElement.h ('k') | Source/core/svg/SVGScriptElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLScriptElement.cpp
diff --git a/Source/core/html/HTMLScriptElement.cpp b/Source/core/html/HTMLScriptElement.cpp
index c0fbc1f3c20cc42b7b791ee5e6cbe770a346948f..5410907b7a191e69d1243bfe6e560c2e348373f3 100644
--- a/Source/core/html/HTMLScriptElement.cpp
+++ b/Source/core/html/HTMLScriptElement.cpp
@@ -37,7 +37,7 @@ using namespace HTMLNames;
inline HTMLScriptElement::HTMLScriptElement(const QualifiedName& tagName, Document* document, bool wasInsertedByParser, bool alreadyStarted)
: HTMLElement(tagName, document)
- , ScriptElement(this, wasInsertedByParser, alreadyStarted)
+ , m_scriptElement(ScriptElement::create(this, wasInsertedByParser, alreadyStarted))
{
ASSERT(hasTagName(scriptTag));
ScriptWrappable::init(this);
@@ -56,15 +56,15 @@ bool HTMLScriptElement::isURLAttribute(const Attribute& attribute) const
void HTMLScriptElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
- ScriptElement::childrenChanged();
+ m_scriptElement->childrenChanged();
}
void HTMLScriptElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == srcAttr)
- handleSourceAttribute(value);
+ m_scriptElement->handleSourceAttribute(value);
else if (name == asyncAttr)
- handleAsyncAttribute();
+ m_scriptElement->handleAsyncAttribute();
else if (name == onbeforeloadAttr)
setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, name, value));
else
@@ -74,7 +74,7 @@ void HTMLScriptElement::parseAttribute(const QualifiedName& name, const AtomicSt
Node::InsertionNotificationRequest HTMLScriptElement::insertedInto(ContainerNode* insertionPoint)
{
HTMLElement::insertedInto(insertionPoint);
- ScriptElement::insertedInto(insertionPoint);
+ m_scriptElement->insertedInto(insertionPoint);
return InsertionDone;
}
@@ -98,12 +98,12 @@ void HTMLScriptElement::setText(const String &value)
void HTMLScriptElement::setAsync(bool async)
{
setBooleanAttribute(asyncAttr, async);
- handleAsyncAttribute();
+ m_scriptElement->handleAsyncAttribute();
}
bool HTMLScriptElement::async() const
{
- return fastHasAttribute(asyncAttr) || forceAsync();
+ return fastHasAttribute(asyncAttr) || (m_scriptElement->forceAsync());
}
KURL HTMLScriptElement::src() const
@@ -165,15 +165,12 @@ bool HTMLScriptElement::hasSourceAttribute() const
void HTMLScriptElement::dispatchLoadEvent()
{
- ASSERT(!haveFiredLoadEvent());
- setHaveFiredLoadEvent(true);
-
dispatchEvent(Event::create(eventNames().loadEvent, false, false));
}
PassRefPtr<Element> HTMLScriptElement::cloneElementWithoutAttributesAndChildren()
{
- return adoptRef(new HTMLScriptElement(tagQName(), document(), false, alreadyStarted()));
+ return adoptRef(new HTMLScriptElement(tagQName(), document(), false, m_scriptElement->alreadyStarted()));
}
}
« no previous file with comments | « Source/core/html/HTMLScriptElement.h ('k') | Source/core/svg/SVGScriptElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698