From a4e969f4965059196ca948db781e52f7cfebf19e Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 24 May 2016 08:28:08 +0000 Subject: webkitgtk-2.12.3 --- Source/WebCore/html/HTMLScriptElement.cpp | 39 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'Source/WebCore/html/HTMLScriptElement.cpp') 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::create(const QualifiedName& tagName, Document& document, bool wasInsertedByParser, bool alreadyStarted) +Ref 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 protectFromMutationEvents(*this); - int numChildren = childNodeCount(); - - if (numChildren == 1 && firstChild()->isTextNode()) { - toText(firstChild())->setData(value, IGNORE_EXCEPTION); + if (hasOneChild() && is(*firstChild())) { + downcast(*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& 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 HTMLScriptElement::cloneElementWithoutAttributesAndChildren() +Ref HTMLScriptElement::cloneElementWithoutAttributesAndChildren(Document& targetDocument) { - return adoptRef(new HTMLScriptElement(tagQName(), document(), false, alreadyStarted())); + return adoptRef(*new HTMLScriptElement(tagQName(), targetDocument, false, alreadyStarted())); } } -- cgit v1.2.1