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

Side by Side Diff: Source/core/rendering/svg/RenderSVGResource.cpp

Issue 574373004: Drop redundant checks for a color when the primary resource is a color (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (visitedPaintType < SVG_PAINTTYPE_URI_NONE && visitedPaintType != SVG _PAINTTYPE_CURRENTCOLOR) { 102 if (visitedPaintType < SVG_PAINTTYPE_URI_NONE && visitedPaintType != SVG _PAINTTYPE_CURRENTCOLOR) {
103 const Color& visitedColor = applyToFill ? svgStyle.visitedLinkFillPa intColor() : svgStyle.visitedLinkStrokePaintColor(); 103 const Color& visitedColor = applyToFill ? svgStyle.visitedLinkFillPa intColor() : svgStyle.visitedLinkStrokePaintColor();
104 color = Color(visitedColor.red(), visitedColor.green(), visitedColor .blue(), color.alpha()); 104 color = Color(visitedColor.red(), visitedColor.green(), visitedColor .blue(), color.alpha());
105 hasColor = true; 105 hasColor = true;
106 } 106 }
107 } 107 }
108 108
109 // If the primary resource is just a color, return immediately. 109 // If the primary resource is just a color, return immediately.
110 RenderSVGResourceSolidColor* colorResource = RenderSVGResource::sharedSolidP aintingResource(); 110 RenderSVGResourceSolidColor* colorResource = RenderSVGResource::sharedSolidP aintingResource();
111 if (paintType < SVG_PAINTTYPE_URI_NONE) { 111 if (paintType < SVG_PAINTTYPE_URI_NONE) {
112 if (!hasColor && !inheritColorFromParentStyle(object, applyToFill, color )) 112 // |paintType| will be either <current-color> or <rgb-color> here - both of which will have a color.
113 return 0; 113 ASSERT(hasColor);
114
115 colorResource->setColor(color); 114 colorResource->setColor(color);
116 return colorResource; 115 return colorResource;
117 } 116 }
118 117
119 // If no resources are associated with the given renderer, return the color resource. 118 // If no resources are associated with the given renderer, return the color resource.
120 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject( object); 119 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject( object);
121 if (!resources) { 120 if (!resources) {
122 if (paintType == SVG_PAINTTYPE_URI_NONE || (!hasColor && !inheritColorFr omParentStyle(object, applyToFill, color))) 121 if (paintType == SVG_PAINTTYPE_URI_NONE || (!hasColor && !inheritColorFr omParentStyle(object, applyToFill, color)))
123 return 0; 122 return 0;
124 123
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // This will process the rest of the ancestors. 212 // This will process the rest of the ancestors.
214 toRenderSVGResourceContainer(current)->removeAllClientsFromCache(); 213 toRenderSVGResourceContainer(current)->removeAllClientsFromCache();
215 break; 214 break;
216 } 215 }
217 216
218 current = current->parent(); 217 current = current->parent();
219 } 218 }
220 } 219 }
221 220
222 } 221 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698