Bug 1300401 - Part 2. Add more comments and assertions.
MozReview-Commit-ID: HywA9IrGhk2
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -2437,17 +2437,18 @@ nsIFrame::BuildDisplayListForStackingCon
/* If there are any SVG effects, wrap the list up in an SVG effects item
* (which also handles CSS group opacity). Note that we create an SVG effects
* item even if resultList is empty, since a filter can produce graphical
* output even if the element being filtered wouldn't otherwise do so.
*/
if (usingSVGEffects) {
MOZ_ASSERT(StyleEffects()->HasFilters() ||
- nsSVGIntegrationUtils::UsingMaskOrClipPathForFrame(this));
+ nsSVGIntegrationUtils::UsingMaskOrClipPathForFrame(this),
+ "Beside filter & mask/clip-path, what else effect do we have?");
if (clipCapturedBy == ContainerItemType::eSVGEffects) {
clipState.ExitStackingContextContents(&containerItemScrollClip);
}
// Revert to the post-filter dirty rect.
buildingDisplayList.SetDirtyRect(dirtyRectOutsideSVGEffects);
// Skip all filter effects while generating glyph mask.
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -747,16 +747,20 @@ BlendToTarget(const nsSVGIntegrationUtil
RefPtr<gfxPattern> pattern = new gfxPattern(targetSurf, Matrix::Translation(aTargetOffset.x, aTargetOffset.y));
context.SetPattern(pattern);
context.Paint();
}
DrawResult
nsSVGIntegrationUtils::PaintMaskAndClipPath(const PaintFramesParams& aParams)
{
+ MOZ_ASSERT(UsingMaskOrClipPathForFrame(aParams.frame),
+ "Should not use this method when no mask or clipPath effect"
+ "on this frame");
+
/* SVG defines the following rendering model:
*
* 1. Render geometry
* 2. Apply filter
* 3. Apply clipping, masking, group opacity
*
* We handle #3 here and perform a couple of optimizations:
*
@@ -915,17 +919,20 @@ nsSVGIntegrationUtils::PaintMaskAndClipP
}
return result;
}
DrawResult
nsSVGIntegrationUtils::PaintFilter(const PaintFramesParams& aParams)
{
- MOZ_ASSERT(!aParams.builder->IsForGenerateGlyphMask());
+ MOZ_ASSERT(!aParams.builder->IsForGenerateGlyphMask(),
+ "Filter effect is discarded while generating glyph mask.");
+ MOZ_ASSERT(aParams.frame->StyleEffects()->HasFilters(),
+ "Should not use this method when no filter effect on this frame");
nsIFrame* frame = aParams.frame;
DrawResult result = DrawResult::SUCCESS;
bool hasSVGLayout = (frame->GetStateBits() & NS_FRAME_SVG_LAYOUT);
if (!ValidateSVGFrame(aParams, hasSVGLayout, &result)) {
return result;
}