Bug 1049256, part 2 - Get rid of nsISVGChildFrame::FOR_HIT_TESTING. r=longsonr
authorJonathan Watt <jwatt@jwatt.org>
Thu, 07 Aug 2014 08:09:34 +0100
changeset 198289 f8518bbdd3f00956fbace15741dcfee986ecfb5d
parent 198288 5f0ee96a8e125b3a2bd03662bd1b79f5dcc33dd7
child 198290 7ab18eda31e43988b49ed9320ca6e1637a57c975
push id27265
push useremorley@mozilla.com
push dateThu, 07 Aug 2014 12:49:34 +0000
treeherdermozilla-central@bf5cbb36f4d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslongsonr
bugs1049256
milestone34.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 1049256, part 2 - Get rid of nsISVGChildFrame::FOR_HIT_TESTING. r=longsonr
layout/svg/SVGTextFrame.cpp
layout/svg/nsISVGChildFrame.h
layout/svg/nsSVGAFrame.cpp
layout/svg/nsSVGForeignObjectFrame.cpp
layout/svg/nsSVGGFrame.cpp
layout/svg/nsSVGGenericContainerFrame.cpp
layout/svg/nsSVGInnerSVGFrame.cpp
layout/svg/nsSVGOuterSVGFrame.cpp
layout/svg/nsSVGPathGeometryFrame.cpp
layout/svg/nsSVGUtils.cpp
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -3427,18 +3427,21 @@ SVGTextFrame::FindCloserFrameForSelectio
     uint32_t flags = TextRenderedRun::eIncludeFill |
                      TextRenderedRun::eIncludeStroke |
                      TextRenderedRun::eNoHorizontalOverflow;
     SVGBBox userRect = run.GetUserSpaceRect(presContext, flags);
     float devPxPerCSSPx = presContext->CSSPixelsToDevPixels(1.f);
     userRect.Scale(devPxPerCSSPx);
 
     if (!userRect.IsEmpty()) {
-      nsRect rect = nsSVGUtils::ToCanvasBounds(userRect.ToThebesRect(),
-                                               GetCanvasTM(FOR_HIT_TESTING),
+      gfxMatrix m;
+      if (!NS_SVGDisplayListHitTestingEnabled()) {
+        m = GetCanvasTM(FOR_OUTERSVG_TM);
+      }
+      nsRect rect = nsSVGUtils::ToCanvasBounds(userRect.ToThebesRect(), m,
                                                presContext);
 
       if (nsLayoutUtils::PointIsCloserToRect(aPoint, rect,
                                              aCurrentBestFrame->mXDistance,
                                              aCurrentBestFrame->mYDistance)) {
         aCurrentBestFrame->mFrame = run.mFrame;
       }
     }
@@ -3888,19 +3891,16 @@ SVGTextFrame::GetBBoxContribution(const 
 gfxMatrix
 SVGTextFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
 {
   if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY) &&
       !aTransformRoot) {
     if (aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) {
       return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this);
     }
-    if (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled()) {
-      return gfxMatrix();
-    }
   }
   if (!mCanvasTM) {
     NS_ASSERTION(GetParent(), "null parent");
     NS_ASSERTION(!(aFor == FOR_OUTERSVG_TM &&
                    (GetStateBits() & NS_FRAME_IS_NONDISPLAY)),
                  "should not call GetCanvasTM(FOR_OUTERSVG_TM) when we are "
                  "non-display");
 
--- a/layout/svg/nsISVGChildFrame.h
+++ b/layout/svg/nsISVGChildFrame.h
@@ -83,17 +83,16 @@ public:
   /**
    * Flags used to specify to GetCanvasTM what it's being called for so that it
    * knows how far up the tree the "canvas" is. When display lists are being
    * used for painting or hit-testing of SVG, the "canvas" is simply user
    * space.
    */
   enum RequestingCanvasTMFor {
     FOR_PAINTING = 1,
-    FOR_HIT_TESTING,
     FOR_OUTERSVG_TM
   };
 
   // Flags to pass to NotifySVGChange:
   //
   // DO_NOT_NOTIFY_RENDERING_OBSERVERS - this should only be used when
   //                           updating the descendant frames of a clipPath,
   //                           mask, pattern or marker frame (or other similar
--- a/layout/svg/nsSVGAFrame.cpp
+++ b/layout/svg/nsSVGAFrame.cpp
@@ -133,19 +133,16 @@ nsSVGAFrame::NotifySVGChanged(uint32_t a
 
 gfxMatrix
 nsSVGAFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
 {
   if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY) && !aTransformRoot) {
     if (aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) {
       return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this);
     }
-    if (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled()) {
-      return gfxMatrix();
-    }
   }
   if (!mCanvasTM) {
     NS_ASSERTION(GetParent(), "null parent");
 
     nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(GetParent());
     dom::SVGAElement *content = static_cast<dom::SVGAElement*>(mContent);
 
     gfxMatrix tm = content->PrependLocalTransformsTo(
--- a/layout/svg/nsSVGForeignObjectFrame.cpp
+++ b/layout/svg/nsSVGForeignObjectFrame.cpp
@@ -482,19 +482,16 @@ nsSVGForeignObjectFrame::GetBBoxContribu
 
 gfxMatrix
 nsSVGForeignObjectFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
 {
   if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY) && !aTransformRoot) {
     if (aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) {
       return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this);
     }
-    if (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled()) {
-      return gfxMatrix();
-    }
   }
   if (!mCanvasTM) {
     NS_ASSERTION(GetParent(), "null parent");
 
     nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(GetParent());
     SVGForeignObjectElement *content =
       static_cast<SVGForeignObjectElement*>(mContent);
 
--- a/layout/svg/nsSVGGFrame.cpp
+++ b/layout/svg/nsSVGGFrame.cpp
@@ -66,19 +66,16 @@ nsSVGGFrame::NotifySVGChanged(uint32_t a
 
 gfxMatrix
 nsSVGGFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
 {
   if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY) && !aTransformRoot) {
     if (aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) {
       return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this);
     }
-    if (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled()) {
-      return gfxMatrix();
-    }
   }
   if (!mCanvasTM) {
     NS_ASSERTION(GetParent(), "null parent");
 
     nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(GetParent());
     SVGGraphicsElement *content = static_cast<SVGGraphicsElement*>(mContent);
     gfxMatrix tm = content->PrependLocalTransformsTo(
         this == aTransformRoot ? gfxMatrix() :
--- a/layout/svg/nsSVGGenericContainerFrame.cpp
+++ b/layout/svg/nsSVGGenericContainerFrame.cpp
@@ -48,18 +48,15 @@ nsSVGGenericContainerFrame::GetType() co
 gfxMatrix
 nsSVGGenericContainerFrame::GetCanvasTM(uint32_t aFor,
                                         nsIFrame* aTransformRoot)
 {
   if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY) && !aTransformRoot) {
     if (aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) {
       return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this);
     }
-    if (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled()) {
-      return gfxMatrix();
-    }
   }
 
   NS_ASSERTION(GetParent(), "null parent");
   
   return static_cast<nsSVGContainerFrame*>(GetParent())->
       GetCanvasTM(aFor, aTransformRoot);
 }
--- a/layout/svg/nsSVGInnerSVGFrame.cpp
+++ b/layout/svg/nsSVGInnerSVGFrame.cpp
@@ -293,19 +293,16 @@ nsSVGInnerSVGFrame::NotifyViewportOrTran
 
 gfxMatrix
 nsSVGInnerSVGFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
 {
   if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY) && !aTransformRoot) {
     if (aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) {
       return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this);
     }
-    if (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled()) {
-      return gfxMatrix();
-    }
   }
   if (!mCanvasTM) {
     NS_ASSERTION(GetParent(), "null parent");
 
     nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(GetParent());
     SVGSVGElement *content = static_cast<SVGSVGElement*>(mContent);
 
     gfxMatrix tm = content->PrependLocalTransformsTo(
--- a/layout/svg/nsSVGOuterSVGFrame.cpp
+++ b/layout/svg/nsSVGOuterSVGFrame.cpp
@@ -826,19 +826,16 @@ nsSVGOuterSVGFrame::GetBBoxContribution(
 
 gfxMatrix
 nsSVGOuterSVGFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
 {
   if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY) && !aTransformRoot) {
     if (aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) {
       return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this);
     }
-    if (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled()) {
-      return gfxMatrix();
-    }
   }
   if (!mCanvasTM) {
     NS_ASSERTION(!aTransformRoot, "transform root will be ignored here");
     SVGSVGElement *content = static_cast<SVGSVGElement*>(mContent);
 
     float devPxPerCSSPx =
       1.0f / PresContext()->AppUnitsToFloatCSSPixels(
                                 PresContext()->AppUnitsPerDevPixel());
--- a/layout/svg/nsSVGPathGeometryFrame.cpp
+++ b/layout/svg/nsSVGPathGeometryFrame.cpp
@@ -547,19 +547,16 @@ nsSVGPathGeometryFrame::GetBBoxContribut
 
 gfxMatrix
 nsSVGPathGeometryFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
 {
   if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY) && !aTransformRoot) {
     if (aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) {
       return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this);
     }
-    if (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled()) {
-      return gfxMatrix();
-    }
   }
 
   NS_ASSERTION(GetParent(), "null parent");
 
   nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(GetParent());
   dom::SVGGraphicsElement *content = static_cast<dom::SVGGraphicsElement*>(mContent);
 
   return content->PrependLocalTransformsTo(
--- a/layout/svg/nsSVGUtils.cpp
+++ b/layout/svg/nsSVGUtils.cpp
@@ -367,33 +367,25 @@ nsSVGUtils::GetOuterSVGFrameAndCoveredRe
 
 gfxMatrix
 nsSVGUtils::GetCanvasTM(nsIFrame *aFrame, uint32_t aFor,
                         nsIFrame* aTransformRoot)
 {
   // XXX yuck, we really need a common interface for GetCanvasTM
 
   if (!aFrame->IsFrameOfType(nsIFrame::eSVG)) {
-    if (aFor == nsISVGChildFrame::FOR_HIT_TESTING &&
-        NS_SVGDisplayListHitTestingEnabled()) {
-      return gfxMatrix();
-    }
     return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(aFrame);
   }
 
   if (!(aFrame->GetStateBits() & NS_FRAME_IS_NONDISPLAY) &&
       !aTransformRoot) {
     if (aFor == nsISVGChildFrame::FOR_PAINTING &&
         NS_SVGDisplayListPaintingEnabled()) {
       return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(aFrame);
     }
-    if (aFor == nsISVGChildFrame::FOR_HIT_TESTING &&
-        NS_SVGDisplayListHitTestingEnabled()) {
-      return gfxMatrix();
-    }
   }
 
   nsIAtom* type = aFrame->GetType();
   if (type == nsGkAtoms::svgForeignObjectFrame) {
     return static_cast<nsSVGForeignObjectFrame*>(aFrame)->
         GetCanvasTM(aFor, aTransformRoot);
   }
   if (type == nsGkAtoms::svgOuterSVGFrame) {