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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 class RenderObject; | 50 class RenderObject; |
51 class RenderStyle; | 51 class RenderStyle; |
52 class RenderSVGResourceSolidColor; | 52 class RenderSVGResourceSolidColor; |
53 | 53 |
54 class SVGPaintServer { | 54 class SVGPaintServer { |
55 public: | 55 public: |
56 explicit SVGPaintServer(Color); | 56 explicit SVGPaintServer(Color); |
57 explicit SVGPaintServer(PassRefPtr<Gradient>); | 57 explicit SVGPaintServer(PassRefPtr<Gradient>); |
58 explicit SVGPaintServer(PassRefPtr<Pattern>); | 58 explicit SVGPaintServer(PassRefPtr<Pattern>); |
59 | 59 |
60 static SVGPaintServer requestForRenderer(RenderObject&, RenderStyle*, Render
SVGResourceModeFlags); | 60 static SVGPaintServer requestForRenderer(RenderObject&, RenderStyle*, Render
SVGResourceMode); |
61 | 61 |
62 void apply(GraphicsContext&, RenderSVGResourceMode, GraphicsContextStateSave
r* = 0); | 62 void apply(GraphicsContext&, RenderSVGResourceMode, GraphicsContextStateSave
r* = 0); |
63 | 63 |
64 static SVGPaintServer invalid() { return SVGPaintServer(Color(Color::transpa
rent)); } | 64 static SVGPaintServer invalid() { return SVGPaintServer(Color(Color::transpa
rent)); } |
65 bool isValid() const { return m_color != Color::transparent; } | 65 bool isValid() const { return m_color != Color::transparent; } |
66 | 66 |
| 67 bool isTransformDependent() const { return m_gradient || m_pattern; } |
| 68 void prependTransform(const AffineTransform&); |
| 69 |
67 private: | 70 private: |
68 RefPtr<Gradient> m_gradient; | 71 RefPtr<Gradient> m_gradient; |
69 RefPtr<Pattern> m_pattern; | 72 RefPtr<Pattern> m_pattern; |
70 Color m_color; | 73 Color m_color; |
71 }; | 74 }; |
72 | 75 |
73 class RenderSVGResource { | 76 class RenderSVGResource { |
74 public: | 77 public: |
75 RenderSVGResource() { } | 78 RenderSVGResource() { } |
76 virtual ~RenderSVGResource() { } | 79 virtual ~RenderSVGResource() { } |
77 | 80 |
78 virtual SVGPaintServer preparePaintServer(RenderObject*, RenderStyle*, Rende
rSVGResourceModeFlags); | 81 virtual SVGPaintServer preparePaintServer(RenderObject*); |
79 | 82 |
80 virtual RenderSVGResourceType resourceType() const = 0; | 83 virtual RenderSVGResourceType resourceType() const = 0; |
81 | 84 |
82 // Helper utilities used in the render tree to access resources used for pai
nting shapes/text (gradients & patterns & solid colors only) | 85 // Helper utilities used in the render tree to access resources used for pai
nting shapes/text (gradients & patterns & solid colors only) |
83 // If hasFallback gets set to true, the sharedSolidPaintingResource is set t
o a fallback color. | 86 // If hasFallback gets set to true, the sharedSolidPaintingResource is set t
o a fallback color. |
84 static RenderSVGResource* requestPaintingResource(RenderSVGResourceMode, Ren
derObject*, const RenderStyle*, bool& hasFallback); | 87 static RenderSVGResource* requestPaintingResource(RenderSVGResourceMode, Ren
derObject*, const RenderStyle*, bool& hasFallback); |
85 static RenderSVGResourceSolidColor* sharedSolidPaintingResource(); | 88 static RenderSVGResourceSolidColor* sharedSolidPaintingResource(); |
86 | 89 |
87 static void markForLayoutAndParentResourceInvalidation(RenderObject*, bool n
eedsLayout = true); | 90 static void markForLayoutAndParentResourceInvalidation(RenderObject*, bool n
eedsLayout = true); |
88 }; | 91 }; |
89 | 92 |
90 #define DEFINE_RENDER_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ | 93 #define DEFINE_RENDER_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \ |
91 DEFINE_TYPE_CASTS(thisType, RenderSVGResource, resource, resource->resourceT
ype() == typeName, resource.resourceType() == typeName) | 94 DEFINE_TYPE_CASTS(thisType, RenderSVGResource, resource, resource->resourceT
ype() == typeName, resource.resourceType() == typeName) |
92 | 95 |
93 } | 96 } |
94 | 97 |
95 #endif | 98 #endif |
OLD | NEW |