Bug 1133237 - When transitioning from a shadow layer tree that has plugins to a tree that does not, make sure the old plugins get hidden properly. r=roc

This commit is contained in:
Jim Mathies 2015-03-04 07:46:15 -06:00
parent 60347c0d1e
commit 3a6f7137ac
4 changed files with 39 additions and 3 deletions

View File

@ -258,6 +258,20 @@ CompositorChild::RecvUpdatePluginConfigurations(const nsIntPoint& aContentOffset
#endif // !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
}
bool
CompositorChild::RecvUpdatePluginVisibility(nsTArray<uintptr_t>&& aVisibleIdList)
{
#if !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
NS_NOTREACHED("CompositorChild::RecvUpdatePluginVisibility calls "
"unexpected on this platform.");
return false;
#else
MOZ_ASSERT(NS_IsMainThread());
nsIWidget::UpdateRegisteredPluginWindowVisibility(aVisibleIdList);
return true;
#endif // !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
}
bool
CompositorChild::RecvDidComposite(const uint64_t& aId, const uint64_t& aTransactionId)
{

View File

@ -80,6 +80,9 @@ public:
const nsIntRegion& aVisibleRegion,
nsTArray<PluginWindowData>&& aPlugins) MOZ_OVERRIDE;
virtual bool
RecvUpdatePluginVisibility(nsTArray<uintptr_t>&& aWindowList) MOZ_OVERRIDE;
/**
* Request that the parent tell us when graphics are ready on GPU.
* When we get that message, we bounce it to the TabParent via

View File

@ -1749,7 +1749,7 @@ CrossProcessCompositorParent::ShadowLayersUpdated(
// Cache the plugin data for this remote layer tree
state->mPluginData = aPlugins;
state->mUpdatedPluginDataAvailable = !!state->mPluginData.Length();
state->mUpdatedPluginDataAvailable = true;
state->mParent->NotifyShadowTreeTransaction(id, aIsFirstPaint, aScheduleComposite,
aPaintSequenceNumber, aIsRepeatTransaction);
@ -1763,12 +1763,13 @@ CrossProcessCompositorParent::ShadowLayersUpdated(
aLayerTree->SetPendingTransactionId(aTransactionId);
}
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
// Sends plugin window state changes to the main thread
static void
UpdatePluginWindowState(uint64_t aId)
{
CompositorParent::LayerTreeState& lts = sIndirectLayerTrees[aId];
if (!lts.mPluginData.Length()) {
if (!lts.mPluginData.Length() && !lts.mUpdatedPluginDataAvailable) {
return;
}
@ -1779,8 +1780,17 @@ UpdatePluginWindowState(uint64_t aId)
bool shouldHidePlugin = (!lts.mRoot ||
!lts.mRoot->GetParent()) &&
!lts.mUpdatedPluginDataAvailable;
if (shouldComposePlugin) {
if (!lts.mPluginData.Length()) {
// We will pass through here in cases where the previous shadow layer
// tree contained visible plugins and the new tree does not. All we need
// to do here is hide the plugins for the old tree, so don't waste time
// calculating clipping.
nsTArray<uintptr_t> aVisibleIdList;
unused << lts.mParent->SendUpdatePluginVisibility(aVisibleIdList);
return;
}
// Retrieve the offset and visible region of the layer that hosts
// the plugins, CompositorChild needs these in calculating proper
// plugin clipping.
@ -1818,6 +1828,7 @@ UpdatePluginWindowState(uint64_t aId)
lts.mPluginData.Clear();
}
}
#endif // #if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
void
CrossProcessCompositorParent::DidComposite(uint64_t aId)
@ -1828,7 +1839,9 @@ CrossProcessCompositorParent::DidComposite(uint64_t aId)
unused << SendDidComposite(aId, layerTree->GetPendingTransactionId());
layerTree->SetPendingTransactionId(0);
}
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
UpdatePluginWindowState(aId);
#endif
}
void

View File

@ -66,6 +66,12 @@ child:
nsIntRegion aVisibleRegion,
PluginWindowData[] aPlugins);
/**
* Sets the list of currently visible plugin windows based on a
* list of plugin window ids.
*/
async UpdatePluginVisibility(uintptr_t[] aVisibleIdList);
parent:
// Child sends the parent a request for fill ratio numbers.
async RequestOverfill();