Bug 1245959 - Check plugin has non-zero dimensions before sending image to compositor. r=nical

MozReview-Commit-ID: KEd5IBUGlo6

--HG--
extra : rebase_source : b1719e8c1a5cbca40a3940cf9262a4bb28b93abe
This commit is contained in:
Jamie Nicol 2016-09-19 13:28:05 +01:00
Родитель c86b6515ad
Коммит dc6488e7d5
1 изменённых файлов: 14 добавлений и 10 удалений

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

@ -222,6 +222,7 @@ nsPluginInstanceOwner::GetImageContainer()
container = LayerManager::CreateImageContainer(); container = LayerManager::CreateImageContainer();
if (r.width && r.height) {
// Try to get it as an EGLImage first. // Try to get it as an EGLImage first.
RefPtr<Image> img; RefPtr<Image> img;
AttachToContainerAsSurfaceTexture(container, mInstance, r, &img); AttachToContainerAsSurfaceTexture(container, mInstance, r, &img);
@ -229,6 +230,7 @@ nsPluginInstanceOwner::GetImageContainer()
if (img) { if (img) {
container->SetCurrentImageInTransaction(img); container->SetCurrentImageInTransaction(img);
} }
}
#else #else
if (NeedsScrollImageLayer()) { if (NeedsScrollImageLayer()) {
// windowed plugin under e10s // windowed plugin under e10s
@ -1578,11 +1580,13 @@ nsPluginInstanceOwner::GetImageContainerForVideo(nsNPAPIPluginInstance::VideoInf
{ {
RefPtr<ImageContainer> container = LayerManager::CreateImageContainer(); RefPtr<ImageContainer> container = LayerManager::CreateImageContainer();
if (aVideoInfo->mDimensions.width && aVideoInfo->mDimensions.height) {
RefPtr<Image> img = new SurfaceTextureImage( RefPtr<Image> img = new SurfaceTextureImage(
aVideoInfo->mSurfaceTexture, aVideoInfo->mSurfaceTexture,
gfx::IntSize::Truncate(aVideoInfo->mDimensions.width, aVideoInfo->mDimensions.height), gfx::IntSize::Truncate(aVideoInfo->mDimensions.width, aVideoInfo->mDimensions.height),
gl::OriginPos::BottomLeft); gl::OriginPos::BottomLeft);
container->SetCurrentImageInTransaction(img); container->SetCurrentImageInTransaction(img);
}
return container.forget(); return container.forget();
} }