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

eric at webkit.org eric at webkit.org
Wed Dec 22 12:56:11 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 0389292802b9bfcb8787fc217e4cccbd92574018
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 2 10:05:36 2010 +0000

    2010-09-02  Eric Seidel  <eric at webkit.org>
    
            Reviewed by Dimitri Glazkov.
    
            Share more code between HTMLObjectElement and HTMLEmbedElement
            https://bugs.webkit.org/show_bug.cgi?id=45054
    
            This pushes more of HTMLObjectElement code down into
            HTMLPlugInImageElement so that it can be shared with HTMLEmbedElement.
    
            I also moved a little code from HTMLPluginElement to HTMLPlugInImageElement
            since HTMLAppletElement does not need to share this same widget update logic.
            This is a small correction from the previous change.
    
            This patch was originally written in one piece and reviewed by Dimitri.
            I'm landing it as three separate changes for easier readability and less
            chance of regression.
    
            No functional change, thus no tests.
    
            * html/HTMLEmbedElement.cpp:
            * html/HTMLEmbedElement.h:
            * html/HTMLObjectElement.cpp:
            (WebCore::HTMLObjectElement::attach):
            (WebCore::HTMLObjectElement::finishParsingChildren):
            (WebCore::HTMLObjectElement::detach):
            (WebCore::HTMLObjectElement::recalcStyle):
            (WebCore::HTMLObjectElement::childrenChanged):
            (WebCore::HTMLObjectElement::renderFallbackContent):
            * html/HTMLObjectElement.h:
            (WebCore::HTMLObjectElement::useFallbackContent):
            * html/HTMLPlugInElement.cpp:
            * html/HTMLPlugInElement.h:
            * html/HTMLPlugInImageElement.cpp:
            (WebCore::HTMLPlugInImageElement::createRenderer):
            (WebCore::HTMLPlugInImageElement::updateWidget):
            (WebCore::HTMLPlugInImageElement::updateWidgetCallback):
            * html/HTMLPlugInImageElement.h:
            (WebCore::HTMLPlugInImageElement::canLazyAttach):
            (WebCore::HTMLPlugInImageElement::useFallbackContent):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66653 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 64b0aef..fad10df 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,44 @@
+2010-09-02  Eric Seidel  <eric at webkit.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Share more code between HTMLObjectElement and HTMLEmbedElement
+        https://bugs.webkit.org/show_bug.cgi?id=45054
+
+        This pushes more of HTMLObjectElement code down into
+        HTMLPlugInImageElement so that it can be shared with HTMLEmbedElement.
+
+        I also moved a little code from HTMLPluginElement to HTMLPlugInImageElement
+        since HTMLAppletElement does not need to share this same widget update logic.
+        This is a small correction from the previous change.
+
+        This patch was originally written in one piece and reviewed by Dimitri.
+        I'm landing it as three separate changes for easier readability and less
+        chance of regression.
+
+        No functional change, thus no tests.
+
+        * html/HTMLEmbedElement.cpp:
+        * html/HTMLEmbedElement.h:
+        * html/HTMLObjectElement.cpp:
+        (WebCore::HTMLObjectElement::attach):
+        (WebCore::HTMLObjectElement::finishParsingChildren):
+        (WebCore::HTMLObjectElement::detach):
+        (WebCore::HTMLObjectElement::recalcStyle):
+        (WebCore::HTMLObjectElement::childrenChanged):
+        (WebCore::HTMLObjectElement::renderFallbackContent):
+        * html/HTMLObjectElement.h:
+        (WebCore::HTMLObjectElement::useFallbackContent):
+        * html/HTMLPlugInElement.cpp:
+        * html/HTMLPlugInElement.h:
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::HTMLPlugInImageElement::createRenderer):
+        (WebCore::HTMLPlugInImageElement::updateWidget):
+        (WebCore::HTMLPlugInImageElement::updateWidgetCallback):
+        * html/HTMLPlugInImageElement.h:
+        (WebCore::HTMLPlugInImageElement::canLazyAttach):
+        (WebCore::HTMLPlugInImageElement::useFallbackContent):
+
 2010-09-02  Jer Noble  <jer.noble at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/html/HTMLEmbedElement.cpp b/WebCore/html/HTMLEmbedElement.cpp
index 69e7823..1e562d1 100644
--- a/WebCore/html/HTMLEmbedElement.cpp
+++ b/WebCore/html/HTMLEmbedElement.cpp
@@ -151,16 +151,6 @@ bool HTMLEmbedElement::rendererIsNeeded(RenderStyle* style)
     return HTMLPlugInImageElement::rendererIsNeeded(style);
 }
 
-RenderObject* HTMLEmbedElement::createRenderer(RenderArena* arena, RenderStyle*)
-{
-    if (isImageType()) {
-        RenderImage* image = new (arena) RenderImage(this);
-        image->setImageResource(RenderImageResource::create());
-        return image;
-    }
-    return new (arena) RenderEmbeddedObject(this);
-}
-
 void HTMLEmbedElement::attach()
 {
     setNeedsWidgetUpdate(true);
@@ -182,13 +172,6 @@ void HTMLEmbedElement::attach()
     }
 }
 
-void HTMLEmbedElement::updateWidget()
-{
-    document()->updateStyleIfNeeded();
-    if (needsWidgetUpdate() && renderEmbeddedObject() && !isImageType())
-        renderEmbeddedObject()->updateWidget(true);
-}
-
 void HTMLEmbedElement::insertedIntoDocument()
 {
     if (document()->isHTMLDocument())
diff --git a/WebCore/html/HTMLEmbedElement.h b/WebCore/html/HTMLEmbedElement.h
index 058144e..bab1c64 100644
--- a/WebCore/html/HTMLEmbedElement.h
+++ b/WebCore/html/HTMLEmbedElement.h
@@ -38,9 +38,7 @@ private:
     virtual void parseMappedAttribute(Attribute*);
 
     virtual void attach();
-    virtual bool canLazyAttach() { return false; }
     virtual bool rendererIsNeeded(RenderStyle*);
-    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
     virtual void insertedIntoDocument();
     virtual void removedFromDocument();
     virtual void attributeChanged(Attribute*, bool preserveDecls = false);
@@ -48,8 +46,6 @@ private:
     virtual bool isURLAttribute(Attribute*) const;
     virtual const QualifiedName& imageSourceAttributeName() const;
 
-    virtual void updateWidget();
-
     virtual RenderWidget* renderWidgetForJSBindings() const;
 
     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
diff --git a/WebCore/html/HTMLObjectElement.cpp b/WebCore/html/HTMLObjectElement.cpp
index 1d19bfe..d76c0c1 100644
--- a/WebCore/html/HTMLObjectElement.cpp
+++ b/WebCore/html/HTMLObjectElement.cpp
@@ -131,21 +131,6 @@ bool HTMLObjectElement::rendererIsNeeded(RenderStyle* style)
     return isGearsPlugin || HTMLPlugInImageElement::rendererIsNeeded(style);
 }
 
-RenderObject* HTMLObjectElement::createRenderer(RenderArena* arena, RenderStyle* style)
-{
-    // Fallback content breaks the DOM->Renderer class relationship of this
-    // class and all superclasses because createObject won't necessarily
-    // return a RenderEmbeddedObject, RenderPart or even RenderWidget.
-    if (m_useFallbackContent)
-        return RenderObject::createObject(this, style);
-    if (isImageType()) {
-        RenderImage* image = new (arena) RenderImage(this);
-        image->setImageResource(RenderImageResource::create());
-        return image;
-    }
-    return new (arena) RenderEmbeddedObject(this);
-}
-
 void HTMLObjectElement::attach()
 {
     bool isImage = isImageType();
@@ -155,24 +140,17 @@ void HTMLObjectElement::attach()
 
     HTMLPlugInImageElement::attach();
 
-    if (isImage && renderer() && !m_useFallbackContent) {
+    if (isImage && renderer() && !useFallbackContent()) {
         if (!m_imageLoader)
             m_imageLoader = adoptPtr(new HTMLImageLoader(this));
         m_imageLoader->updateFromElement();
     }
 }
 
-void HTMLObjectElement::updateWidget()
-{
-    document()->updateStyleIfNeeded();
-    if (needsWidgetUpdate() && renderEmbeddedObject() && !m_useFallbackContent && !isImageType())
-        renderEmbeddedObject()->updateWidget(true);
-}
-
 void HTMLObjectElement::finishParsingChildren()
 {
     HTMLPlugInImageElement::finishParsingChildren();
-    if (!m_useFallbackContent) {
+    if (!useFallbackContent()) {
         setNeedsWidgetUpdate(true);
         if (inDocument())
             setNeedsStyleRecalc();
@@ -181,7 +159,7 @@ void HTMLObjectElement::finishParsingChildren()
 
 void HTMLObjectElement::detach()
 {
-    if (attached() && renderer() && !m_useFallbackContent)
+    if (attached() && renderer() && !useFallbackContent())
         // Update the widget the next time we attach (detaching destroys the plugin).
         setNeedsWidgetUpdate(true);
     HTMLPlugInImageElement::detach();
@@ -211,7 +189,7 @@ void HTMLObjectElement::removedFromDocument()
 
 void HTMLObjectElement::recalcStyle(StyleChange ch)
 {
-    if (!m_useFallbackContent && needsWidgetUpdate() && renderer() && !isImageType()) {
+    if (!useFallbackContent() && needsWidgetUpdate() && renderer() && !isImageType()) {
         detach();
         attach();
     }
@@ -221,7 +199,7 @@ void HTMLObjectElement::recalcStyle(StyleChange ch)
 void HTMLObjectElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
 {
     updateDocNamedItem();
-    if (inDocument() && !m_useFallbackContent) {
+    if (inDocument() && !useFallbackContent()) {
         setNeedsWidgetUpdate(true);
         setNeedsStyleRecalc();
     }
@@ -240,7 +218,7 @@ const QualifiedName& HTMLObjectElement::imageSourceAttributeName() const
 
 void HTMLObjectElement::renderFallbackContent()
 {
-    if (m_useFallbackContent)
+    if (useFallbackContent())
         return;
     
     if (!inDocument())
diff --git a/WebCore/html/HTMLObjectElement.h b/WebCore/html/HTMLObjectElement.h
index 1bf774c..13c0df8 100644
--- a/WebCore/html/HTMLObjectElement.h
+++ b/WebCore/html/HTMLObjectElement.h
@@ -39,7 +39,7 @@ public:
 
     bool containsJavaApplet() const;
 
-    bool useFallbackContent() const { return m_useFallbackContent; }
+    virtual bool useFallbackContent() const { return m_useFallbackContent; }
 
 private:
     HTMLObjectElement(const QualifiedName&, Document*, bool createdByParser);
@@ -47,9 +47,7 @@ private:
     virtual void parseMappedAttribute(Attribute*);
 
     virtual void attach();
-    virtual bool canLazyAttach() { return false; }
     virtual bool rendererIsNeeded(RenderStyle*);
-    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
     virtual void finishParsingChildren();
     virtual void detach();
     virtual void insertedIntoDocument();
@@ -61,8 +59,6 @@ private:
     virtual bool isURLAttribute(Attribute*) const;
     virtual const QualifiedName& imageSourceAttributeName() const;
 
-    virtual void updateWidget();
-
     virtual RenderWidget* renderWidgetForJSBindings() const;
 
     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
diff --git a/WebCore/html/HTMLPlugInElement.cpp b/WebCore/html/HTMLPlugInElement.cpp
index 1871b65..f074923 100644
--- a/WebCore/html/HTMLPlugInElement.cpp
+++ b/WebCore/html/HTMLPlugInElement.cpp
@@ -177,9 +177,4 @@ NPObject* HTMLPlugInElement::getNPObject()
 
 #endif /* ENABLE(NETSCAPE_PLUGIN_API) */
 
-void HTMLPlugInElement::updateWidgetCallback(Node* n)
-{
-    static_cast<HTMLPlugInElement*>(n)->updateWidget();
-}
-
 }
diff --git a/WebCore/html/HTMLPlugInElement.h b/WebCore/html/HTMLPlugInElement.h
index d31d86e..847d83b 100644
--- a/WebCore/html/HTMLPlugInElement.h
+++ b/WebCore/html/HTMLPlugInElement.h
@@ -56,8 +56,6 @@ protected:
 
     virtual void detach();
 
-    static void updateWidgetCallback(Node*);
-
     virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
     virtual void parseMappedAttribute(Attribute*);
 
@@ -66,8 +64,6 @@ private:
 
     virtual RenderWidget* renderWidgetForJSBindings() const = 0;
 
-    virtual void updateWidget() { }
-
 protected:
     AtomicString m_name;
 
diff --git a/WebCore/html/HTMLPlugInImageElement.cpp b/WebCore/html/HTMLPlugInImageElement.cpp
index 776218e..7111c1f 100644
--- a/WebCore/html/HTMLPlugInImageElement.cpp
+++ b/WebCore/html/HTMLPlugInImageElement.cpp
@@ -27,6 +27,7 @@
 #include "HTMLImageLoader.h"
 #include "Image.h"
 #include "RenderEmbeddedObject.h"
+#include "RenderImage.h"
 
 namespace WebCore {
 
@@ -58,6 +59,28 @@ bool HTMLPlugInImageElement::isImageType()
     return Image::supportsType(m_serviceType);
 }
 
+RenderObject* HTMLPlugInImageElement::createRenderer(RenderArena* arena, RenderStyle* style)
+{
+    // Fallback content breaks the DOM->Renderer class relationship of this
+    // class and all superclasses because createObject won't necessarily
+    // return a RenderEmbeddedObject, RenderPart or even RenderWidget.
+    if (useFallbackContent())
+        return RenderObject::createObject(this, style);
+    if (isImageType()) {
+        RenderImage* image = new (arena) RenderImage(this);
+        image->setImageResource(RenderImageResource::create());
+        return image;
+    }
+    return new (arena) RenderEmbeddedObject(this);
+}
+
+void HTMLPlugInImageElement::updateWidget()
+{
+    document()->updateStyleIfNeeded();
+    if (needsWidgetUpdate() && renderEmbeddedObject() && !useFallbackContent() && !isImageType())
+        renderEmbeddedObject()->updateWidget(true);
+}
+
 void HTMLPlugInImageElement::willMoveToNewOwnerDocument()
 {
     if (m_imageLoader)
@@ -65,4 +88,9 @@ void HTMLPlugInImageElement::willMoveToNewOwnerDocument()
     HTMLPlugInElement::willMoveToNewOwnerDocument();
 }
 
+void HTMLPlugInImageElement::updateWidgetCallback(Node* n)
+{
+    static_cast<HTMLPlugInImageElement*>(n)->updateWidget();
+}
+
 } // namespace WebCore
diff --git a/WebCore/html/HTMLPlugInImageElement.h b/WebCore/html/HTMLPlugInImageElement.h
index f48951d..9e19b27 100644
--- a/WebCore/html/HTMLPlugInImageElement.h
+++ b/WebCore/html/HTMLPlugInImageElement.h
@@ -44,13 +44,22 @@ protected:
 
     bool isImageType();
 
+    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+
+    static void updateWidgetCallback(Node*);
+
     OwnPtr<HTMLImageLoader> m_imageLoader;
     String m_serviceType;
     String m_url;
 
 private:
+    virtual bool canLazyAttach() { return false; }
+
     virtual void willMoveToNewOwnerDocument();
 
+    void updateWidget();
+    virtual bool useFallbackContent() const { return false; }
+    
     bool m_needsWidgetUpdate;
 };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list