From a3cc27784c5fe7527a2b70ac30c995d56b0c51f2 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Tue, 22 May 2012 18:19:26 +0000 Subject: [PATCH] Allow wmode="transparent" for Flash when using off-screen rendering (issue #527). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@640 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- cef1/libcef/browser_webview_delegate.cc | 27 +++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/cef1/libcef/browser_webview_delegate.cc b/cef1/libcef/browser_webview_delegate.cc index 924aca436..7338b7ee2 100644 --- a/cef1/libcef/browser_webview_delegate.cc +++ b/cef1/libcef/browser_webview_delegate.cc @@ -627,18 +627,33 @@ WebPlugin* BrowserWebViewDelegate::createPlugin( #endif if (force_windowless) { - WebPluginParams params_copy = params; - params_copy.mimeType = WebString::fromUTF8(mime_types.front()); + DCHECK_EQ(params.attributeNames.size(), params.attributeValues.size()); - bool flash = LowerCaseEqualsASCII(params_copy.mimeType.utf8(), + std::string mime_type = mime_types.front(); + bool flash = LowerCaseEqualsASCII(mime_type, "application/x-shockwave-flash"); - bool silverlight = StartsWithASCII(params_copy.mimeType.utf8(), + bool silverlight = StartsWithASCII(mime_type, "application/x-silverlight", false); + if (flash) { + // "wmode" values of "opaque" or "transparent" are allowed. + size_t size = params.attributeNames.size(); + for (size_t i = 0; i < size; ++i) { + std::string name = params.attributeNames[i].utf8(); + if (name == "wmode") { + std::string value = params.attributeValues[i].utf8(); + if (value == "opaque" || value == "transparent") + flash = false; + break; + } + } + } + if (flash || silverlight) { + WebPluginParams params_copy = params; + params_copy.mimeType = WebString::fromUTF8(mime_type); + // Force Flash and Silverlight plugins to use windowless mode. - DCHECK(params_copy.attributeNames.size() == - params_copy.attributeValues.size()); size_t size = params_copy.attributeNames.size(); WebVector new_names(size+1), new_values(size+1);