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

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

Issue 191003007: Use isSVG*Element() helpers more in SVG code (Part 3) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 if (s_tagList.isEmpty()) { 130 if (s_tagList.isEmpty()) {
131 s_tagList.add(SVGNames::linearGradientTag.localName()); 131 s_tagList.add(SVGNames::linearGradientTag.localName());
132 s_tagList.add(SVGNames::filterTag.localName()); 132 s_tagList.add(SVGNames::filterTag.localName());
133 s_tagList.add(SVGNames::patternTag.localName()); 133 s_tagList.add(SVGNames::patternTag.localName());
134 s_tagList.add(SVGNames::radialGradientTag.localName()); 134 s_tagList.add(SVGNames::radialGradientTag.localName());
135 } 135 }
136 136
137 return s_tagList; 137 return s_tagList;
138 } 138 }
139 139
140 static inline AtomicString targetReferenceFromResource(SVGElement* element) 140 static inline AtomicString targetReferenceFromResource(SVGElement& element)
141 { 141 {
142 String target; 142 String target;
143 if (element->hasTagName(SVGNames::patternTag)) 143 if (isSVGPatternElement(element))
144 target = toSVGPatternElement(element)->href()->currentValue()->value(); 144 target = toSVGPatternElement(element).href()->currentValue()->value();
145 else if (element->hasTagName(SVGNames::linearGradientTag) || element->hasTag Name(SVGNames::radialGradientTag)) 145 else if (isSVGGradientElement(element))
146 target = toSVGGradientElement(element)->href()->currentValue()->value(); 146 target = toSVGGradientElement(element).href()->currentValue()->value();
147 else if (element->hasTagName(SVGNames::filterTag)) 147 else if (isSVGFilterElement(element))
148 target = toSVGFilterElement(element)->href()->currentValue()->value(); 148 target = toSVGFilterElement(element).href()->currentValue()->value();
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.docu ment());
153 } 153 }
154 154
155 static inline bool svgPaintTypeHasURL(SVGPaint::SVGPaintType paintType) 155 static inline bool svgPaintTypeHasURL(SVGPaint::SVGPaintType paintType)
156 { 156 {
157 switch (paintType) { 157 switch (paintType) {
158 case SVGPaint::SVG_PAINTTYPE_URI_NONE: 158 case SVGPaint::SVG_PAINTTYPE_URI_NONE:
159 case SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR: 159 case SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR:
160 case SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR: 160 case SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR:
161 case SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: 161 case SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR:
162 case SVGPaint::SVG_PAINTTYPE_URI: 162 case SVGPaint::SVG_PAINTTYPE_URI:
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 bool hasPendingResource = false; 278 bool hasPendingResource = false;
279 AtomicString id; 279 AtomicString id;
280 RenderSVGResourceContainer* resource = paintingResourceFromSVGPaint( document, style->strokePaintType(), style->strokePaintUri(), id, hasPendingResou rce); 280 RenderSVGResourceContainer* resource = paintingResourceFromSVGPaint( document, style->strokePaintType(), style->strokePaintUri(), id, hasPendingResou rce);
281 if (!ensureResources(resources)->setStroke(resource) && hasPendingRe source) { 281 if (!ensureResources(resources)->setStroke(resource) && hasPendingRe source) {
282 registerPendingResource(extensions, id, element); 282 registerPendingResource(extensions, id, element);
283 } 283 }
284 } 284 }
285 } 285 }
286 286
287 if (chainableResourceTags().contains(tagName)) { 287 if (chainableResourceTags().contains(tagName)) {
288 AtomicString id = targetReferenceFromResource(element); 288 AtomicString id = targetReferenceFromResource(*element);
289 if (!ensureResources(resources)->setLinkedResource(getRenderSVGResourceC ontainerById(document, id))) 289 if (!ensureResources(resources)->setLinkedResource(getRenderSVGResourceC ontainerById(document, id)))
290 registerPendingResource(extensions, id, element); 290 registerPendingResource(extensions, id, element);
291 } 291 }
292 292
293 return (!resources || resources->hasResourceData()) ? nullptr : resources.re lease(); 293 return (!resources || resources->hasResourceData()) ? nullptr : resources.re lease();
294 } 294 }
295 295
296 void SVGResources::layoutIfNeeded() 296 void SVGResources::layoutIfNeeded()
297 { 297 {
298 if (m_clipperFilterMaskerData) { 298 if (m_clipperFilterMaskerData) {
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke) 699 if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke)
700 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke-> element()); 700 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke-> element());
701 } 701 }
702 702
703 if (m_linkedResource) 703 if (m_linkedResource)
704 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_ linkedResource->element()); 704 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_ linkedResource->element());
705 } 705 }
706 #endif 706 #endif
707 707
708 } 708 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/SVGRenderTreeAsText.cpp ('k') | Source/core/rendering/svg/SVGRootInlineBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698