Bug 824300 - Part 1. Correct assert condition and promote NS_ASSERTION to MOZ_ASSERT draft
authorcku <cku@mozilla.com>
Sat, 04 Feb 2017 20:43:08 +0800
changeset 485160 1dc29684b2919398666df602744f434d6ee922ca
parent 485100 52660ce91463b958fea87be652a3cecf0387008d
child 485161 71af0d7485d82762f2e2a0b02e51bbf9bf6f9d2b
child 485165 1d66ff850d312c04075354fda1d970a7347b0622
push id45656
push usercku@mozilla.com
push dateThu, 16 Feb 2017 08:11:23 +0000
bugs824300
milestone54.0a1
Bug 824300 - Part 1. Correct assert condition and promote NS_ASSERTION to MOZ_ASSERT 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;