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