Bug 1077745 - Get rid of the scaling hack and GetCanvasTM() call in nsSVGPathGeometryFrame::GetBBoxContribution. r=longsonr
authorJonathan Watt <jwatt@jwatt.org>
Sat, 04 Oct 2014 12:13:30 +0100
changeset 208823 09935501bd80cc258af02de422c05ec7ef1cbe20
parent 208822 3f971d859cfbc4be117cb47fee9fd69fd9f21dd9
child 208824 41bad654774b1ba60c91dfe0a5246f416c72fe68
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerslongsonr
bugs1077745
milestone35.0a1
Bug 1077745 - Get rid of the scaling hack and GetCanvasTM() call in nsSVGPathGeometryFrame::GetBBoxContribution. r=longsonr
layout/svg/nsSVGPathGeometryFrame.cpp
--- a/layout/svg/nsSVGPathGeometryFrame.cpp
+++ b/layout/svg/nsSVGPathGeometryFrame.cpp
@@ -353,37 +353,17 @@ nsSVGPathGeometryFrame::ReflowSVG()
   uint16_t hitTestFlags = GetHitTestFlags();
   if ((hitTestFlags & SVG_HIT_TEST_FILL)) {
    flags |= nsSVGUtils::eBBoxIncludeFillGeometry;
   }
   if ((hitTestFlags & SVG_HIT_TEST_STROKE)) {
    flags |= nsSVGUtils::eBBoxIncludeStrokeGeometry;
   }
  
-  // We'd like to just pass the identity matrix to GetBBoxContribution, but if
-  // this frame's user space size is _very_ large/small then the extents we
-  // obtain below might have overflowed or otherwise be broken. This would
-  // cause us to end up with a broken mRect and visual overflow rect and break
-  // painting of this frame. This is particularly noticeable if the transforms
-  // between us and our nsSVGOuterSVGFrame scale this frame to a reasonable
-  // size. To avoid this we sadly have to do extra work to account for the
-  // transforms between us and our nsSVGOuterSVGFrame, even though the
-  // overwhelming number of SVGs will never have this problem.
-  // XXX Will Azure eventually save us from having to do this?
-  gfxSize scaleFactors = GetCanvasTM().ScaleFactors(true);
-  bool applyScaling = fabs(scaleFactors.width) >= 1e-6 &&
-                      fabs(scaleFactors.height) >= 1e-6;
-  gfx::Matrix scaling;
-  if (applyScaling) {
-    scaling.PreScale(scaleFactors.width, scaleFactors.height);
-  }
-  gfxRect extent = GetBBoxContribution(scaling, flags).ToThebesRect();
-  if (applyScaling) {
-    extent.Scale(1 / scaleFactors.width, 1 / scaleFactors.height);
-  }
+  gfxRect extent = GetBBoxContribution(Matrix(), flags).ToThebesRect();
   mRect = nsLayoutUtils::RoundGfxRectToAppRect(extent,
             PresContext()->AppUnitsPerCSSPixel());
 
   if (mState & NS_FRAME_FIRST_REFLOW) {
     // Make sure we have our filter property (if any) before calling
     // FinishAndStoreOverflow (subsequent filter changes are handled off
     // nsChangeHint_UpdateEffects):
     nsSVGEffects::UpdateEffects(this);