Bug 1366984 - Fix image container check for background image layer. r=mattwoodrow

--HG--
extra : source : 14a2665a64f6e78b7c470a3eb0635e491660955a
This commit is contained in:
Ethan Lin 2017-05-31 14:01:28 +08:00
Родитель 017d00381d
Коммит 054093eb1e
1 изменённых файлов: 22 добавлений и 13 удалений

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

@ -1969,23 +1969,32 @@ nsCSSRendering::CanBuildWebRenderDisplayItemsForStyleImageLayer(LayerManager* aM
}
}
// We only support painting gradients and image for a single style image layer
const nsStyleImage* styleImage = &aBackgroundStyle->mImage.mLayers[aLayer].mImage;
// We only support image with image container.
if (!styleImage->IsEmpty() && styleImage->GetType() == eStyleImageType_Image) {
imgRequestProxy* requestProxy = styleImage->GetImageData();
if (requestProxy) {
nsCOMPtr<imgIContainer> srcImage;
requestProxy->GetImage(getter_AddRefs(srcImage));
if (srcImage && !srcImage->IsImageContainerAvailable(aManager, imgIContainer::FLAG_NONE)) {
return false;
}
if (styleImage->GetType() == eStyleImageType_Image) {
if (styleImage->GetCropRect()) {
return false;
}
imgRequestProxy* requestProxy = styleImage->GetImageData();
if (!requestProxy) {
return false;
}
nsCOMPtr<imgIContainer> srcImage;
requestProxy->GetImage(getter_AddRefs(srcImage));
if (!srcImage || !srcImage->IsImageContainerAvailable(aManager, imgIContainer::FLAG_NONE)) {
return false;
}
return true;
}
// We only support painting gradients and image for a single style image layer
return styleImage->GetType() == eStyleImageType_Gradient ||
styleImage->GetType() == eStyleImageType_Image;
if (styleImage->GetType() == eStyleImageType_Gradient) {
return true;
}
return false;
}
DrawResult