Bug 1299715 - Part 7. Correct clip region for mask surface. r=mstange

MozReview-Commit-ID: 1MZA9uxO9Oi

--HG--
extra : rebase_source : cb23768fb82339b4641602ac90194d009446e1d2
This commit is contained in:
cku 2016-10-07 14:46:41 +08:00
Родитель 0d557e384c
Коммит 07f31bbe99
1 изменённых файлов: 18 добавлений и 10 удалений

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

@ -411,6 +411,22 @@ private:
nsPoint mOffset;
};
/**
* Returns true if any of the masks is an image mask (and not an SVG mask).
*/
static bool
HasNonSVGMask(const nsTArray<nsSVGMaskFrame *>& aMaskFrames)
{
for (size_t i = 0; i < aMaskFrames.Length() ; i++) {
nsSVGMaskFrame *maskFrame = aMaskFrames[i];
if (!maskFrame) {
return true;
}
}
return false;
}
typedef nsSVGIntegrationUtils::PaintFramesParams PaintFramesParams;
static DrawResult
@ -476,14 +492,7 @@ GenerateMaskSurface(const PaintFramesParams& aParams,
// Set aAppliedOpacity as true only if all mask layers are svg mask.
// In this case, we will apply opacity into the final mask surface, so the
// caller does not need to apply it again.
aOpacityApplied = true;
for (size_t i = 0; i < aMaskFrames.Length() ; i++) {
nsSVGMaskFrame *maskFrame = aMaskFrames[i];
if (!maskFrame) {
aOpacityApplied = false;
break;
}
}
aOpacityApplied = !HasNonSVGMask(aMaskFrames);
// Multiple SVG masks interleave with image mask. Paint each layer onto
// maskDT one at a time.
@ -756,12 +765,11 @@ nsSVGIntegrationUtils::PaintMaskAndClipPath(const PaintFramesParams& aParams)
// so we setup context matrix by the position of the current frame,
// instead of the first continuation frame.
SetupContextMatrix(frame, aParams, offsetToBoundingBox,
offsetToUserSpace, true);
offsetToUserSpace, false);
result = GenerateMaskSurface(aParams, opacity,
firstFrame->StyleContext(),
maskFrames, offsetToUserSpace,
maskTransform, maskSurface, opacityApplied);
context.PopClip();
if (!maskSurface) {
// Entire surface is clipped out.
return result;