Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1581)

Unified Diff: Source/core/rendering/svg/RenderSVGResource.cpp

Issue 577283003: Simplify fallback-handling for SVG_PAINTTYPE_URI_* (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/svg/custom/fill-fallback-none-3-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/svg/RenderSVGResource.cpp
diff --git a/Source/core/rendering/svg/RenderSVGResource.cpp b/Source/core/rendering/svg/RenderSVGResource.cpp
index abbbede9694e7d0c18c726253397d22a67112410..fb7d25932527025f895d0385d5dd5c1acc070db0 100644
--- a/Source/core/rendering/svg/RenderSVGResource.cpp
+++ b/Source/core/rendering/svg/RenderSVGResource.cpp
@@ -115,19 +115,17 @@ RenderSVGResource* RenderSVGResource::requestPaintingResource(RenderSVGResourceM
return colorResource;
}
- // If no resources are associated with the given renderer, return the color resource.
- SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object);
- if (!resources) {
- if (paintType == SVG_PAINTTYPE_URI_NONE || (!hasColor && !inheritColorFromParentStyle(object, applyToFill, color)))
- return 0;
-
- colorResource->setColor(color);
- return colorResource;
- }
+ RenderSVGResource* uriResource = 0;
+ if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object))
+ uriResource = applyToFill ? resources->fill() : resources->stroke();
- // If the requested resource is not available, return the color resource.
- RenderSVGResource* uriResource = mode == ApplyToFillMode ? resources->fill() : resources->stroke();
+ // If the requested resource is not available, return the color resource or 'none'.
if (!uriResource) {
+ // The fallback is 'none'.
+ if (paintType == SVG_PAINTTYPE_URI_NONE)
+ return 0;
+ // If there's no fallback color, attempt to use the the parents paint
+ // server if it's a simple <color>.
if (!hasColor && !inheritColorFromParentStyle(object, applyToFill, color))
return 0;
« no previous file with comments | « LayoutTests/svg/custom/fill-fallback-none-3-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698