From dc6488e7d586c8b74cb29dd9402dd6da60021306 Mon Sep 17 00:00:00 2001 From: Jamie Nicol Date: Mon, 19 Sep 2016 13:28:05 +0100 Subject: [PATCH] Bug 1245959 - Check plugin has non-zero dimensions before sending image to compositor. r=nical MozReview-Commit-ID: KEd5IBUGlo6 --HG-- extra : rebase_source : b1719e8c1a5cbca40a3940cf9262a4bb28b93abe --- dom/plugins/base/nsPluginInstanceOwner.cpp | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index a2852bfd5163..b7651be1ad00 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -222,12 +222,14 @@ nsPluginInstanceOwner::GetImageContainer() container = LayerManager::CreateImageContainer(); - // Try to get it as an EGLImage first. - RefPtr img; - AttachToContainerAsSurfaceTexture(container, mInstance, r, &img); + if (r.width && r.height) { + // Try to get it as an EGLImage first. + RefPtr img; + AttachToContainerAsSurfaceTexture(container, mInstance, r, &img); - if (img) { - container->SetCurrentImageInTransaction(img); + if (img) { + container->SetCurrentImageInTransaction(img); + } } #else if (NeedsScrollImageLayer()) { @@ -1578,11 +1580,13 @@ nsPluginInstanceOwner::GetImageContainerForVideo(nsNPAPIPluginInstance::VideoInf { RefPtr container = LayerManager::CreateImageContainer(); - RefPtr img = new SurfaceTextureImage( - aVideoInfo->mSurfaceTexture, - gfx::IntSize::Truncate(aVideoInfo->mDimensions.width, aVideoInfo->mDimensions.height), - gl::OriginPos::BottomLeft); - container->SetCurrentImageInTransaction(img); + if (aVideoInfo->mDimensions.width && aVideoInfo->mDimensions.height) { + RefPtr img = new SurfaceTextureImage( + aVideoInfo->mSurfaceTexture, + gfx::IntSize::Truncate(aVideoInfo->mDimensions.width, aVideoInfo->mDimensions.height), + gl::OriginPos::BottomLeft); + container->SetCurrentImageInTransaction(img); + } return container.forget(); }