[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

rniwa at webkit.org rniwa at webkit.org
Wed Dec 22 15:57:24 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 33794ef4b9c254ef580231af1708f1b00b179add
Author: rniwa at webkit.org <rniwa at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 17 05:56:42 2010 +0000

    2010-11-15  Ryosuke Niwa  <rniwa at webkit.org>
    
            Reviewed by Darin Adler.
    
            ScriptElementData should be a private member of ScriptElement
            https://bugs.webkit.org/show_bug.cgi?id=49578
    
            Privatized m_data of ScriptElement. Added haveFiredLoadEvent, setHaveFiredLoadEvent, createdByParser,
            and isEvaluated to ScriptElement to proxy calls from HTMLScriptElement and SVGScriptElement to ScriptElementData.
    
            No tests are added since this is a cleanup.
    
            * dom/ScriptElement.h:
            (WebCore::ScriptElement::haveFiredLoadEvent): Added.
            (WebCore::ScriptElement::setHaveFiredLoadEvent): Added.
            (WebCore::ScriptElement::createdByParser): Added.
            (WebCore::ScriptElement::isEvaluated): Added.
            * html/HTMLScriptElement.cpp:
            (WebCore::HTMLScriptElement::dispatchLoadEvent): Calls haveFiredLoadEvent and setHaveFiredLoadEvent.
            (WebCore::HTMLScriptElement::cloneElementWithoutAttributesAndChildren): Calls isEvaluated.
            * html/HTMLScriptElement.h:
            (WebCore::HTMLScriptElement::text): Calls scriptContent.
            (WebCore::HTMLScriptElement::haveFiredLoadEvent): Calls haveFiredLoadEvent.
            * svg/SVGScriptElement.cpp:
            (WebCore::SVGScriptElement::svgAttributeChanged): Calls haveFiredLoadEvent and createdByParser.
            (WebCore::SVGScriptElement::insertedIntoDocument): Calls createdByParser.
            (WebCore::SVGScriptElement::finishParsingChildren): Calls setHaveFiredLoadEvent.
            (WebCore::SVGScriptElement::haveLoadedRequiredResources): Ditto.
            (WebCore::SVGScriptElement::dispatchLoadEvent): Calls haveFiredLoadEvent.
            (WebCore::SVGScriptElement::cloneElementWithoutAttributesAndChildren): Calls createdByParser,
            haveFiredLoadEvent, and setHaveFiredLoadEvent.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72172 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e20614a..f74fa65 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,35 @@
+2010-11-15  Ryosuke Niwa  <rniwa at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        ScriptElementData should be a private member of ScriptElement
+        https://bugs.webkit.org/show_bug.cgi?id=49578
+
+        Privatized m_data of ScriptElement. Added haveFiredLoadEvent, setHaveFiredLoadEvent, createdByParser,
+        and isEvaluated to ScriptElement to proxy calls from HTMLScriptElement and SVGScriptElement to ScriptElementData.
+
+        No tests are added since this is a cleanup.
+
+        * dom/ScriptElement.h:
+        (WebCore::ScriptElement::haveFiredLoadEvent): Added.
+        (WebCore::ScriptElement::setHaveFiredLoadEvent): Added.
+        (WebCore::ScriptElement::createdByParser): Added.
+        (WebCore::ScriptElement::isEvaluated): Added.
+        * html/HTMLScriptElement.cpp:
+        (WebCore::HTMLScriptElement::dispatchLoadEvent): Calls haveFiredLoadEvent and setHaveFiredLoadEvent.
+        (WebCore::HTMLScriptElement::cloneElementWithoutAttributesAndChildren): Calls isEvaluated.
+        * html/HTMLScriptElement.h:
+        (WebCore::HTMLScriptElement::text): Calls scriptContent.
+        (WebCore::HTMLScriptElement::haveFiredLoadEvent): Calls haveFiredLoadEvent.
+        * svg/SVGScriptElement.cpp:
+        (WebCore::SVGScriptElement::svgAttributeChanged): Calls haveFiredLoadEvent and createdByParser.
+        (WebCore::SVGScriptElement::insertedIntoDocument): Calls createdByParser.
+        (WebCore::SVGScriptElement::finishParsingChildren): Calls setHaveFiredLoadEvent.
+        (WebCore::SVGScriptElement::haveLoadedRequiredResources): Ditto.
+        (WebCore::SVGScriptElement::dispatchLoadEvent): Calls haveFiredLoadEvent.
+        (WebCore::SVGScriptElement::cloneElementWithoutAttributesAndChildren): Calls createdByParser,
+        haveFiredLoadEvent, and setHaveFiredLoadEvent.
+
 2010-11-16  Antti Koivisto  <antti at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/dom/ScriptElement.h b/WebCore/dom/ScriptElement.h
index 79c4af9..3f96ea0 100644
--- a/WebCore/dom/ScriptElement.h
+++ b/WebCore/dom/ScriptElement.h
@@ -31,8 +31,6 @@ class Element;
 class ScriptElement;
 class ScriptSourceCode;
 
-// HTML/SVGScriptElement hold this struct as member variable
-// and pass it to the static helper functions in ScriptElement
 class ScriptElementData : private CachedResourceClient {
 public:
     ScriptElementData(ScriptElement*, Element*, bool isEvaluated);
@@ -87,20 +85,18 @@ public:
     String scriptContent() const;
     bool shouldExecuteAsJavaScript() const;
     void executeScript(const ScriptSourceCode&);
-    
-    virtual String sourceAttributeValue() const = 0;
-    virtual String charsetAttributeValue() const = 0;
-    virtual String typeAttributeValue() const = 0;
-    virtual String languageAttributeValue() const = 0;
-    virtual String forAttributeValue() const = 0;
-    virtual String eventAttributeValue() const = 0;
-    virtual bool asyncAttributeValue() const = 0;
-    virtual bool deferAttributeValue() const = 0;
 
+    // XML parser calls these
+    virtual String sourceAttributeValue() const = 0;
     virtual void dispatchLoadEvent() = 0;
     virtual void dispatchErrorEvent() = 0;
 
 protected:
+    bool haveFiredLoadEvent() const { return m_data.haveFiredLoadEvent(); }
+    void setHaveFiredLoadEvent(bool firedLoad) { return m_data.setHaveFiredLoadEvent(firedLoad); }
+    bool createdByParser() const { return m_data.createdByParser(); }
+    bool isEvaluated() const { return m_data.isEvaluated(); }
+
     // Helper functions used by our parent classes.
     void insertedIntoDocument(const String& sourceUrl);
     void removedFromDocument();
@@ -108,6 +104,17 @@ protected:
     void finishParsingChildren(const String& sourceUrl);
     void handleSourceAttribute(const String& sourceUrl);
 
+private:
+    virtual String charsetAttributeValue() const = 0;
+    virtual String typeAttributeValue() const = 0;
+    virtual String languageAttributeValue() const = 0;
+    virtual String forAttributeValue() const = 0;
+    virtual String eventAttributeValue() const = 0;
+    virtual bool asyncAttributeValue() const = 0;
+    virtual bool deferAttributeValue() const = 0;
+
+    friend class ScriptElementData;
+
     ScriptElementData m_data;
 };
 
diff --git a/WebCore/html/HTMLScriptElement.cpp b/WebCore/html/HTMLScriptElement.cpp
index 91fa416..0ee93df 100644
--- a/WebCore/html/HTMLScriptElement.cpp
+++ b/WebCore/html/HTMLScriptElement.cpp
@@ -92,11 +92,6 @@ void HTMLScriptElement::removedFromDocument()
     ScriptElement::removedFromDocument();
 }
 
-String HTMLScriptElement::text() const
-{
-    return m_data.scriptContent();
-}
-
 void HTMLScriptElement::setText(const String &value)
 {
     ExceptionCode ec = 0;
@@ -167,8 +162,8 @@ bool HTMLScriptElement::deferAttributeValue() const
 
 void HTMLScriptElement::dispatchLoadEvent()
 {
-    ASSERT(!m_data.haveFiredLoadEvent());
-    m_data.setHaveFiredLoadEvent(true);
+    ASSERT(!haveFiredLoadEvent());
+    setHaveFiredLoadEvent(true);
 
     dispatchEvent(Event::create(eventNames().loadEvent, false, false));
 }
@@ -180,7 +175,7 @@ void HTMLScriptElement::dispatchErrorEvent()
 
 PassRefPtr<Element> HTMLScriptElement::cloneElementWithoutAttributesAndChildren() const
 {
-    return adoptRef(new HTMLScriptElement(tagQName(), document(), false, m_data.isEvaluated()));
+    return adoptRef(new HTMLScriptElement(tagQName(), document(), false, isEvaluated()));
 }
 
 }
diff --git a/WebCore/html/HTMLScriptElement.h b/WebCore/html/HTMLScriptElement.h
index aae73a7..5b91ecc 100644
--- a/WebCore/html/HTMLScriptElement.h
+++ b/WebCore/html/HTMLScriptElement.h
@@ -33,12 +33,12 @@ class HTMLScriptElement : public HTMLElement, public ScriptElement {
 public:
     static PassRefPtr<HTMLScriptElement> create(const QualifiedName&, Document*, bool createdByParser);
 
-    String text() const;
+    String text() const { return scriptContent(); }
     void setText(const String&);
 
     KURL src() const;
 
-    bool haveFiredLoadEvent() const { return m_data.haveFiredLoadEvent(); }
+    bool haveFiredLoadEvent() const { return ScriptElement::haveFiredLoadEvent(); }
 
 private:
     HTMLScriptElement(const QualifiedName&, Document*, bool createdByParser, bool isEvaluated);
diff --git a/WebCore/svg/SVGScriptElement.cpp b/WebCore/svg/SVGScriptElement.cpp
index 18f9df3..9146ddc 100644
--- a/WebCore/svg/SVGScriptElement.cpp
+++ b/WebCore/svg/SVGScriptElement.cpp
@@ -68,8 +68,8 @@ void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName)
         // Handle dynamic updates of the 'externalResourcesRequired' attribute. Only possible case: changing from 'true' to 'false'
         // causes an immediate dispatch of the SVGLoad event. If the attribute value was 'false' before inserting the script element
         // in the document, the SVGLoad event has already been dispatched.
-        if (!externalResourcesRequiredBaseValue() && !m_data.haveFiredLoadEvent() && !m_data.createdByParser()) {
-            m_data.setHaveFiredLoadEvent(true);
+        if (!externalResourcesRequiredBaseValue() && !haveFiredLoadEvent() && !createdByParser()) {
+            setHaveFiredLoadEvent(true);
             ASSERT(haveLoadedRequiredResources());
 
             sendSVGLoadEventIfPossible();
@@ -98,12 +98,12 @@ void SVGScriptElement::insertedIntoDocument()
     SVGElement::insertedIntoDocument();
     ScriptElement::insertedIntoDocument(sourceAttributeValue());
 
-    if (m_data.createdByParser())
+    if (createdByParser())
         return;
 
     // Eventually send SVGLoad event now for the dynamically inserted script element
     if (!externalResourcesRequiredBaseValue()) {
-        m_data.setHaveFiredLoadEvent(true);
+        setHaveFiredLoadEvent(true);
         sendSVGLoadEventIfPossible();
     }
 }
@@ -132,7 +132,7 @@ void SVGScriptElement::finishParsingChildren()
 
     // A SVGLoad event has been fired by SVGElement::finishParsingChildren.
     if (!externalResourcesRequiredBaseValue())
-        m_data.setHaveFiredLoadEvent(true);
+        setHaveFiredLoadEvent(true);
 }
 
 String SVGScriptElement::type() const
@@ -154,7 +154,7 @@ void SVGScriptElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) cons
 
 bool SVGScriptElement::haveLoadedRequiredResources()
 {
-    return !externalResourcesRequiredBaseValue() || m_data.haveFiredLoadEvent();
+    return !externalResourcesRequiredBaseValue() || haveFiredLoadEvent();
 }
 
 String SVGScriptElement::sourceAttributeValue() const
@@ -201,9 +201,9 @@ void SVGScriptElement::dispatchLoadEvent()
 {
     bool externalResourcesRequired = externalResourcesRequiredBaseValue();
 
-    if (m_data.createdByParser())
-        ASSERT(externalResourcesRequired != m_data.haveFiredLoadEvent());
-    else if (m_data.haveFiredLoadEvent()) {
+    if (createdByParser())
+        ASSERT(externalResourcesRequired != haveFiredLoadEvent());
+    else if (haveFiredLoadEvent()) {
         // If we've already fired an load event and externalResourcesRequired is set to 'true'
         // externalResourcesRequired has been modified while loading the <script>. Don't dispatch twice.
         if (externalResourcesRequired)
@@ -215,10 +215,10 @@ void SVGScriptElement::dispatchLoadEvent()
     // SVG fires the SVGLoad event immediately after parsing the <script> element, if externalResourcesRequired
     // is set to 'false', otherwhise it dispatches the 'SVGLoad' event just after loading the remote resource.
     if (externalResourcesRequired) {
-        ASSERT(!m_data.haveFiredLoadEvent());
+        ASSERT(!haveFiredLoadEvent());
 
         // Dispatch SVGLoad event
-        m_data.setHaveFiredLoadEvent(true);
+        setHaveFiredLoadEvent(true);
         ASSERT(haveLoadedRequiredResources());
 
         sendSVGLoadEventIfPossible();
@@ -232,7 +232,7 @@ void SVGScriptElement::dispatchErrorEvent()
 
 PassRefPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren() const
 {
-    return adoptRef(new SVGScriptElement(tagQName(), document(), false, m_data.isEvaluated()));
+    return adoptRef(new SVGScriptElement(tagQName(), document(), false, isEvaluated()));
 }
 
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list