From 25d77442261af96da11e2856d321453fcbb11b1a Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Sat, 17 Dec 2016 21:57:26 -0500 Subject: [PATCH 1/3] Backed out changeset 03090e5ca9b9 (bug 1318418) --- layout/svg/nsSVGIntegrationUtils.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/layout/svg/nsSVGIntegrationUtils.cpp b/layout/svg/nsSVGIntegrationUtils.cpp index 9f284c45846d..89141f7ecbad 100644 --- a/layout/svg/nsSVGIntegrationUtils.cpp +++ b/layout/svg/nsSVGIntegrationUtils.cpp @@ -775,19 +775,7 @@ nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams) nsPoint offsetToBoundingBox; nsPoint offsetToUserSpace; gfxContextMatrixAutoSaveRestore matSR; - RefPtr maskTarget = ctx.GetDrawTarget(); - - if (maskUsage.shouldGenerateMaskLayer && - maskUsage.shouldGenerateClipMaskLayer) { - // We will paint both mask of positioned mask and clip-path into - // maskTarget. - // - // Create one extra draw target for drawing positioned mask, so that we do - // not have to copy the content of maskTarget before painting - // clip-path into it. - maskTarget = maskTarget->CreateSimilarDrawTarget(maskTarget->GetSize(), - SurfaceFormat::A8); - } + DrawTarget* target = ctx.GetDrawTarget(); if (maskUsage.shouldApplyBasicShape) { matSR.SetContext(&ctx); @@ -818,7 +806,7 @@ nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams) // XXX Bug 1323912. MOZ_ASSERT(maskUsage.opacity == 1.0, "nsSVGIntegrationUtils::PaintMask can not handle opacity now."); - result = PaintMaskSurface(aParams, maskTarget, 1.0, + result = PaintMaskSurface(aParams, target, 1.0, firstFrame->StyleContext(), maskFrames, ctx.CurrentMatrix(), offsetToUserSpace); if (result != DrawResult::SUCCESS) { @@ -848,7 +836,7 @@ nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams) nsSVGClipPathFrame *clipPathFrame = effectProperties.GetClipPathFrame(); RefPtr maskSurface = - maskUsage.shouldGenerateMaskLayer ? maskTarget->Snapshot() : nullptr; + maskUsage.shouldGenerateMaskLayer ? target->Snapshot() : nullptr; result = clipPathFrame->PaintClipMask(ctx, frame, cssPxToDevPxMatrix, &clipMaskTransform, maskSurface, From ae624d4fc97e79b869e316760d10ef99c7b7b0fb Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Sat, 17 Dec 2016 21:58:03 -0500 Subject: [PATCH 2/3] Backed out 2 changesets (bug 1313276) Backed out changeset e505479a60e5 (bug 1313276) Backed out changeset efb9edd878f0 (bug 1313276) --- layout/painting/nsDisplayList.cpp | 9 ++++--- layout/svg/nsSVGIntegrationUtils.cpp | 39 +++++----------------------- 2 files changed, 12 insertions(+), 36 deletions(-) diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 48efc80f72bf..df8cd87ad157 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -7353,9 +7353,12 @@ bool nsDisplayMask::ShouldPaintOnMaskLayer(LayerManager* aManager) nsSVGUtils::MaskUsage maskUsage; nsSVGUtils::DetermineMaskUsage(mFrame, mHandleOpacity, maskUsage); - // XXX Bug 1323912. nsSVGIntegrationUtils::PaintMask can not handle opacity - // correctly. Turn it off before bug fixed. - if (maskUsage.opacity != 1.0) { + if (!maskUsage.shouldGenerateMaskLayer && !maskUsage.shouldApplyClipPath && + !maskUsage.shouldGenerateClipMaskLayer) { + return false; + } + + if (maskUsage.opacity != 1.0 || maskUsage.shouldApplyBasicShape) { return false; } diff --git a/layout/svg/nsSVGIntegrationUtils.cpp b/layout/svg/nsSVGIntegrationUtils.cpp index 89141f7ecbad..29c79557cc89 100644 --- a/layout/svg/nsSVGIntegrationUtils.cpp +++ b/layout/svg/nsSVGIntegrationUtils.cpp @@ -755,6 +755,9 @@ 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)) { @@ -777,52 +780,23 @@ nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams) gfxContextMatrixAutoSaveRestore matSR; DrawTarget* target = ctx.GetDrawTarget(); - if (maskUsage.shouldApplyBasicShape) { - matSR.SetContext(&ctx); - - SetupContextMatrix(firstFrame, aParams, offsetToBoundingBox, - offsetToUserSpace, false); - - nsCSSClipPathInstance::ApplyBasicShapeClip(ctx, frame); - if (!maskUsage.shouldGenerateMaskLayer) { - // Only have basic-shape clip-path effect. Fill clipped region by - // opaque white. - ctx.SetColor(Color(0.0, 0.0, 0.0, 1.0)); - ctx.Fill(); - ctx.PopClip(); - - return result; - } - } - // Paint mask onto ctx. if (maskUsage.shouldGenerateMaskLayer) { - matSR.Restore(); matSR.SetContext(&ctx); SetupContextMatrix(frame, aParams, offsetToBoundingBox, offsetToUserSpace, false); nsTArray maskFrames = effectProperties.GetMaskFrames(); - // XXX Bug 1323912. - MOZ_ASSERT(maskUsage.opacity == 1.0, - "nsSVGIntegrationUtils::PaintMask can not handle opacity now."); - result = PaintMaskSurface(aParams, target, 1.0, + bool opacityApplied = !HasNonSVGMask(maskFrames); + result = PaintMaskSurface(aParams, target, + opacityApplied ? maskUsage.opacity : 1.0, firstFrame->StyleContext(), maskFrames, ctx.CurrentMatrix(), offsetToUserSpace); if (result != DrawResult::SUCCESS) { - if (maskUsage.shouldApplyBasicShape) { - ctx.PopClip(); - } - return result; } } - if (maskUsage.shouldApplyBasicShape) { - ctx.PopClip(); - return result; - } - // Paint clip-path onto ctx. if (maskUsage.shouldGenerateClipMaskLayer || maskUsage.shouldApplyClipPath) { matSR.Restore(); @@ -830,7 +804,6 @@ nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams) SetupContextMatrix(firstFrame, aParams, offsetToBoundingBox, offsetToUserSpace, false); - Matrix clipMaskTransform; gfxMatrix cssPxToDevPxMatrix = GetCSSPxToDevPxMatrix(frame); From f31546de18c7fd158b5d1029162ef8bb62873bdd Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Sat, 17 Dec 2016 21:59:10 -0500 Subject: [PATCH 3/3] Backed out 2 changesets (bug 1318266) for breaking tab drawing when a LWT is applied. Backed out changeset 00bb4e2f5a3c (bug 1318266) Backed out changeset 55790893cab4 (bug 1318266) --- layout/painting/FrameLayerBuilder.cpp | 7 ------- layout/painting/nsDisplayList.cpp | 5 +++-- layout/svg/nsSVGClipPathFrame.cpp | 2 ++ layout/svg/nsSVGIntegrationUtils.cpp | 3 +-- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/layout/painting/FrameLayerBuilder.cpp b/layout/painting/FrameLayerBuilder.cpp index b5ac9a4ae0c9..44c8464c8b08 100644 --- a/layout/painting/FrameLayerBuilder.cpp +++ b/layout/painting/FrameLayerBuilder.cpp @@ -4340,13 +4340,6 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList) } else if (item->GetType() == nsDisplayItem::TYPE_MASK) { nsDisplayMask* maskItem = static_cast(item); SetupMaskLayerForCSSMask(ownLayer, maskItem); - - nsDisplayItem* next = aList->GetBottom(); - if (next && next->GetType() == nsDisplayItem::TYPE_SCROLL_INFO_LAYER) { - // Since we do build a layer for mask, there is no need for this - // scroll info layer anymore. - aList->RemoveBottom(); - } } // Convert the visible rect to a region and give the item diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index df8cd87ad157..74a8ded802f4 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -7353,12 +7353,13 @@ bool nsDisplayMask::ShouldPaintOnMaskLayer(LayerManager* aManager) nsSVGUtils::MaskUsage maskUsage; nsSVGUtils::DetermineMaskUsage(mFrame, mHandleOpacity, maskUsage); - if (!maskUsage.shouldGenerateMaskLayer && !maskUsage.shouldApplyClipPath && + if (!maskUsage.shouldGenerateMaskLayer && !maskUsage.shouldGenerateClipMaskLayer) { return false; } - if (maskUsage.opacity != 1.0 || maskUsage.shouldApplyBasicShape) { + if (maskUsage.opacity != 1.0 || maskUsage.shouldApplyClipPath || + maskUsage.shouldApplyBasicShape) { return false; } diff --git a/layout/svg/nsSVGClipPathFrame.cpp b/layout/svg/nsSVGClipPathFrame.cpp index 5ec1fca34139..d07c90ae8082 100644 --- a/layout/svg/nsSVGClipPathFrame.cpp +++ b/layout/svg/nsSVGClipPathFrame.cpp @@ -272,6 +272,8 @@ nsSVGClipPathFrame::GetClipMask(gfxContext& aReferenceContext, SourceSurface* aExtraMask, const Matrix& aExtraMasksTransform) { + MOZ_ASSERT(!IsTrivial(), "Caller needs to use ApplyClipPath"); + IntPoint offset; RefPtr maskDT = CreateClipMask(aReferenceContext, offset); if (!maskDT) { diff --git a/layout/svg/nsSVGIntegrationUtils.cpp b/layout/svg/nsSVGIntegrationUtils.cpp index 29c79557cc89..7d6f1f517cc8 100644 --- a/layout/svg/nsSVGIntegrationUtils.cpp +++ b/layout/svg/nsSVGIntegrationUtils.cpp @@ -756,7 +756,6 @@ nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams) nsSVGUtils::DetermineMaskUsage(aParams.frame, aParams.handleOpacity, maskUsage); MOZ_ASSERT(maskUsage.shouldGenerateMaskLayer || - maskUsage.shouldApplyClipPath || maskUsage.shouldGenerateClipMaskLayer); nsIFrame* frame = aParams.frame; @@ -798,7 +797,7 @@ nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams) } // Paint clip-path onto ctx. - if (maskUsage.shouldGenerateClipMaskLayer || maskUsage.shouldApplyClipPath) { + if (maskUsage.shouldGenerateClipMaskLayer) { matSR.Restore(); matSR.SetContext(&ctx);