Bug 1252739 - nsStyleImageLayers::HasLayerWithImage should return true when we have mask-image:<element-reference> | <gradient>
MozReview-Commit-ID: LMPSewQlHjz
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -2362,17 +2362,22 @@ nsStyleImageLayers::CalcDifference(const
return hint;
}
bool
nsStyleImageLayers::HasLayerWithImage() const
{
for (uint32_t i = 0; i < mImageCount; i++) {
- if (mLayers[i].mSourceURI) {
+ // mLayers[i].mSourceURI can be nullptr if mask-image prop value is
+ // <element-reference> or <gradient>
+ // mLayers[i].mImage can be empty if mask-image prop value is a reference
+ // to SVG mask element.
+ // So we need to test both mSourceURI and mImage.
+ if (mLayers[i].mSourceURI || !mLayers[i].mImage.IsEmpty()) {
return true;
}
}
return false;
}
bool