Bug 1382534 - Only reuse the cached path in SVGGeometryElement::GetOrBuildPath() if it has the fill rule we want. r=longsonr draft
authorBotond Ballo <botond@mozilla.com>
Mon, 25 Sep 2017 16:58:19 -0400
changeset 690307 7a585b57308eeefe00c2cb5c334bcfa39f11ab93
parent 690306 68690f54ea5129863dc5cfb3f4095c22e41409ad
child 690308 b4e868a89408e31aef1f26c3f701e1fb2daa2477
push id87277
push userbballo@mozilla.com
push dateWed, 01 Nov 2017 21:17:50 +0000
reviewerslongsonr
bugs1382534
milestone58.0a1
Bug 1382534 - Only reuse the cached path in SVGGeometryElement::GetOrBuildPath() if it has the fill rule we want. r=longsonr MozReview-Commit-ID: 7G99pnifbTv
dom/svg/SVGGeometryElement.cpp
--- a/dom/svg/SVGGeometryElement.cpp
+++ b/dom/svg/SVGGeometryElement.cpp
@@ -101,21 +101,20 @@ SVGGeometryElement::GetOrBuildPath(const
   // We only cache the path if it matches the backend used for screen painting:
   bool cacheable  = aDrawTarget.GetBackendType() ==
                     gfxPlatform::GetPlatform()->GetDefaultContentBackend();
 
   // Checking for and returning mCachedPath before checking the pref means
   // that the pref is only live on page reload (or app restart for SVG in
   // chrome). The benefit is that we avoid causing a CPU memory cache miss by
   // looking at the global variable that the pref's stored in.
-  if (cacheable && mCachedPath) {
-    if (aDrawTarget.GetBackendType() == mCachedPath->GetBackendType()) {
-      RefPtr<Path> path(mCachedPath);
-      return path.forget();
-    }
+  if (cacheable && mCachedPath && mCachedPath->GetFillRule() == aFillRule &&
+      aDrawTarget.GetBackendType() == mCachedPath->GetBackendType()) {
+    RefPtr<Path> path(mCachedPath);
+    return path.forget();
   }
   RefPtr<PathBuilder> builder = aDrawTarget.CreatePathBuilder(aFillRule);
   RefPtr<Path> path = BuildPath(builder);
   if (cacheable && NS_SVGPathCachingEnabled()) {
     mCachedPath = path;
   }
   return path.forget();
 }