| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 void SVGPaintServer::prependTransform(const AffineTransform& transform) | 78 void SVGPaintServer::prependTransform(const AffineTransform& transform) |
| 79 { | 79 { |
| 80 ASSERT(m_gradient || m_pattern); | 80 ASSERT(m_gradient || m_pattern); |
| 81 if (m_pattern) | 81 if (m_pattern) |
| 82 m_pattern->setPatternSpaceTransform(transform * m_pattern->patternSpaceT
ransform()); | 82 m_pattern->setPatternSpaceTransform(transform * m_pattern->patternSpaceT
ransform()); |
| 83 else | 83 else |
| 84 m_gradient->setGradientSpaceTransform(transform * m_gradient->gradientSp
aceTransform()); | 84 m_gradient->setGradientSpaceTransform(transform * m_gradient->gradientSp
aceTransform()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 SVGPaintServer SVGPaintServer::requestForRenderer(RenderObject& renderer, Render
Style* style, RenderSVGResourceMode resourceMode) | 87 SVGPaintServer SVGPaintServer::requestForRenderer(const RenderObject& renderer,
const RenderStyle* style, RenderSVGResourceMode resourceMode) |
| 88 { | 88 { |
| 89 ASSERT(style); | 89 ASSERT(style); |
| 90 ASSERT(resourceMode == ApplyToFillMode || resourceMode == ApplyToStrokeMode)
; | 90 ASSERT(resourceMode == ApplyToFillMode || resourceMode == ApplyToStrokeMode)
; |
| 91 | 91 |
| 92 bool hasFallback = false; | 92 bool hasFallback = false; |
| 93 RenderSVGResource* paintingResource = RenderSVGResource::requestPaintingReso
urce(resourceMode, &renderer, style, hasFallback); | 93 RenderSVGResource* paintingResource = RenderSVGResource::requestPaintingReso
urce(resourceMode, renderer, style, hasFallback); |
| 94 if (!paintingResource) | 94 if (!paintingResource) |
| 95 return invalid(); | 95 return invalid(); |
| 96 | 96 |
| 97 SVGPaintServer paintServer = paintingResource->preparePaintServer(&renderer)
; | 97 SVGPaintServer paintServer = paintingResource->preparePaintServer(renderer); |
| 98 if (paintServer.isValid()) | 98 if (paintServer.isValid()) |
| 99 return paintServer; | 99 return paintServer; |
| 100 if (hasFallback) | 100 if (hasFallback) |
| 101 return SVGPaintServer(RenderSVGResource::sharedSolidPaintingResource()->
color()); | 101 return SVGPaintServer(RenderSVGResource::sharedSolidPaintingResource()->
color()); |
| 102 return invalid(); | 102 return invalid(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 SVGPaintServer RenderSVGResource::preparePaintServer(RenderObject*) | 105 SVGPaintServer RenderSVGResource::preparePaintServer(const RenderObject&) |
| 106 { | 106 { |
| 107 ASSERT_NOT_REACHED(); | 107 ASSERT_NOT_REACHED(); |
| 108 return SVGPaintServer::invalid(); | 108 return SVGPaintServer::invalid(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 RenderSVGResource* RenderSVGResource::requestPaintingResource(RenderSVGResourceM
ode mode, RenderObject* object, const RenderStyle* style, bool& hasFallback) | 111 RenderSVGResource* RenderSVGResource::requestPaintingResource(RenderSVGResourceM
ode mode, const RenderObject& object, const RenderStyle* style, bool& hasFallbac
k) |
| 112 { | 112 { |
| 113 ASSERT(object); | |
| 114 ASSERT(style); | 113 ASSERT(style); |
| 115 | 114 |
| 116 hasFallback = false; | 115 hasFallback = false; |
| 117 | 116 |
| 118 // If we have no style at all, ignore it. | 117 // If we have no style at all, ignore it. |
| 119 const SVGRenderStyle& svgStyle = style->svgStyle(); | 118 const SVGRenderStyle& svgStyle = style->svgStyle(); |
| 120 | 119 |
| 121 // If we have no fill/stroke, return 0. | 120 // If we have no fill/stroke, return 0. |
| 122 if (mode == ApplyToFillMode) { | 121 if (mode == ApplyToFillMode) { |
| 123 if (!svgStyle.hasFill()) | 122 if (!svgStyle.hasFill()) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // If the primary resource is just a color, return immediately. | 158 // If the primary resource is just a color, return immediately. |
| 160 RenderSVGResourceSolidColor* colorResource = RenderSVGResource::sharedSolidP
aintingResource(); | 159 RenderSVGResourceSolidColor* colorResource = RenderSVGResource::sharedSolidP
aintingResource(); |
| 161 if (paintType < SVG_PAINTTYPE_URI_NONE) { | 160 if (paintType < SVG_PAINTTYPE_URI_NONE) { |
| 162 // |paintType| will be either <current-color> or <rgb-color> here - both
of which will have a color. | 161 // |paintType| will be either <current-color> or <rgb-color> here - both
of which will have a color. |
| 163 ASSERT(hasColor); | 162 ASSERT(hasColor); |
| 164 colorResource->setColor(color); | 163 colorResource->setColor(color); |
| 165 return colorResource; | 164 return colorResource; |
| 166 } | 165 } |
| 167 | 166 |
| 168 RenderSVGResource* uriResource = 0; | 167 RenderSVGResource* uriResource = 0; |
| 169 if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObj
ect(object)) | 168 if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObj
ect(&object)) |
| 170 uriResource = applyToFill ? resources->fill() : resources->stroke(); | 169 uriResource = applyToFill ? resources->fill() : resources->stroke(); |
| 171 | 170 |
| 172 // If the requested resource is not available, return the color resource or
'none'. | 171 // If the requested resource is not available, return the color resource or
'none'. |
| 173 if (!uriResource) { | 172 if (!uriResource) { |
| 174 // The fallback is 'none'. (SVG2 say 'none' is implied when no fallback
is specified.) | 173 // The fallback is 'none'. (SVG2 say 'none' is implied when no fallback
is specified.) |
| 175 if (paintType == SVG_PAINTTYPE_URI_NONE || !hasColor) | 174 if (paintType == SVG_PAINTTYPE_URI_NONE || !hasColor) |
| 176 return 0; | 175 return 0; |
| 177 | 176 |
| 178 colorResource->setColor(color); | 177 colorResource->setColor(color); |
| 179 return colorResource; | 178 return colorResource; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 // This will process the rest of the ancestors. | 255 // This will process the rest of the ancestors. |
| 257 toRenderSVGResourceContainer(current)->removeAllClientsFromCache(); | 256 toRenderSVGResourceContainer(current)->removeAllClientsFromCache(); |
| 258 break; | 257 break; |
| 259 } | 258 } |
| 260 | 259 |
| 261 current = current->parent(); | 260 current = current->parent(); |
| 262 } | 261 } |
| 263 } | 262 } |
| 264 | 263 |
| 265 } | 264 } |
| OLD | NEW |