| OLD | NEW |
| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // |paintType| will be either <current-color> or <rgb-color> here - both
of which will have a color. | 112 // |paintType| will be either <current-color> or <rgb-color> here - both
of which will have a color. |
| 113 ASSERT(hasColor); | 113 ASSERT(hasColor); |
| 114 colorResource->setColor(color); | 114 colorResource->setColor(color); |
| 115 return colorResource; | 115 return colorResource; |
| 116 } | 116 } |
| 117 | 117 |
| 118 // If no resources are associated with the given renderer, return the color
resource. | 118 RenderSVGResource* uriResource = 0; |
| 119 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(
object); | 119 if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObj
ect(object)) |
| 120 if (!resources) { | 120 uriResource = applyToFill ? resources->fill() : resources->stroke(); |
| 121 if (paintType == SVG_PAINTTYPE_URI_NONE || (!hasColor && !inheritColorFr
omParentStyle(object, applyToFill, color))) | 121 |
| 122 // If the requested resource is not available, return the color resource or
'none'. |
| 123 if (!uriResource) { |
| 124 // The fallback is 'none'. |
| 125 if (paintType == SVG_PAINTTYPE_URI_NONE) |
| 122 return 0; | 126 return 0; |
| 123 | 127 // If there's no fallback color, attempt to use the the parents paint |
| 124 colorResource->setColor(color); | 128 // server if it's a simple <color>. |
| 125 return colorResource; | |
| 126 } | |
| 127 | |
| 128 // If the requested resource is not available, return the color resource. | |
| 129 RenderSVGResource* uriResource = mode == ApplyToFillMode ? resources->fill()
: resources->stroke(); | |
| 130 if (!uriResource) { | |
| 131 if (!hasColor && !inheritColorFromParentStyle(object, applyToFill, color
)) | 129 if (!hasColor && !inheritColorFromParentStyle(object, applyToFill, color
)) |
| 132 return 0; | 130 return 0; |
| 133 | 131 |
| 134 colorResource->setColor(color); | 132 colorResource->setColor(color); |
| 135 return colorResource; | 133 return colorResource; |
| 136 } | 134 } |
| 137 | 135 |
| 138 // The paint server resource exists, though it may be invalid (pattern with
width/height=0). Pass the fallback color to our caller | 136 // The paint server resource exists, though it may be invalid (pattern with
width/height=0). Pass the fallback color to our caller |
| 139 // via sharedSolidPaintingResource so it can use the solid color painting re
source, if applyResource() on the URI resource failed. | 137 // via sharedSolidPaintingResource so it can use the solid color painting re
source, if applyResource() on the URI resource failed. |
| 140 if (hasColor) { | 138 if (hasColor) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // This will process the rest of the ancestors. | 210 // This will process the rest of the ancestors. |
| 213 toRenderSVGResourceContainer(current)->removeAllClientsFromCache(); | 211 toRenderSVGResourceContainer(current)->removeAllClientsFromCache(); |
| 214 break; | 212 break; |
| 215 } | 213 } |
| 216 | 214 |
| 217 current = current->parent(); | 215 current = current->parent(); |
| 218 } | 216 } |
| 219 } | 217 } |
| 220 | 218 |
| 221 } | 219 } |
| OLD | NEW |