Bug 1300401 - Part 2. Add more comments and assertions. r=mstange
authorcku <cku@mozilla.com>
Mon, 05 Sep 2016 12:46:56 +0800
changeset 312958 39371a6c096b77c23523c1e3024031bfc74acf02
parent 312957 42dac4c946cbd89a269da27535fdce9c841dfa1c
child 312959 d5bcb00423c6b393b2fe993562477373d3b7c36a
push id30665
push usercbook@mozilla.com
push dateWed, 07 Sep 2016 15:20:43 +0000
treeherdermozilla-central@95acb9299faf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1300401
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1300401 - Part 2. Add more comments and assertions. r=mstange MozReview-Commit-ID: HywA9IrGhk2
layout/generic/nsFrame.cpp
layout/svg/nsSVGIntegrationUtils.cpp
--- 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;
   }