Bug 1556147 - SVGImageElement::BuildPath should never be called r=longsonr
authorviolet <violet.bugreport@gmail.com>
Sat, 01 Jun 2019 16:06:33 +0000
changeset 536355 8d1253667f3ab95eff3ef08b614a4cac1e9bf3cc
parent 536354 0e949672e35e323b850d9943aaad320f3ed29b3a
child 536356 24e136f2746970b4179a7ebc9d14a1d0089f36a3
push id11522
push userffxbld-merge
push dateMon, 01 Jul 2019 09:00:55 +0000
treeherdermozilla-beta@53ea74d2bd09 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslongsonr
bugs1556147
milestone69.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 1556147 - SVGImageElement::BuildPath should never be called r=longsonr SVGImageElement isn't really a SVGGeometryElement, we did that just for better code sharing. BuildPath() won't be called for <image>. Differential Revision: https://phabricator.services.mozilla.com/D33400
dom/svg/SVGImageElement.cpp
--- a/dom/svg/SVGImageElement.cpp
+++ b/dom/svg/SVGImageElement.cpp
@@ -259,36 +259,21 @@ bool SVGImageElement::GetGeometryBounds(
     rect.SetEmpty();  // Make sure width/height are zero and not negative
   }
 
   *aBounds = aToBoundsSpace.TransformBounds(rect);
   return true;
 }
 
 already_AddRefed<Path> SVGImageElement::BuildPath(PathBuilder* aBuilder) {
-  // We get called in order to get bounds for this element, and for
-  // hit-testing against it. For that we just pretend to be a rectangle.
-
-  float x, y, width, height;
-  SVGGeometryProperty::ResolveAllAllowFallback<SVGT::X, SVGT::Y, SVGT::Width,
-                                               SVGT::Height>(this, &x, &y,
-                                                             &width, &height);
-
-  if (width <= 0 || height <= 0) {
-    return nullptr;
-  }
-
-  Rect r(x, y, width, height);
-  aBuilder->MoveTo(r.TopLeft());
-  aBuilder->LineTo(r.TopRight());
-  aBuilder->LineTo(r.BottomRight());
-  aBuilder->LineTo(r.BottomLeft());
-  aBuilder->Close();
-
-  return aBuilder->Finish();
+  // To get bound, the faster method GetGeometryBounds() should already return
+  // success. For render and hittest, nsSVGImageFrame should have its own
+  // implementation that doesn't need to build path for an image.
+  MOZ_CRASH("There is no reason to call BuildPath for SVGImageElement");
+  return nullptr;
 }
 
 //----------------------------------------------------------------------
 // SVGElement methods
 
 /* virtual */
 bool SVGImageElement::HasValidDimensions() const {
   float width, height;