2011-02-01 Adam Barth <abarth@webkit.org>
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Feb 2011 08:00:19 +0000 (08:00 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Feb 2011 08:00:19 +0000 (08:00 +0000)
        Reviewed by Alexey Proskuryakov.

        Improve readability of updateWidget by converting bool parameter to an enum
        https://bugs.webkit.org/show_bug.cgi?id=53576

        As requested on webkit-dev.

        * html/HTMLEmbedElement.cpp:
        (WebCore::HTMLEmbedElement::updateWidget):
        * html/HTMLEmbedElement.h:
        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::updateWidget):
        * html/HTMLMediaElement.h:
        * html/HTMLObjectElement.cpp:
        (WebCore::HTMLObjectElement::updateWidget):
        * html/HTMLObjectElement.h:
        * html/HTMLPlugInImageElement.cpp:
        (WebCore::HTMLPlugInImageElement::updateWidgetIfNecessary):
        * html/HTMLPlugInImageElement.h:
        * page/FrameView.cpp:
        (WebCore::FrameView::updateWidget):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77366 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/html/HTMLEmbedElement.cpp
Source/WebCore/html/HTMLEmbedElement.h
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/HTMLObjectElement.cpp
Source/WebCore/html/HTMLObjectElement.h
Source/WebCore/html/HTMLPlugInImageElement.cpp
Source/WebCore/html/HTMLPlugInImageElement.h
Source/WebCore/page/FrameView.cpp

index f5f375a797b8b2bc8fc53148623286f22e78c83c..b4ab02fa40517109402aa791ac8ead20cdc0a052 100644 (file)
@@ -1,3 +1,27 @@
+2011-02-01  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Improve readability of updateWidget by converting bool parameter to an enum
+        https://bugs.webkit.org/show_bug.cgi?id=53576
+
+        As requested on webkit-dev.
+
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::updateWidget):
+        * html/HTMLEmbedElement.h:
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::updateWidget):
+        * html/HTMLMediaElement.h:
+        * html/HTMLObjectElement.cpp:
+        (WebCore::HTMLObjectElement::updateWidget):
+        * html/HTMLObjectElement.h:
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::HTMLPlugInImageElement::updateWidgetIfNecessary):
+        * html/HTMLPlugInImageElement.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::updateWidget):
+
 2011-02-01  James Robinson  <jamesr@chromium.org>
 
         Reviewed by Adam Barth.
index df97280738e76cf45eca4ba2f9ab1a4ff56ee26e..f419e2a3530a5b27e68873cd3859e6cb7fb934c2 100644 (file)
@@ -138,7 +138,7 @@ void HTMLEmbedElement::parametersForPlugin(Vector<String>& paramNames, Vector<St
 
 // FIXME: This should be unified with HTMLObjectElement::updateWidget and
 // moved down into HTMLPluginImageElement.cpp
-void HTMLEmbedElement::updateWidget(bool onlyCreateNonNetscapePlugins)
+void HTMLEmbedElement::updateWidget(PluginCreationOption pluginCreationOption)
 {
     ASSERT(!renderEmbeddedObject()->pluginCrashedOrWasMissing());
     // FIXME: We should ASSERT(needsWidgetUpdate()), but currently
@@ -153,7 +153,10 @@ void HTMLEmbedElement::updateWidget(bool onlyCreateNonNetscapePlugins)
     // <object> which modifies url and serviceType before calling these.
     if (!allowedToLoadFrameURL(m_url))
         return;
-    if (onlyCreateNonNetscapePlugins && wouldLoadAsNetscapePlugin(m_url, m_serviceType))
+    // FIXME: It's sadness that we have this special case here.
+    //        See http://trac.webkit.org/changeset/25128 and
+    //        plugins/netscape-plugin-setwindow-size.html
+    if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(m_url, m_serviceType))
         return;
 
     // FIXME: These should be joined into a PluginParameters class.
index 70eb0dc853faaef18bd8039fb7ea96f1ffae13a5..863c09bee4ebae96d7f585952d30c278ca9b69fb 100644 (file)
@@ -47,7 +47,7 @@ private:
 
     virtual RenderWidget* renderWidgetForJSBindings() const;
 
-    virtual void updateWidget(bool onlyCreateNonNetscapePlugins);
+    virtual void updateWidget(PluginCreationOption);
 
     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
 
index ec1e5e18e3b1c3a8e472ac9218e281f925295895..9f11aa5e488b9c0183f8fccf982ee4509db61539 100644 (file)
@@ -2392,7 +2392,7 @@ void HTMLMediaElement::createMediaPlayerProxy()
         m_needWidgetUpdate = false;
 }
 
-void HTMLMediaElement::updateWidget(bool)
+void HTMLMediaElement::updateWidget(PluginCreationOption)
 {
     mediaElement->setNeedWidgetUpdate(false);
 
index bdc34475e433435410bd3fc9fd233a52a77caa3f..e261ad9e1360010b23152d619b9e813bc290315e 100644 (file)
@@ -152,7 +152,7 @@ public:
     void getPluginProxyParams(KURL& url, Vector<String>& names, Vector<String>& values);
     virtual void finishParsingChildren();
     void createMediaPlayerProxy();
-    void updateWidget(bool onlyCreateNonNetscapePlugins);
+    void updateWidget(PluginCreationOption);
 #endif
 
     bool hasSingleSecurityOrigin() const { return !m_player || m_player->hasSingleSecurityOrigin(); }
index 84dc684c6a56f50b25fb5259b55d6c28963fcde1..da1bea9234f6da1dfbcc70eaab53ec70bfbe2c65 100644 (file)
@@ -251,7 +251,7 @@ inline bool HTMLObjectElement::hasValidClassId()
 
 // FIXME: This should be unified with HTMLEmbedElement::updateWidget and
 // moved down into HTMLPluginImageElement.cpp
-void HTMLObjectElement::updateWidget(bool onlyCreateNonNetscapePlugins)
+void HTMLObjectElement::updateWidget(PluginCreationOption pluginCreationOption)
 {
     ASSERT(!renderEmbeddedObject()->pluginCrashedOrWasMissing());
     // FIXME: We should ASSERT(needsWidgetUpdate()), but currently
@@ -277,7 +277,7 @@ void HTMLObjectElement::updateWidget(bool onlyCreateNonNetscapePlugins)
     bool fallbackContent = hasFallbackContent();
     renderEmbeddedObject()->setHasFallbackContent(fallbackContent);
 
-    if (onlyCreateNonNetscapePlugins && wouldLoadAsNetscapePlugin(url, serviceType))
+    if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(url, serviceType))
         return;
 
     ASSERT(!m_inBeforeLoadEventHandler);
index cc8a03cc28f5a5b920624064eeefad192c420c5b..a4dca8ce1884b202fd0b15b41729f48abc122830 100644 (file)
@@ -85,7 +85,7 @@ private:
 
     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
 
-    virtual void updateWidget(bool onlyCreateNonNetscapePlugins);
+    virtual void updateWidget(PluginCreationOption);
     void updateDocNamedItem();
 
     bool hasFallbackContent() const;
index 1c91c05348b87ea92912a6d53a3e91faee581f8d..db0733408a1814982fbc9cabe1966379ea76bafb 100644 (file)
@@ -166,7 +166,7 @@ void HTMLPlugInImageElement::updateWidgetIfNecessary()
     if (!renderEmbeddedObject() || renderEmbeddedObject()->pluginCrashedOrWasMissing())
         return;
 
-    updateWidget(true);
+    updateWidget(CreateOnlyNonNetscapePlugins);
 }
 
 void HTMLPlugInImageElement::finishParsingChildren()
index f394d40d9097436b6a608ac318fd5024f7401471..364262b00a83760c0f38f4bb04bfcb173ad9dad8 100644 (file)
@@ -29,12 +29,17 @@ namespace WebCore {
 class HTMLImageLoader;
 class FrameLoader;
 
+enum PluginCreationOption {
+    CreateAnyWidgetType,
+    CreateOnlyNonNetscapePlugins,
+};
+
 // Base class for HTMLObjectElement and HTMLEmbedElement
 class HTMLPlugInImageElement : public HTMLPlugInElement {
 public:
     RenderEmbeddedObject* renderEmbeddedObject() const;
 
-    virtual void updateWidget(bool onlyCreateNonNetscapePlugins) = 0;
+    virtual void updateWidget(PluginCreationOption) = 0;
 
     const String& serviceType() const { return m_serviceType; }
     const String& url() const { return m_url; }
index bbadea61c7b3d356c8b73a92ab1c187db5a45653..0e84dc0506adc9bff2d8e5fd1d99929a3381e0d1 100644 (file)
@@ -1793,11 +1793,11 @@ void FrameView::updateWidget(RenderEmbeddedObject* object)
     // FIXME: This could turn into a real virtual dispatch if we defined
     // updateWidget(bool) on HTMLElement.
     if (ownerElement->hasTagName(objectTag) || ownerElement->hasTagName(embedTag))
-        static_cast<HTMLPlugInImageElement*>(ownerElement)->updateWidget(false);
+        static_cast<HTMLPlugInImageElement*>(ownerElement)->updateWidget(CreateAnyWidgetType);
     // FIXME: It is not clear that Media elements need or want this updateWidget() call.
 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
     else if (ownerElement->hasTagName(videoTag) || ownerElement->hasTagName(audioTag))
-        static_cast<HTMLMediaElement*>(ownerElement)->updateWidget(false);
+        static_cast<HTMLMediaElement*>(ownerElement)->updateWidget(CreateAnyWidgetType);
 #endif
     else
         ASSERT_NOT_REACHED();