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

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

Issue 108303009: Handle "url(...) none" and "url(...) currentColor" SVG paint specs (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added TC for 'none' fallback w/ failing url(...). Created 7 years 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
« no previous file with comments | « Source/core/css/SVGCSSParser.cpp ('k') | Source/core/svg/SVGPaint.h » ('j') | 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) Research In Motion Limited 2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 else if (element->hasTagName(SVGNames::linearGradientTag) || element->hasTag Name(SVGNames::radialGradientTag)) 145 else if (element->hasTagName(SVGNames::linearGradientTag) || element->hasTag Name(SVGNames::radialGradientTag))
146 target = toSVGGradientElement(element)->hrefCurrentValue(); 146 target = toSVGGradientElement(element)->hrefCurrentValue();
147 else if (element->hasTagName(SVGNames::filterTag)) 147 else if (element->hasTagName(SVGNames::filterTag))
148 target = toSVGFilterElement(element)->hrefCurrentValue(); 148 target = toSVGFilterElement(element)->hrefCurrentValue();
149 else 149 else
150 ASSERT_NOT_REACHED(); 150 ASSERT_NOT_REACHED();
151 151
152 return SVGURIReference::fragmentIdentifierFromIRIString(target, element->doc ument()); 152 return SVGURIReference::fragmentIdentifierFromIRIString(target, element->doc ument());
153 } 153 }
154 154
155 static inline bool svgPaintTypeHasURL(SVGPaint::SVGPaintType paintType)
156 {
157 switch (paintType) {
158 case SVGPaint::SVG_PAINTTYPE_URI_NONE:
159 case SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR:
160 case SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR:
161 case SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR:
162 case SVGPaint::SVG_PAINTTYPE_URI:
163 return true;
164 default:
165 break;
166 }
167 return false;
168 }
169
155 static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(Document& document, const SVGPaint::SVGPaintType& paintType, const String& paintUri, Atom icString& id, bool& hasPendingResource) 170 static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(Document& document, const SVGPaint::SVGPaintType& paintType, const String& paintUri, Atom icString& id, bool& hasPendingResource)
156 { 171 {
157 if (paintType != SVGPaint::SVG_PAINTTYPE_URI && paintType != SVGPaint::SVG_P AINTTYPE_URI_RGBCOLOR) 172 if (!svgPaintTypeHasURL(paintType))
158 return 0; 173 return 0;
159 174
160 id = SVGURIReference::fragmentIdentifierFromIRIString(paintUri, document); 175 id = SVGURIReference::fragmentIdentifierFromIRIString(paintUri, document);
161 RenderSVGResourceContainer* container = getRenderSVGResourceContainerById(do cument, id); 176 RenderSVGResourceContainer* container = getRenderSVGResourceContainerById(do cument, id);
162 if (!container) { 177 if (!container) {
163 hasPendingResource = true; 178 hasPendingResource = true;
164 return 0; 179 return 0;
165 } 180 }
166 181
167 RenderSVGResourceType resourceType = container->resourceType(); 182 RenderSVGResourceType resourceType = container->resourceType();
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke) 700 if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke)
686 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke-> element()); 701 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke-> element());
687 } 702 }
688 703
689 if (m_linkedResource) 704 if (m_linkedResource)
690 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_ linkedResource->element()); 705 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_ linkedResource->element());
691 } 706 }
692 #endif 707 #endif
693 708
694 } 709 }
OLDNEW
« no previous file with comments | « Source/core/css/SVGCSSParser.cpp ('k') | Source/core/svg/SVGPaint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698