OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2009-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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 class GraphicsContext; | 44 class GraphicsContext; |
45 class RenderObject; | 45 class RenderObject; |
46 class RenderStyle; | 46 class RenderStyle; |
47 class RenderSVGResourceSolidColor; | 47 class RenderSVGResourceSolidColor; |
48 | 48 |
49 class RenderSVGResource { | 49 class RenderSVGResource { |
50 public: | 50 public: |
51 RenderSVGResource() { } | 51 RenderSVGResource() { } |
52 virtual ~RenderSVGResource() { } | 52 virtual ~RenderSVGResource() { } |
53 | 53 |
54 virtual void removeAllClientsFromCache(bool markForInvalidation = true) = 0; | |
55 virtual void removeClientFromCache(RenderObject*, bool markForInvalidation =
true) = 0; | |
56 | |
57 virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*, Re
nderSVGResourceModeFlags); | 54 virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*, Re
nderSVGResourceModeFlags); |
58 virtual void postApplyResource(GraphicsContext*) { } | 55 virtual void postApplyResource(GraphicsContext*) { } |
59 | 56 |
60 virtual RenderSVGResourceType resourceType() const = 0; | 57 virtual RenderSVGResourceType resourceType() const = 0; |
61 | 58 |
62 template<class Renderer> | 59 template<class Renderer> |
63 Renderer* cast() | 60 Renderer* cast() |
64 { | 61 { |
65 if (Renderer::s_resourceType == resourceType()) | 62 if (Renderer::s_resourceType == resourceType()) |
66 return static_cast<Renderer*>(this); | 63 return static_cast<Renderer*>(this); |
67 | 64 |
68 return 0; | 65 return 0; |
69 } | 66 } |
70 | 67 |
71 // Helper utilities used in the render tree to access resources used for pai
nting shapes/text (gradients & patterns & solid colors only) | 68 // Helper utilities used in the render tree to access resources used for pai
nting shapes/text (gradients & patterns & solid colors only) |
72 // If hasFallback gets set to true, the sharedSolidPaintingResource is set t
o a fallback color. | 69 // If hasFallback gets set to true, the sharedSolidPaintingResource is set t
o a fallback color. |
73 static RenderSVGResource* requestPaintingResource(RenderSVGResourceMode, Ren
derObject*, const RenderStyle*, bool& hasFallback); | 70 static RenderSVGResource* requestPaintingResource(RenderSVGResourceMode, Ren
derObject*, const RenderStyle*, bool& hasFallback); |
74 static RenderSVGResourceSolidColor* sharedSolidPaintingResource(); | 71 static RenderSVGResourceSolidColor* sharedSolidPaintingResource(); |
75 | 72 |
76 static void markForLayoutAndParentResourceInvalidation(RenderObject*, bool n
eedsLayout = true); | 73 static void markForLayoutAndParentResourceInvalidation(RenderObject*, bool n
eedsLayout = true); |
77 }; | 74 }; |
78 | 75 |
79 #define DEFINE_RENDER_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ | 76 #define DEFINE_RENDER_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ |
80 DEFINE_TYPE_CASTS(thisType, RenderSVGResource, resource, resource->resourceT
ype() == typeName, resource.resourceType() == typeName) | 77 DEFINE_TYPE_CASTS(thisType, RenderSVGResource, resource, resource->resourceT
ype() == typeName, resource.resourceType() == typeName) |
81 | 78 |
82 } | 79 } |
83 | 80 |
84 #endif | 81 #endif |
OLD | NEW |