Chromium Code Reviews| Index: Source/core/html/HTMLScriptElement.cpp |
| diff --git a/Source/core/html/HTMLScriptElement.cpp b/Source/core/html/HTMLScriptElement.cpp |
| index c0fbc1f3c20cc42b7b791ee5e6cbe770a346948f..83bb9ced31dd2394574426af7b8c554aabc78981 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,16 @@ 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(); |
| + if (m_scriptElement) |
|
abarth-chromium
2013/07/08 18:47:12
When would m_scriptElement ever be zero?
|
| + m_scriptElement->childrenChanged(); |
| } |
| void HTMLScriptElement::parseAttribute(const QualifiedName& name, const AtomicString& value) |
| { |
| - if (name == srcAttr) |
| - handleSourceAttribute(value); |
| - else if (name == asyncAttr) |
| - handleAsyncAttribute(); |
| + if (name == srcAttr && m_scriptElement) |
| + m_scriptElement->handleSourceAttribute(value); |
| + else if (name == asyncAttr && m_scriptElement) |
| + m_scriptElement->handleAsyncAttribute(); |
| else if (name == onbeforeloadAttr) |
| setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, name, value)); |
| else |
| @@ -74,7 +75,8 @@ void HTMLScriptElement::parseAttribute(const QualifiedName& name, const AtomicSt |
| Node::InsertionNotificationRequest HTMLScriptElement::insertedInto(ContainerNode* insertionPoint) |
| { |
| HTMLElement::insertedInto(insertionPoint); |
| - ScriptElement::insertedInto(insertionPoint); |
| + if (m_scriptElement) |
| + m_scriptElement->insertedInto(insertionPoint); |
| return InsertionDone; |
| } |
| @@ -98,12 +100,13 @@ void HTMLScriptElement::setText(const String &value) |
| void HTMLScriptElement::setAsync(bool async) |
| { |
| setBooleanAttribute(asyncAttr, async); |
| - handleAsyncAttribute(); |
| + if (m_scriptElement) |
| + m_scriptElement->handleAsyncAttribute(); |
| } |
| bool HTMLScriptElement::async() const |
| { |
| - return fastHasAttribute(asyncAttr) || forceAsync(); |
| + return fastHasAttribute(asyncAttr) || (m_scriptElement && m_scriptElement->forceAsync()); |
| } |
| KURL HTMLScriptElement::src() const |
| @@ -165,15 +168,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 && m_scriptElement->alreadyStarted())); |
| } |
| } |