Bug 1313898 - Part 3. Also paint trivial clip-path onto mask layer.
MozReview-Commit-ID: G2ghy7qGf5N
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -7122,23 +7122,22 @@ bool nsDisplayMask::ShouldPaintOnMaskLay
{
if (!aManager->IsCompositingCheap()) {
return false;
}
nsSVGUtils::MaskUsage maskUsage;
nsSVGUtils::DetermineMaskUsage(mFrame, mHandleOpacity, maskUsage);
- if (!maskUsage.shouldGenerateMaskLayer &&
+ if (!maskUsage.shouldGenerateMaskLayer && !maskUsage.shouldApplyClipPath &&
!maskUsage.shouldGenerateClipMaskLayer) {
return false;
}
- if (maskUsage.opacity != 1.0 || maskUsage.shouldApplyClipPath ||
- maskUsage.shouldApplyBasicShape) {
+ if (maskUsage.opacity != 1.0 || maskUsage.shouldApplyBasicShape) {
return false;
}
if (!nsSVGIntegrationUtils::IsMaskResourceReady(mFrame)) {
return false;
}
// XXX temporary disable drawing SVG mask onto mask layer before bug 1313877
--- a/layout/svg/nsSVGClipPathFrame.cpp
+++ b/layout/svg/nsSVGClipPathFrame.cpp
@@ -85,18 +85,16 @@ already_AddRefed<SourceSurface>
nsSVGClipPathFrame::GetClipMask(gfxContext& aReferenceContext,
nsIFrame* aClippedFrame,
const gfxMatrix& aMatrix,
Matrix* aMaskTransform,
SourceSurface* aExtraMask,
const Matrix& aExtraMasksTransform,
DrawResult* aResult)
{
- MOZ_ASSERT(!IsTrivial(), "Caller needs to use ApplyClipPath");
-
if (aResult) {
*aResult = DrawResult::SUCCESS;
}
DrawTarget& aReferenceDT = *aReferenceContext.GetDrawTarget();
// A clipPath can reference another clipPath. We re-enter this method for
// each clipPath in a reference chain, so here we limit chain length:
static int16_t sRefChainLengthCounter = AutoReferenceLimiter::notReferencing;
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -699,16 +699,17 @@ nsSVGIntegrationUtils::IsMaskResourceRea
DrawResult
nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams)
{
nsSVGUtils::MaskUsage maskUsage;
nsSVGUtils::DetermineMaskUsage(aParams.frame, aParams.handleOpacity,
maskUsage);
MOZ_ASSERT(maskUsage.shouldGenerateMaskLayer ||
+ maskUsage.shouldApplyClipPath ||
maskUsage.shouldGenerateClipMaskLayer);
nsIFrame* frame = aParams.frame;
if (!ValidateSVGFrame(frame)) {
return DrawResult::SUCCESS;
}
if (maskUsage.opacity == 0.0f) {
@@ -740,17 +741,17 @@ nsSVGIntegrationUtils::PaintMask(const P
firstFrame->StyleContext(), maskFrames,
ctx.CurrentMatrix(), offsetToUserSpace);
if (result != DrawResult::SUCCESS) {
return result;
}
}
// Paint clip-path onto ctx.
- if (maskUsage.shouldGenerateClipMaskLayer) {
+ if (maskUsage.shouldGenerateClipMaskLayer || maskUsage.shouldApplyClipPath) {
matSR.Restore();
matSR.SetContext(&ctx);
SetupContextMatrix(firstFrame, aParams, offsetToBoundingBox,
offsetToUserSpace, false);
Matrix clipMaskTransform;
gfxMatrix cssPxToDevPxMatrix = GetCSSPxToDevPxMatrix(frame);