diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-05-24 08:28:08 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-05-24 08:28:08 +0000 |
commit | a4e969f4965059196ca948db781e52f7cfebf19e (patch) | |
tree | 6ca352808c8fdc52006a0f33f6ae3c593b23867d /Source/WebCore/html/HTMLScriptElement.cpp | |
parent | 41386e9cb918eed93b3f13648cbef387e371e451 (diff) | |
download | WebKitGtk-tarball-a4e969f4965059196ca948db781e52f7cfebf19e.tar.gz |
webkitgtk-2.12.3webkitgtk-2.12.3
Diffstat (limited to 'Source/WebCore/html/HTMLScriptElement.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLScriptElement.cpp | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/Source/WebCore/html/HTMLScriptElement.cpp b/Source/WebCore/html/HTMLScriptElement.cpp index b0bdc951c..0ea55f5c4 100644 --- a/Source/WebCore/html/HTMLScriptElement.cpp +++ b/Source/WebCore/html/HTMLScriptElement.cpp @@ -23,7 +23,6 @@ #include "config.h" #include "HTMLScriptElement.h" -#include "Attribute.h" #include "Document.h" #include "Event.h" #include "EventNames.h" @@ -37,14 +36,14 @@ using namespace HTMLNames; inline HTMLScriptElement::HTMLScriptElement(const QualifiedName& tagName, Document& document, bool wasInsertedByParser, bool alreadyStarted) : HTMLElement(tagName, document) - , ScriptElement(this, wasInsertedByParser, alreadyStarted) + , ScriptElement(*this, wasInsertedByParser, alreadyStarted) { ASSERT(hasTagName(scriptTag)); } -PassRefPtr<HTMLScriptElement> HTMLScriptElement::create(const QualifiedName& tagName, Document& document, bool wasInsertedByParser, bool alreadyStarted) +Ref<HTMLScriptElement> HTMLScriptElement::create(const QualifiedName& tagName, Document& document, bool wasInsertedByParser, bool alreadyStarted) { - return adoptRef(new HTMLScriptElement(tagName, document, wasInsertedByParser, alreadyStarted)); + return adoptRef(*new HTMLScriptElement(tagName, document, wasInsertedByParser, alreadyStarted)); } bool HTMLScriptElement::isURLAttribute(const Attribute& attribute) const @@ -64,8 +63,6 @@ void HTMLScriptElement::parseAttribute(const QualifiedName& name, const AtomicSt handleSourceAttribute(value); else if (name == asyncAttr) handleAsyncAttribute(); - else if (name == onbeforeloadAttr) - setAttributeEventListener(eventNames().beforeloadEvent, name, value); else HTMLElement::parseAttribute(name, value); } @@ -73,22 +70,24 @@ void HTMLScriptElement::parseAttribute(const QualifiedName& name, const AtomicSt Node::InsertionNotificationRequest HTMLScriptElement::insertedInto(ContainerNode& insertionPoint) { HTMLElement::insertedInto(insertionPoint); - ScriptElement::insertedInto(insertionPoint); - return InsertionDone; + return shouldCallFinishedInsertingSubtree(insertionPoint) ? InsertionShouldCallFinishedInsertingSubtree : InsertionDone; +} + +void HTMLScriptElement::finishedInsertingSubtree() +{ + ScriptElement::finishedInsertingSubtree(); } void HTMLScriptElement::setText(const String &value) { Ref<HTMLScriptElement> protectFromMutationEvents(*this); - int numChildren = childNodeCount(); - - if (numChildren == 1 && firstChild()->isTextNode()) { - toText(firstChild())->setData(value, IGNORE_EXCEPTION); + if (hasOneChild() && is<Text>(*firstChild())) { + downcast<Text>(*firstChild()).setData(value); return; } - if (numChildren > 0) + if (hasChildNodes()) removeChildren(); appendChild(document().createTextNode(value.impl()), IGNORE_EXCEPTION); @@ -119,12 +118,12 @@ void HTMLScriptElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) cons String HTMLScriptElement::sourceAttributeValue() const { - return getAttribute(srcAttr).string(); + return fastGetAttribute(srcAttr).string(); } String HTMLScriptElement::charsetAttributeValue() const { - return getAttribute(charsetAttr).string(); + return fastGetAttribute(charsetAttr).string(); } String HTMLScriptElement::typeAttributeValue() const @@ -134,17 +133,17 @@ String HTMLScriptElement::typeAttributeValue() const String HTMLScriptElement::languageAttributeValue() const { - return getAttribute(languageAttr).string(); + return fastGetAttribute(languageAttr).string(); } String HTMLScriptElement::forAttributeValue() const { - return getAttribute(forAttr).string(); + return fastGetAttribute(forAttr).string(); } String HTMLScriptElement::eventAttributeValue() const { - return getAttribute(eventAttr).string(); + return fastGetAttribute(eventAttr).string(); } bool HTMLScriptElement::asyncAttributeValue() const @@ -170,9 +169,9 @@ void HTMLScriptElement::dispatchLoadEvent() dispatchEvent(Event::create(eventNames().loadEvent, false, false)); } -PassRefPtr<Element> HTMLScriptElement::cloneElementWithoutAttributesAndChildren() +Ref<Element> HTMLScriptElement::cloneElementWithoutAttributesAndChildren(Document& targetDocument) { - return adoptRef(new HTMLScriptElement(tagQName(), document(), false, alreadyStarted())); + return adoptRef(*new HTMLScriptElement(tagQName(), targetDocument, false, alreadyStarted())); } } |