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. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 */ | 21 */ |
22 | 22 |
23 #include "config.h" | 23 #include "config.h" |
24 #include "core/rendering/svg/RenderSVGResource.h" | 24 #include "core/rendering/svg/RenderSVGResourcePaintServer.h" |
25 | 25 |
26 #include "core/rendering/style/RenderStyle.h" | 26 #include "core/rendering/style/RenderStyle.h" |
27 #include "core/rendering/svg/RenderSVGResourceContainer.h" | |
28 #include "core/rendering/svg/SVGResources.h" | 27 #include "core/rendering/svg/SVGResources.h" |
29 #include "core/rendering/svg/SVGResourcesCache.h" | 28 #include "core/rendering/svg/SVGResourcesCache.h" |
30 #include "platform/graphics/GraphicsContext.h" | 29 #include "platform/graphics/GraphicsContext.h" |
31 #include "platform/graphics/GraphicsContextStateSaver.h" | 30 #include "platform/graphics/GraphicsContextStateSaver.h" |
32 | 31 |
33 namespace blink { | 32 namespace blink { |
34 | 33 |
35 SVGPaintServer::SVGPaintServer(Color color) | 34 SVGPaintServer::SVGPaintServer(Color color) |
36 : m_color(color) | 35 : m_color(color) |
37 { | 36 { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 125 } |
127 } | 126 } |
128 | 127 |
129 // If the primary resource is just a color, return immediately. | 128 // If the primary resource is just a color, return immediately. |
130 if (paintType < SVG_PAINTTYPE_URI_NONE) { | 129 if (paintType < SVG_PAINTTYPE_URI_NONE) { |
131 // |paintType| will be either <current-color> or <rgb-color> here - both
of which will have a color. | 130 // |paintType| will be either <current-color> or <rgb-color> here - both
of which will have a color. |
132 ASSERT(hasColor); | 131 ASSERT(hasColor); |
133 return SVGPaintDescription(color); | 132 return SVGPaintDescription(color); |
134 } | 133 } |
135 | 134 |
136 RenderSVGResource* uriResource = 0; | 135 RenderSVGResourcePaintServer* uriResource = 0; |
137 if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObj
ect(&object)) | 136 if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObj
ect(&object)) |
138 uriResource = applyToFill ? resources->fill() : resources->stroke(); | 137 uriResource = applyToFill ? resources->fill() : resources->stroke(); |
139 | 138 |
140 // If the requested resource is not available, return the color resource or
'none'. | 139 // If the requested resource is not available, return the color resource or
'none'. |
141 if (!uriResource) { | 140 if (!uriResource) { |
142 // The fallback is 'none'. (SVG2 say 'none' is implied when no fallback
is specified.) | 141 // The fallback is 'none'. (SVG2 say 'none' is implied when no fallback
is specified.) |
143 if (paintType == SVG_PAINTTYPE_URI_NONE || !hasColor) | 142 if (paintType == SVG_PAINTTYPE_URI_NONE || !hasColor) |
144 return SVGPaintDescription(); | 143 return SVGPaintDescription(); |
145 | 144 |
146 return SVGPaintDescription(color); | 145 return SVGPaintDescription(color); |
(...skipping 24 matching lines...) Expand all Loading... |
171 if (paintDescription.hasFallback) | 170 if (paintDescription.hasFallback) |
172 return SVGPaintServer(paintDescription.color); | 171 return SVGPaintServer(paintDescription.color); |
173 return invalid(); | 172 return invalid(); |
174 } | 173 } |
175 | 174 |
176 bool SVGPaintServer::existsForRenderer(const RenderObject& renderer, const Rende
rStyle* style, RenderSVGResourceMode resourceMode) | 175 bool SVGPaintServer::existsForRenderer(const RenderObject& renderer, const Rende
rStyle* style, RenderSVGResourceMode resourceMode) |
177 { | 176 { |
178 return requestPaint(renderer, style, resourceMode).isValid; | 177 return requestPaint(renderer, style, resourceMode).isValid; |
179 } | 178 } |
180 | 179 |
181 SVGPaintServer RenderSVGResource::preparePaintServer(const RenderObject&) | 180 RenderSVGResourcePaintServer::RenderSVGResourcePaintServer(SVGElement* element) |
| 181 : RenderSVGResourceContainer(element) |
182 { | 182 { |
183 ASSERT_NOT_REACHED(); | |
184 return SVGPaintServer::invalid(); | |
185 } | 183 } |
186 | 184 |
187 SVGPaintDescription RenderSVGResource::requestPaintDescription(const RenderObjec
t& renderer, const RenderStyle* style, RenderSVGResourceMode resourceMode) | 185 RenderSVGResourcePaintServer::~RenderSVGResourcePaintServer() |
| 186 { |
| 187 } |
| 188 |
| 189 SVGPaintDescription RenderSVGResourcePaintServer::requestPaintDescription(const
RenderObject& renderer, const RenderStyle* style, RenderSVGResourceMode resource
Mode) |
188 { | 190 { |
189 return requestPaint(renderer, style, resourceMode); | 191 return requestPaint(renderer, style, resourceMode); |
190 } | 192 } |
191 | 193 |
192 } | 194 } |
OLD | NEW |