Bug 824300 - Part 1. Correct assert condition and promote NS_ASSERTION to MOZ_ASSERT r=heycam
authorcku <cku@mozilla.com>
Sat, 04 Feb 2017 20:43:08 +0800
changeset 485442 7ff2deda019f67d97e1ff062f41809493922c95c
parent 485441 32c6b4f77110e43b1fe74cb1f81d09c3aad6ffad
child 485443 fb2b5dae66c753aa27bf1543be813360a6f60769
push id45733
push useraklotz@mozilla.com
push dateThu, 16 Feb 2017 17:45:58 +0000
reviewersheycam
bugs824300
milestone54.0a1
Bug 824300 - Part 1. Correct assert condition and promote NS_ASSERTION to MOZ_ASSERT r=heycam MozReview-Commit-ID: 1FHD2xhQ3x4
layout/svg/nsSVGIntegrationUtils.cpp
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -129,20 +129,28 @@ private:
       bool mightHaveNoneSVGMask =
         nsSVGEffects::GetEffectProperties(firstFrame).MightHaveNoneSVGMask();
 
       MOZ_ASSERT(mightHaveNoneSVGMask ||
                  aFrame->GetParent()->StyleContext()->GetPseudo() ==
                  nsCSSAnonBoxes::mozAnonymousBlock,
                  "How did we getting here, then?");
     }
+
+    bool hasEffect = nsSVGIntegrationUtils::UsingEffectsForFrame(aFrame);
+    nsOverflowAreas* preTransformOverflows =
+      aFrame->Properties().Get(aFrame->PreTransformOverflowAreasProperty());
+    // Having PreTransformOverflowAreasProperty means GetVisualOverflowRect()
+    // will return post-effect rect, which is not what we want, this function
+    // intentional reports pre-effect rect. But it does not matter if there is
+    // no SVG effect on this frame, since no effect means post-effect rect
+    // matches pre-effect rect.
+    MOZ_ASSERT(!hasEffect || !preTransformOverflows,
+               "GetVisualOverflowRect() won't return the pre-effects rect!");
 #endif
-    NS_ASSERTION(!aFrame->Properties().Get(
-                   aFrame->PreTransformOverflowAreasProperty()),
-                 "GetVisualOverflowRect() won't return the pre-effects rect!");
     return aFrame->GetVisualOverflowRect();
   }
 
   nsIFrame*     mFirstContinuation;
   nsIFrame*     mCurrentFrame;
   const nsRect& mCurrentFrameOverflowArea;
   nsRect        mResult;
   bool          mCheckPreEffectsBBoxPropCache;