Bug 1114398 - Part 2: Test whether the path backend matches the DrawTarget backend for the SVG path cache. r=jwatt
--- a/dom/svg/nsSVGPathGeometryElement.cpp
+++ b/dom/svg/nsSVGPathGeometryElement.cpp
@@ -82,17 +82,19 @@ nsSVGPathGeometryElement::GetOrBuildPath
bool cacheable = aDrawTarget.GetBackendType() ==
gfxPlatform::GetPlatform()->GetContentBackend();
// 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) {
- return mCachedPath;
+ if (aDrawTarget.GetBackendType() == mCachedPath->GetBackendType()) {
+ return mCachedPath;
+ }
}
RefPtr<PathBuilder> builder = aDrawTarget.CreatePathBuilder(aFillRule);
RefPtr<Path> path = BuildPath(builder);
if (cacheable && NS_SVGPathCachingEnabled()) {
mCachedPath = path;
}
return path.forget();
}