Bug 599476 - windowless plugins in object elements with data (e.g. certain Flash pages) are not painted. r=karlt a=beta7

This commit is contained in:
Oleg Romashin 2010-10-02 09:00:45 -07:00
Родитель 4fc4b53c27
Коммит cc0f0fc4ff
7 изменённых файлов: 46 добавлений и 16 удалений

Просмотреть файл

@ -459,7 +459,10 @@ public:
PRBool UseLayers()
{
return (mUsePluginLayers &&
PRBool useAsyncRendering;
return (mInstance &&
NS_SUCCEEDED(mInstance->UseAsyncPainting(&useAsyncRendering)) &&
useAsyncRendering &&
(!mPluginWindow ||
mPluginWindow->type == NPWindowTypeDrawable));
}
@ -593,7 +596,6 @@ private:
nsRefPtr<gfxASurface> mLayerSurface;
PRPackedBool mWaitingForPaint;
PRPackedBool mUsePluginLayers;
};
// Mac specific code to fix up port position and clip
@ -2787,13 +2789,6 @@ nsPluginInstanceOwner::nsPluginInstanceOwner()
#endif
mWaitingForPaint = PR_FALSE;
mUsePluginLayers =
nsContentUtils::GetBoolPref("mozilla.plugins.use_layers",
#ifdef MOZ_X11
PR_TRUE); // Lets test plugin layers on X11 first
#else
PR_FALSE); // Lets test plugin layers on X11 first
#endif
PR_LOG(nsObjectFrameLM, PR_LOG_DEBUG,
("nsPluginInstanceOwner %p created\n", this));
@ -2879,12 +2874,6 @@ nsPluginInstanceOwner::SetInstance(nsIPluginInstance *aInstance)
NS_ASSERTION(!mInstance || !aInstance, "mInstance should only be set once!");
mInstance = aInstance;
PRBool useAsyncPainting = PR_FALSE;
if (mInstance &&
mUsePluginLayers &&
NS_SUCCEEDED(mInstance->UseAsyncPainting(&useAsyncPainting)) &&
!useAsyncPainting)
mUsePluginLayers = PR_FALSE;
return NS_OK;
}

Просмотреть файл

@ -0,0 +1,7 @@
<!doctype html>
<html><head>
</head>
<body>
<div style="background-color: #00FF00; width: 200px; height: 100px;"></div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,7 @@
<!doctype html>
<html><head>
</head>
<body>
<object width="200" height="100" data="data:application/x-test,0" drawmode="solid" color="ff00ff00"></object>
</body>
</html>

Просмотреть файл

@ -1506,3 +1506,4 @@ random-if(layersGPUAccelerated) == 581317-1.html 581317-1-ref.html
== 593544-1.html 593544-1-ref.html
== 594737-1.html 594737-1-ref.html
== 594624-1.html 594624-1-ref.html
fails-if(!haveTestPlugin) == 599476.html 599476-ref.html

Просмотреть файл

@ -84,7 +84,12 @@ nsNPAPIPluginInstance::nsNPAPIPluginInstance(nsNPAPIPlugin* plugin)
mPlugin(plugin),
mMIMEType(nsnull),
mOwner(nsnull),
mCurrentPluginEvent(nsnull)
mCurrentPluginEvent(nsnull),
#ifdef MOZ_X11
mUsePluginLayersPref(PR_TRUE)
#else
mUsePluginLayersPref(PR_FALSE)
#endif
{
NS_ASSERTION(mPlugin != NULL, "Plugin is required when creating an instance.");
@ -93,6 +98,14 @@ nsNPAPIPluginInstance::nsNPAPIPluginInstance(nsNPAPIPlugin* plugin)
mNPP.pdata = NULL;
mNPP.ndata = this;
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
PRBool useLayersPref;
nsresult rv = prefs->GetBoolPref("mozilla.plugins.use_layers", &useLayersPref);
if (NS_SUCCEEDED(rv))
mUsePluginLayersPref = useLayersPref;
}
PLUGIN_LOG(PLUGIN_LOG_BASIC, ("nsNPAPIPluginInstance ctor: this=%p\n",this));
}
@ -878,6 +891,11 @@ nsNPAPIPluginInstance::NotifyPainted(void)
NS_IMETHODIMP
nsNPAPIPluginInstance::UseAsyncPainting(PRBool* aIsAsync)
{
if (!mUsePluginLayersPref) {
*aIsAsync = mUsePluginLayersPref;
return NS_OK;
}
PluginDestructionGuard guard(this);
if (!mPlugin)

Просмотреть файл

@ -204,6 +204,8 @@ private:
mozilla::TimeStamp mStopTime;
nsCOMPtr<nsIURI> mURI;
PRPackedBool mUsePluginLayersPref;
};
#endif // nsNPAPIPluginInstance_h_

Просмотреть файл

@ -598,6 +598,12 @@ nsPluginStreamListenerPeer::OnStartRequest(nsIRequest *request,
// If we've got a native window, the let the plugin know about it.
if (window->window) {
((nsPluginNativeWindow*)window)->CallSetWindow(pluginInstCOMPtr);
} else {
PRBool useAsyncPainting = PR_FALSE;
mPluginInstance->UseAsyncPainting(&useAsyncPainting);
if (useAsyncPainting) {
mPluginInstance->AsyncSetWindow(window);
}
}
}
}