[GTK] wmode='transparent' for flash plugin doesn't work
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Apr 2014 15:59:37 +0000 (15:59 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Apr 2014 15:59:37 +0000 (15:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=120055

Reviewed by Gustavo Noronha Silva.

Force opaque window mode for flash plugin when wmode='transparent',
since X11 backend doesn't support transparency. We should add
proper transparency support because forcing opaque window mode
doesn't really work. Handle this as a plugin quirk instead of
adding X11 specific code to WebFrameLoaderClient::createPlugin().

* Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
(WebKit::NetscapePluginModule::determineQuirks): Add
ForceFlashWindowlessMode quirk for flash in case of EFL platform
because EFL port doesn't support windowed plugins.
* Shared/Plugins/PluginQuirks.h: Add ForceFlashWindowlessMode X11
plugin quirk.
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::initialize): Modify or add wmode
parameter for flash plugin, to force opaque window mode when
transparent mode is specified or when ForceFlashWindowlessMode
quirk is present.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::createPlugin): Remove X11 specific code.

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

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
Source/WebKit2/Shared/Plugins/PluginQuirks.h
Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

index 5a27c50..80258df 100644 (file)
@@ -1,3 +1,30 @@
+2014-04-24  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] wmode='transparent' for flash plugin doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=120055
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Force opaque window mode for flash plugin when wmode='transparent',
+        since X11 backend doesn't support transparency. We should add
+        proper transparency support because forcing opaque window mode
+        doesn't really work. Handle this as a plugin quirk instead of
+        adding X11 specific code to WebFrameLoaderClient::createPlugin().
+
+        * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
+        (WebKit::NetscapePluginModule::determineQuirks): Add
+        ForceFlashWindowlessMode quirk for flash in case of EFL platform
+        because EFL port doesn't support windowed plugins.
+        * Shared/Plugins/PluginQuirks.h: Add ForceFlashWindowlessMode X11
+        plugin quirk.
+        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+        (WebKit::NetscapePlugin::initialize): Modify or add wmode
+        parameter for flash plugin, to force opaque window mode when
+        transparent mode is specified or when ForceFlashWindowlessMode
+        quirk is present.
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::createPlugin): Remove X11 specific code.
+
 2014-04-23  Simon Fraser  <simon.fraser@apple.com>
 
         [iOS WK2] Missing content inside long overflow-scrolling:touch 
index 1e430ec..f6a548b 100644 (file)
@@ -176,7 +176,6 @@ bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginModuleI
 
 void NetscapePluginModule::determineQuirks()
 {
-#if CPU(X86_64)
     RawPluginMetaData metaData;
     if (!getPluginInfoForLoadedPlugin(metaData))
         return;
@@ -185,11 +184,15 @@ void NetscapePluginModule::determineQuirks()
     parseMIMEDescription(metaData.mimeDescription, mimeTypes);
     for (size_t i = 0; i < mimeTypes.size(); ++i) {
         if (mimeTypes[i].type == "application/x-shockwave-flash") {
+#if CPU(X86_64)
             m_pluginQuirks.add(PluginQuirks::IgnoreRightClickInWindowlessMode);
+#endif
+#if PLATFORM(EFL)
+            m_pluginQuirks.add(PluginQuirks::ForceFlashWindowlessMode);
+#endif
             break;
         }
     }
-#endif
 }
 
 static void writeByte(char byte)
index 18149fe..9274015 100644 (file)
@@ -89,6 +89,9 @@ public:
         // freeze when sending right click events to them in windowed mode.
         IgnoreRightClickInWindowlessMode,
 
+        // Some ports don't support windowed plugins.
+        ForceFlashWindowlessMode,
+
         // Windows specific quirks:
 #elif PLUGIN_ARCHITECTURE(WIN)
         // Whether NPN_UserAgent should always return a Mozilla user agent.
index cce8208..e9c6866 100644 (file)
@@ -600,6 +600,21 @@ bool NetscapePlugin::initialize(const Parameters& parameters)
         paramValues.append(parameters.values[i].utf8());
     }
 
+#if PLUGIN_ARCHITECTURE(X11)
+    if (equalIgnoringCase(parameters.mimeType, "application/x-shockwave-flash")) {
+        size_t wmodeIndex = parameters.names.find("wmode");
+        if (wmodeIndex != notFound) {
+            // Transparent window mode is not supported by X11 backend.
+            if (equalIgnoringCase(parameters.values[wmodeIndex], "transparent")
+                || (m_pluginModule->pluginQuirks().contains(PluginQuirks::ForceFlashWindowlessMode) && equalIgnoringCase(parameters.values[wmodeIndex], "window")))
+                paramValues[wmodeIndex] = "opaque";
+        } else if (m_pluginModule->pluginQuirks().contains(PluginQuirks::ForceFlashWindowlessMode)) {
+            paramNames.append("wmode");
+            paramValues.append("opaque");
+        }
+    }
+#endif
+
     // The strings that these pointers point to are kept alive by paramNames and paramValues.
     Vector<const char*> names;
     Vector<const char*> values;
index b03fb28..5313427 100644 (file)
@@ -1321,23 +1321,6 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize&, HTMLPlugIn
     parameters.layerHostingMode = m_frame->page()->layerHostingMode();
 #endif
 
-#if PLUGIN_ARCHITECTURE(X11)
-    // FIXME: This should really be X11-specific plug-in quirks.
-    if (equalIgnoringCase(mimeType, "application/x-shockwave-flash")) {
-        // Currently we don't support transparency and windowed mode.
-        // Inject wmode=opaque to make Flash work in these conditions.
-        size_t wmodeIndex = parameters.names.find("wmode");
-        if (wmodeIndex == notFound) {
-            parameters.names.append("wmode");
-            parameters.values.append("opaque");
-        } else if (equalIgnoringCase(parameters.values[wmodeIndex], "window"))
-            parameters.values[wmodeIndex] = "opaque";
-    } else if (equalIgnoringCase(mimeType, "application/x-webkit-test-netscape")) {
-        parameters.names.append("windowedPlugin");
-        parameters.values.append("false");
-    }
-#endif
-
 #if ENABLE(NETSCAPE_PLUGIN_API)
     RefPtr<Plugin> plugin = m_frame->page()->createPlugin(m_frame, pluginElement, parameters, parameters.mimeType);
     if (!plugin)